QB C Csa0214 (1) 20210125081101
QB C Csa0214 (1) 20210125081101
QUESTION BANK
Course Code: CSA0214 Course Name: C PROGRAMMING WITH SYSTEM MANIPULATIONS
Branch: CSE Year :I, II,III Semester:II,IV,VI
Course Outcomes (CO)
Q. Questions Mark C BT PI
No
. s O L
UNIT 1
1 List out the various categories of data types available in 2 1 1 1.4.1
C. Give two examples for each.
2 What are comments and how do you insert it in a C 2 1 1 1.4.1
program?
3 How can the value of an expression be converted to a 2 1 2 2.3.1
different data type? What is this feature called?
4 What are keywords? Give example. 2 1 1 1.4.1
5 State the two different ways to use the increment and 2 1 2 1.4.1
decrement operators. How do the two methods differ?
6 With an example brief the concept of operator 2 1 2 1.4.1
precedence.
7 Give the syntax and example for variable declaration in 2 1 2 1.4.1
C.
8 What is a symbolic constant? How is it defined? 2 1 2 1.4.1
9 What will be the output of the following C program 2 2 3 1.4.1
segment?
char inchar = 'A';
switch (inchar)
{
case 'A' :
printf ("choice A \n") ;
case 'B' :
printf ("choice B ") ;
default:
printf ("No Choice") ;
}
10 What is the difference between while loop and do..while 2 2 2 1.4.1
loop?
11 What are pre-processor directives? 2 1 1 1.4.1
12 What is Ternary operator ? 2 2 1 1.4.1
13 What are header files and what are its uses in C 2 1 2 1.4.1
programming?
14 Execution of a C program starts from which function? 2 2 3 2.3.1
15 What is the use of sizeof() operator in C? 2 1 1 2.3.1
16 Differentiate break and continue statement. 2 2 2 2.2.4
17 What are enumerated types? 2 1 1 1.4.1
18 Write a C program to find the sum of squares of ‘n’ 5 2 3 2.3.1
numbers using for loop.
19 Write a C program for finding the factorial of a given 5 2 3 2.3.1
number using while loop.
20 Illustrate the concept of switch with syntax and 5 2 2 2.4.1
example.
21 With syntax and example, explain conditional operator 5 2 2 2.4.1
and if-else statement.
22 Two values are input through the keyboard into two 5 1 2 1.4.1
locations P and Q, write a C program to interchange the
contents of P and Q.
23 The numbers in the sequence 5 2 4 2.1.3
0 1 1 2 3 5 8 13 21 ........
are called Fibonacci numbers. With the help of a
do...while loop in C, print the first m Fibonacci
numbers.
24 Relationship between Celsius and Fahrenheit is 5 1 3 1.4.1
governed by the formula F=9C / (5 + 32). write a C
program to convert the temperature to Fahrenheit.
25 Write a C program to read three values from the 5 2 3 2.1.3
keyboard and print the largest of them (nested if).
26 Ramesh’s basic salary is input through the keyboard. 5 1 3 1.4.1
His dearness allowance is 40% of basic, house rent
allowance is 20% of basic salary. Write a C program to
calculate his gross salary.
27 Describe the structure of C program with an example. 5 1 1 2.3.1
28 Generate the even numbers from 1 to 100 using a suitable 10 1 3 2.1.3
operator in C.
29 Write a program to do the following: 5 1 3 2.1.3
(a) Declare x, y and z as integer variables.
(b) Assign two 5 digit numbers to x and y
(c) Assign the sum of x and y to z
(d) Output the values of x, y and z
Comment on the output.
30 Operators are used for performing various operations. C 10 1 2 2.1.3
language has a variety of operators; discuss them in
detail with examples.
31 Generate an electricity bill using C program based on 10 2 3 1.4.1
following information:
Unit Rate of charge
0-150 Rs 3 per unit
151-350 Rs 100 plus 4 per unit
32 Write a menu-driven program using C which has the 10 2 3 2.1.3
following options:
1.Prime or not
2. Odd or even
Once a menu item is selected the appropriate action
should be taken and once this action is finished the
menu should reappear. Unless the user selects the ‘Exit’
option the program should continue to run.
33 Describe four basic data types. How could you extend 10 1 2 2.3.1
the range of values they represent?
34 Develop a C Program to convert given number (1 to 5) 10 2
into words using switch.
UNIT 2
1 Define a float array of size 5 and assign 5 values to it. 2 1 3 2.3.1
2 Predict output of following program 2 1 3 1.4.1
int main()
{
int i;
int arr[5] = {1};
for (i = 0; i < 5; i++)
printf("%d ", arr[i]);
return 0;
}
3 Predict output of the following program: 2 3 3 1.4.1
int main()
{
int a[][] = {{1,2},{3,4}};
int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
printf("%d ", a[i][j]);
return 0;
}
4 What will be printed after execution of the following code? 2 1 3 1.4.1
void main()
{
int arr[10] = {1, 2, 3, 4, 5};
printf(“%d”, arr[5]);
}
5 What will you do when you want to store a list of similar 2 1 2 2.3.1
data items and what feature is available in C to do this?
6 Initialization means storing the initial value to a variable. 2 1 1 2.3.1
How can we initialize an array of elements?
7 What is the meaning of base address of the array? 2 1 2 1.3.1
8 How do you declare a multidimensional array? 2 3 1 1.4.1
9 What is the advantage of an array over individual 2 1 2 1.4.1
variables?
10 Define an array. 2 1 1 1.3.1
11 Why is it necessary to give the size of an array in an array 2 1 2 1.3.1
declaration?
12 What are the types of Arrays? 2 1 1 1.3.1
13 Give general Syntax to declare One dimensional array. 2 1 1 1.4.1
14 What are the rules to declare one dimensional array? 2 1 1 1.4.1
15 Give general Syntax to declare two dimensional array. 2 3 1 1.3.1
16 C has many built in functions to do various operations. 5 2 2 2.3.1
One such function is to convert a string to integer value.
What is the function, write its syntax. Brief its
functionality with an example.
17 What is an array? Explain the declaration and initialization 5 1 1 1.3.1
of one and two dimensional arrays with example.
18 Explain one dimensional array with an example 5 1 1 1.3.1
19 Explain Two dimensional array with an example 5 3 1 1.3.1
20 Explain applications of array 5 3 3 1.3.1
21 What is an array indexing explain with an example 5 1 2 1.4.1
22 What is character array, how it differs from other data 5 1 2 2.2.4
type?
23 Write a C Program to find the position of given number in 5 1 3 2.1.3
array
24 Write a C Program to check if given number is present in 5 1 3 2.1.3
an array or not.
25 Write a C Program to print even and odd number from an 5 1 3 2.1.3
array.
26 Arranging the data in certain order for faster retrieval is a 10 1 3 2.1.3
concept called sorting. What are the various types of
sorting techniques available? With an example implement
any one type of sorting using C.
27 Retrieval of data for manipulation is called Searching. 10 1 3 2.1.3
Implement a searching technique for retrieval of data from
a sorted input. Illustrate the functionality with an example.
28 Data in real world is voluminous now a days and the 10 3 4 2.3.1
perspective we view the data is also multidimensional.
How can we handle this situation in C, discuss with a real
world example.
29 Write Code using C for performing addition of two 10 3 3 2.1.3
matrices.
30 Data can be viewed in two dimensions which we call 10 3 3 2.1.3
matrix or table with row as one dimension and column as
the other dimension. Get two matrices of integer values as
input and generate the product of the two if possible. With
the help of C, code for the above.
31 Consider an array with the following elements 10 1 3 4.1.2
70, 65, 2, 36, 35, 55, 0, 89, 67, 33
Use a sorting technique to sort the given elements.
32 Develop a C program to implement the linear search 10 1 3 2.1.3
algorithm.
33 Develop a C program to implement the binary search 10 1 3 2.2.3
algorithm.
34 Given a matrix of size m x n, implement a C program to 10 3 3 2.1.3
print the transpose of the given matrix.
35 An unsorted list of student names are given as input, sort 10 3 3 4.1.2
the list in alphabetical order by applying any sorting
technique using C.
UNIT 3
1 C is a modular programming language. What feature is 2 2 2 2.3.1
available in C to support modular programming?
2 Differentiate user-defined and pre-defined function. 2 2 3 2.2.4
3 Name the string function used to find the length of the 2 2 1 1.4.1
string. Give syntax and example.
4 What is the output of the following C code? Assume that 2 4 4 1.4.1
the address of x is 2000(decimal) and an integer requires
two bytes of memory?
int main()
{
unsigned int x[4][3] = {{1,2,3},{4,5,6},{7,8,9},
{10,11,12}};
printf(“%u, %u, %u”, x + 3, *(x+3), *(x+2) + 3);
}
5 How does pointer points to another pointer? 2 4 3 1.3.1
6 What is a function in C? 2 2 1 1.3.1
7 What are actual arguments? 2 4 1 1.3.1
8 What are formal parameters? 2 4 1 1.3.1
9 Differentiate actual and formal parameters. 2 4 2 2.2.4
10 Which function in C can be used to append a string to 2 2 1 1.3.1
another string?
11 What are pointers? 2 4 1 1.3.1
12 Differentiate call by value and call by reference. 2 4 2 2.2.4
13 List any 2 string functions with syntax and example? 2 2 1 1.3.1
14 Distinguish between malloc() and calloc(). 2 4 2 2.2.4
15 What is the recursive function. List out their merits and 2 2 2 1.3.1
demerits.
16 What is the difference between Strings and Arrays? 2 1 2 2.2.4
17 Differentiate static and dynamic memory allocation. 2 4 2 2.2.4
18 Suppose an array is passed to a function as an argument. If 5 2 4 2.3.1
the value of an array element is altered within the function,
will this change be recognized within the calling portion of
the program?
19 What is a Pointer variable? What difference do you find in 5 4 4 2.3.1
the declaration of a pointer from a normal variable?
20 Many operators have multiple functions depending on the 5 4 2 2.3.1
concept it is used. Similarly the operators * and & are used
in pointers, what does it mean when used with pointers.
Illustrate with an example.
21 What are the differences between passing an array to a 5 4 2 2.3.1
function and passing a single-valued data item to a
function?
22 Write a function exchange to interchange the values of two 5 2 3 3.4.2
variables, say x and y. Illustrate the use of this function, in
calling function.
23 A function in C can take parameters as input. What are the 10 4 3 2.3.1
ways and discuss how they differ from each other with an
example function.
24 Write a recursive function using C that computes the 10 2 3 2.1.2
factorial of a given number.
25 We all know that memory is allocated during compilation. 10 4 4 2.3.1
But there are situations and necessity that memory
allocation could be done during runtime that is during
execution of the program. Explain what feature is available
in C for serving this purpose?
26 Name the library function used to allocate memory 10 4 3 2.3.1
dynamically? How is the size of the memory block
specified? Explain with an example.
27 Code using C to receive 3 integers from command line and 10 4 3 2.1.2
find the largest of the 3 integers.
28 String is not a data type in C. So how will you handle 10 2 2 2.3.1
strings in C and explain how strings can be manipulated.
29 Write a program using pointers to compute the sum of all 10 4 3 1.4.1
elements stored in an array.
UNIT 4
1 Consider the following C declaration 2 4 3 4.3.4
struct {
short s [5]
union {
float y;
long z;
}u;
} t;
Assume that objects of the type short, float and long
occupy 2 bytes, 4 bytes and 8 bytes, respectively. The
memory requirement for variable t.
2 What is the output of the following C program? 2 2 3 1.4.1
main()
{
struct emp {
char name[2];
int age
float sal;
};
struct emp e = {“Tiger”};
printf(“%d%f”, e.age, e.sal);
}
3 With an example show how structure members are 2 1 2 2.3.1
declared?
4 C has features to handle heterogeneous data, one such 2 1 2 2.3.1
feature is Union. With a syntax and example show how
union is declared and accessed?
5 How are the members of union accessed? Is there any 2 1 2 2.2.4
difference in accessing a structure member and a union
member?
6 Can you pass an entire structure to functions? 2 2 3 1.4.1
7 Differentiate structure and union. 2 1 2 2.2.4
8 How static variable are define and initialized? 2 1 1 1.3.1
9 What is mean by storage class of variable? 2 1 2 1.3.1
10 Differentiate between local variable and global variable? 2 1 2 2.2.4
11 Differentiate structure and array. 2 1 2 2.2.4
12 What is static variable and what is its scope? 2 1 1 1.3.1
13 What is the use of external data type in c? 2 1 2 1.3.1
14 How are the data elements initialized in the case of 2 1 2 1.3.1
automatic type variable?
15 Where does global, static, and local, register stored? 2 1 1 1.4.1
16 What are register variables? State its advantages. 2 1 1 1.4.1
17 What are the similarities and difference between structure 5 1 2 2.2.4
and union.
18 Write a C language program to demonstrate the use of 5 1 2 1.3.1
union.
19 What is a structure? Explain the syntax of structure 5 1 2 1.3.1
declaration with example.
20 How an array can be included as a member of a structure? 5 1 3 1.3.1
21 Can one structure be the member of another structure? 5 1 3 1.3.1
Explain.
22 Define a structure for 10 students. Read the student mark 10 1 3 2.1.3
information such as student number, student name,
department and marks. Calculate the total and average
marks of all students passed in all subjects. Generate the
mark sheet for all the students.
23 What do you mean by the term storage class? How are 10 1 2 2.3.1
storage class specifiers helpful in refining the declaration
of variables?
24 Explain array of structures and structure within a structure 5 1 2 2.3.1
with examples.
25 Compare and contrast different storage classes with 10 1 2 2.3.1
examples.
UNIT 5
1 When fopen() is not able to open a file, it returns? 2 4 2 2.3.1
2 Which of the following true about FILE *fp 2 4 4 1.4.1
(A) FILE is a keyword in C for representing files and fp is
a variable of FILE type.
(B) FILE is a structure and fp is a pointer to the structure
of FILE type
(C) FILE is a stream
(D) FILE is a buffered stream
3 What does the function fopen(“filename”,”r”) returns? 2 4 2 1.4.1
4 How does an append mode differ from a write mode in file 2 4 2 2.2.4
operations?
5 Find the difference in the following statements: 2 4 2 2.2.4
rewind(fp);
fseek(fp,0L,0);
6 List various modes of opening a file in C program. 2 4 1 1.3.1
7 Give the difference between “r”, “w” and “a” mode of file 2 4 2 2.2.4
opening in C program.
8 What is the difference between w and w+ mode? 2 4 2 2.2.4
9 State the use of fopen() and fclose() function in C program. 2 4 1 1.3.1
10 Give the name of function which can be used to read a 2 2 2 1.3.1
single character from a file in C program.
11 Give the name of function which can be used to read a line 2 2 2 1.3.1
from a file in C program.
12 What is the use of fprintf() function in C program? 2 2 1 1.3.1
13 Give difference between fputc() and fputs() function. 2 2 2 2.2.4
14 State the use of fscanf() function in C program. 2 2 1 1.3.1
15 Give difference between fgets() and fgetc() function. 2 2 2 2.2.4
16 What is the use of rewind()? 2 2 1 1.3.1
17 Distinguish between the following functions with suitable 5 2 2 2.2.4
examples:
(a) getc and getchar
(b) printf and fprintf
(c) feof and ferror
18 How do you validate fopen( ) function? 5 2 2 1.4.1
19 With the help of a C program copy the contents of one file 5 4 3 2.1.2
to other.