C Compiled
C Compiled
Input 1, 2 & 3
1. what is algorithm/flowchart. How is it different from flowchart?
2. Explain flowchart with example. What are the benefits of using flowchart.
3. what are the features of a good algorithm/flowcharts.
Control Statement
Questions and program
1. What are the four types of control statement use in C programming? Explain
2. What do you mean by looping? Explain while loop with suitable example.
Compare while loop with do while loop. Write a program to find sum and
average of first n natural numbers. [10 marks]
3.
4. What is looping statement? Discuss different looping statements with suitable
example of each.
5. What do you mean by entry-controlled and exit-controlled loop? Write a
program to print the following output.(2+4)
1
01
101
0101
10101
6. Differentiate break statement with continue statement. What is the output if
the following program ?
#include<stdio.h>
#include<conio.h>
#include<math.h>
Void main()
{
int x=2, n=5, sum=0, i;
clrscr();
for(i=1; i<=n; i++)
{
If(i%2==0)
Sum==sum-pow(x,i);
elseDownloaded from CSIT Tutor
sum=sum+pow(x,1);
}
Printf(“sum=%d”,sum);
Getch();
}
7. Why do we need a break and continue statement? Define formal argument
and actual argument in function with examples. Identify and list the errors in
the following code.
int main(){
int a,b,c
scanf("%d%d%d, &a, &b, &c);
sum(a, b, c);
return -1;
}
void sum(int x, int y, int z){
int sum;
sum = a + b + c;
return sum;
Programs
1. Write a program to find the sum of each row of 3*2 matrix.
2. Write a program to check whether the diagonal elements of a (4*4) matrix
are all Zero.
3. Write a program to add two matrices using array.
4. Write a program to find transpose of a matrix.
5. Write a program to read a character array in input as "TRIBHUVAN
UNIVERSITY" from the user and find out how many times a character "I"
occurs in that array?
6. Write a program to check if two matrices are identical or not.
7. Write a program to read P*Q matrix of integers and find the largest integer of each row
and display it.
8. Write a program to initialize an array of dimension 10 and sort the numbers within the
array in ascending order.
Functions
1. Explain the functions and its types use in C programming with example
2. Discuss the benefits of using functions.
3. Explain the passing structure to function with example
4. Explain pass by value and pass by reference with suitable example of each.
5. Differentiate between call by value and call by reference with example.
6. What is structure? How is it different from array and Union? Discuss
7. Explain nested structure with example.
8. What is the difference between exit(0) and exit(1)? Discuss the need of
nested structue with an example. Write a program to find the value of x y
without using POW function. [10-marks]
9. Explain different file I/O functions with example
[Link] the different types of I/O functions used in file handling with syntax.
[Link] any three string functions.
[Link] the concept of recursive function using the example program to find
the factorial of given positive integer
[Link] is the advantage of the union over structure? List any four-string library
functions with the prototype.
[Link] structure and nested structure. Write a program to find out whether the nth term
of the Fibonacci series is a prime number or not. Read the value of n from the user and
display the result in the main function. Uses separate user-defined function to generate
the nth Fibonacci term and to check whether that number is prime or not. [10-marks]
Programs
1. Write a program to accept 10 numbers and print the sum of these numbers
through function.
2. What is structure? Create a structure rectangle with data members length
and breadth.
3. WAP to find sum and average of 10 integer numbers stored in an array.
4. Write a program to find product of two integers using your own function.
5. Write a program using your own function to find sum of two numbers.
6. Write a program to find the value of x y without using POW function.
7. Write a program to find out whether the nth term of the Fibonacci series is a prime
number or not.
8. Write a program to find the second largest number in the given array of
numbers.
9. Write a program to compute the sum of first 10 even numbers using function.
10.
[Link] a structure named book with name, author, and publisher as its
members. Write a program using this structure to read data of 50 books and
display name of those books published by “XYX” publisher.
[Link] a structure named Book with members Book_Name, Price and Author_Name,
then take input for 10 records of Book and print the name of authors having the price of
book greater than 1000.
Pointers
1. Define pointer. Discuss the relationship between pointer and one-dimensional
array.
2. How do you return pointers from functions? Explain with example
3. Explain the use of pointer in C-programming. How can you declare the
pointer? Explain with example.
4.
5. What is dynamic memory allocation? Discuss the use of malloc() in dynamic
memory allocation with example.
6. Explain dynamic memory allocation with example
7. What is dynamic memory allocation? Write a program to find sum and
average of numbers entered from the keyboard using dynamic memory
allocation to create array to store these n numbers.
8. What is the function of a pointer variable? Explain the declaring and
initializing pointers with example.
9. Describe the fundamental concept of pointer and its arithmetic with suitable
examples
[Link] any one advantage and disadvantage of the pointer. How do you pass
pointers as function arguments?
Programs
1. Write a program to accept 10 numbers and soft them with using pointer.
2. Write a program to find sum and average of n numbers entered from the
keyboard using dynamic memory allocation to create array to store these n
numbers.
3. Write a program using pointers to read in an array of integers and print its
elements in reverse order.
File Handling
1. Discuss different file openings modes.
2. Why do we need data files? What are the different file opening modes? Write
a program that reads data from a file "[Link]" and writes to "[Link]"
file. (10-Marks)
3.
Programs
1. Write a program to read the data file which has following details.
a. Name
b. Age
c. Test player
d. Total run.
2. Write a program to read all the numbers from the input file “[Link]” and store
only even numbers in an output file named as “[Link]”.
3. Write a program to read and print data stored in a input file .txt.
4. Write a program that simply reads data from a file.
5. Suppose a file named “[Link]” contains a list of integers. Write a program to
extract the prime numbers only from that file and write them on “[Link]” file.
6.
Graphic
1. Discuss with example any five graphics function used in c-programming.
2. Define the graphics function.
3. Why do we need graphics function?
OR
Explain the use of graphical functions.
Short Notes
1. Graphics function
2. Formatted I/O
3. Documentation
4. Structure
5. Benefits of data files
6. Compilation and execution
7. Operator precedence and associativity
8. Dynamic Memory Allocation
9. break and continue.
[Link] of Computer
[Link] Operator
[Link], Global, and Static variables
[Link] Operator
#include<conio.h>
#include<stdio.h>
void main(){
int i =0,k;
for(k=5;k>=0;k–){
i=i+k;
}
printf(“%d\t”,i);
getch();
}