Model Question Bank
Model Question Bank
11. What is the primary difference between a while loop and a do-while loop?
a) while checks the condition after execution.
b) do-while checks the condition after execution.
c) Both execute at least once.
d) None of the above.
Answer: b) do-while checks the condition after execution.
Copy code
int i = 0;
while(i < 5) {
i++;
a) 4
b) 5
c) 6
d) Infinite
Answer: b) 5
Arrays
20. How do you access the element in the second row and third column of a 2D array arr?
a) arr[3][2]
b) arr[1][2]
c) arr[2][3]
d) arr[2][1]
Answer: b) arr[1][2]
Overview of C
Q2. A)What is a flowchart, and why is it important in programming? Explain with the help of
example in diagram form.
(3 Marks)
b) Discuss the historical development of the C language. Explain its key features and importance in
the development of modern programming languages and systems. (3
Marks)
c) List and describe the different types of tokens in C. Write a code snippet demonstrating the use of
keywords, identifiers, constants, and special symbols in a simple program.
Q3 a)What is the significance of declaring variables as constant and volatile in C? Provide examples
to illustrate their usage and explain the scenarios where each is necessary. (3 Marks)
b)Explain the difference between basic and derived data types in C. Compare and contrast the static
and extern storage classes with examples. (3
Marks)
c) List and describe the different types of tokens in C. Write a code snippet demonstrating the use of
keywords, identifiers, constants, and special symbols in a simple program. (6 Marks)
c. List and explain any four Arithmetic Operators in C. Include examples to demonstrate
their usage. (6 Marks)
OR
Q5. A)What are Logical Operators? Discuss their role in decision-making with
Examples (3 Marks)
Q6. A)What is the purpose of the if-else statement in C?Write a simple program snippet to
demonstrate its usage.
(6 Marks)
C) Explain the switch statement in C.Write a program snippet to show how it is used for
decision-making (3
Marks)
.
OR
Q7)A) What are the roles of the break and continue statements in loops?Explain with examples.
(3 Marks)
B) Write a program to find the largest of three numbers using an if-else statement.
Explain how the logic works. (3 Marks)
C)Explain the structure of the for loop in C.Write a program to calculate the factorial of a number
using a for loop. (6
Marks)
Q8.A) Write a program in C to generate the following pattern using a 2D array. The size of the pattern
(number of rows) should be input by the user. (6 Marks)
Example:-
INPUT:
Enter number of rows:5
Enter number of coloums:5
OUTPUT:
1
12
123
1234
12345
B) Write a program to concatenate two strings using character arrays. (3 Marks)
B) Write a program to calculate the sum of all elements in a one-dimensional array of size 10.Include
both array declaration and initialization. (3 Marks)
C) What are the categories of user-defined functions in C? Explain any two . (3 Marks)
Q12. A)What is a flowchart, and why is it important in programming? Explain with the help of
example in diagram form.
(3 Marks)
b) Discuss the historical development of the C language. Explain its key features and importance in
the development of modern programming languages and systems. (3
Marks)
c) List and describe the different types of tokens in C. Write a code snippet demonstrating the use of
keywords, identifiers, constants, and special symbols in a simple program. (6 Marks)
OR
Q13 a)What is the significance of declaring variables as constant and volatile in C? Provide examples
to illustrate their usage and explain the scenarios where each is necessary. (3 Marks)
b)Explain the difference between basic and derived data types in C. Compare and contrast the static
and extern storage classes with examples. (3
Marks)
c) List and describe the different types of tokens in C. Write a code snippet demonstrating the use of
keywords, identifiers, constants, and special symbols in a simple program. (6 Marks)
c. List and explain any four Arithmetic Operators in C. Include examples to demonstrate
their usage. (6 Marks)
OR
Q15. A)What are Logical Operators? Discuss their role in decision-making with
Examples (3 Marks)
Q16. A)What is the purpose of the if-else statement in C?Write a simple program snippet to
demonstrate its usage.
(6 Marks)
C) Explain the switch statement in C.Write a program snippet to show how it is used for
decision-making (3
Marks)
.
OR
Q17)A) What are the roles of the break and continue statements in loops?Explain with examples.
(3 Marks)
B) Write a program to find the largest of three numbers using an if-else statement.
Explain how the logic works. (3 Marks)
C)Explain the structure of the for loop in C.Write a program to calculate the factorial of a number
using a for loop. (6
Marks)
Q18.A) Write a program in C to generate the following pattern using a 2D array. The size of the
pattern (number of rows) should be input by the user. (6
Marks)
Example:-
INPUT:
Enter number of rows:5
Enter number of coloums:5
OUTPUT:
1
12
123
1234
12345
B) Write a program to concatenate two strings using character arrays. (3 Marks)
B) Write a program to calculate the sum of all elements in a one-dimensional array of size 10.Include
both array declaration and initialization. (3 Marks)
C) What are the categories of user-defined functions in C? Explain any two . (3 Marks)