0% found this document useful (0 votes)
2 views

Model Question Bank

The document is a comprehensive question bank covering various topics in C programming, including operators, decision making, loops, arrays, program design tools, and user-defined functions. It contains multiple-choice questions, short answer questions, and programming tasks aimed at testing knowledge and skills in C. Additionally, it discusses the significance of flowcharts, the historical development of C, and the importance of constants and variable types.

Uploaded by

rajankit84346
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Model Question Bank

The document is a comprehensive question bank covering various topics in C programming, including operators, decision making, loops, arrays, program design tools, and user-defined functions. It contains multiple-choice questions, short answer questions, and programming tasks aimed at testing knowledge and skills in C. Additionally, it discusses the significance of flowcharts, the historical development of C, and the importance of constants and variable types.

Uploaded by

rajankit84346
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

MODEL QUESTION BANK

1.Which of the following is a relational operator in C?


a) +
b) =
c) >=
d) *
Answer: c) >=

1. What is the result of the expression 5 + 3 * 2 in C?


a) 16
b) 11
c) 10
d) 13
Answer: b) 11

2. The && operator in C is used for:


a) Assignment
b) Logical AND
c) Bitwise AND
d) Increment
Answer: b) Logical AND

3. Which operator is used to test if two values are equal?


a) =
b) ==
c) !=
d) >=
Answer: b) ==

4. What is the purpose of the ++ operator in C?


a) It decrements the value by 1.
b) It increments the value by 1.
c) It compares two values.
d) It assigns a value.
Answer: b) It increments the value by 1.

Decision Making and Branching

6. Which statement is used to check multiple conditions in C?


a) if
b) else-if
c) switch
d) Both b and c
Answer: d) Both b and c

7. The goto statement is primarily used for:


a) Breaking out of a loop
b) Unconditional jumps
c) Logical comparisons
d) Increment operations
Answer: b) Unconditional jumps

8. Which of the following can be used for multi-way branching?


a) if-else
b) else-if
c) switch
d) All of the above
Answer: d) All of the above

9. In a switch statement, what is the default case used for?


a) Executing the first case
b) Executing when no cases match
c) Breaking out of the loop
d) None of the above
Answer: b) Executing when no cases match

10. Which statement is used to exit a loop prematurely in C?


a) continue
b) break
c) goto
d) return
Answer: b) break

Decision Making and Looping

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.

12. Which of the following loops is entry-controlled?


a) while
b) do-while
c) Both a and b
d) None of the above
Answer: a) while

13. What does the continue statement do in a loop?


a) Terminates the loop.
b) Skips the current iteration and continues with the next.
c) Exits the loop and moves to the next code.
d) None of the above.
Answer: b) Skips the current iteration and continues with the next.

14. How many times will the following loop execute?


css

Copy code

int i = 0;

while(i < 5) {

i++;

a) 4
b) 5
c) 6
d) Infinite
Answer: b) 5

15. What is the correct syntax for a for loop in C?


a) for(initialization; condition; increment/decrement)
b) for(condition; initialization; increment/decrement)
c) for(increment/decrement; condition; initialization)
d) for(initialization, condition, increment/decrement)
Answer: a) for(initialization; condition; increment/decrement)

Arrays

16. How is a one-dimensional array declared in C?


a) array[10];
b) int array[10];
c) int array[] = 10;
d) int array[10] = {};
Answer: b) int array[10];

17. What is the index of the first element in a C array?


a) 1
b) -1
c) 0
d) None of the above
Answer: c) 0

18. How can you initialize all elements of an array to 0?


a) int arr[5] = {0};
b) int arr[5] = 0;
c) int arr[5]; arr[0] = 0;
d) None of the above
Answer: a) int arr[5] = {0};

19. Which of the following is true for a two-dimensional array?


a) It requires only one index.
b) It is a collection of arrays.
c) It can store multiple types of data.
d) None of the above.
Answer: b) It is a collection of 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]

Program Design Tools

21. What is the primary purpose of a flowchart?


a) To write detailed code.
b) To document variables.
c) To represent algorithms visually.
d) None of the above.
Answer: c) To represent algorithms visually.

22. Which symbol represents a decision in a flowchart?


a) Oval
b) Rectangle
c) Diamond
d) Circle
Answer: c) Diamond

23. An algorithm is:


a) A programming language.
b) A step-by-step problem-solving process.
c) A hardware component.
d) None of the above.
Answer: b) A step-by-step problem-solving process.

Overview of C

24. Who developed the C programming language?


a) Dennis Ritchie
b) Bjarne Stroustrup
c) James Gosling
d) Guido van Rossum
Answer: a) Dennis Ritchie

25. Which of the following is a valid variable name in C?


a) 1variable
b) variable1
c) variable-1
d) variable 1
Answer: b) variable1
26. What is the size of the int data type in C (on most systems)?
a) 2 bytes
b) 4 bytes
c) 8 bytes
d) 1 byte
Answer: b) 4 bytes

27. A symbolic constant in C is defined using:


a) int
b) #define
c) const
d) Both b and c
Answer: d) Both b and c

28. Which of the following is not a storage class in C?


a) auto
b) static
c) register
d) external
Answer: d) external

29. What keyword is used to declare a volatile variable in C?


a) register
b) volatile
c) static
d) const
Answer: b) volatile

30. Which of the following is a keyword in C?


a) define
b) goto
c) variable
d) print
Answer: b) goto

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)

Q4) a.Define Relational Operators.Provide examples to illustrate their use in C. (3 Marks)

b. What is the difference between Pre-Increment and Post-Increment Operators?


Explain with examples. (3 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)

B) Explain the concept of Operator Precedence and Associativity in C.


Provide an example to show how they affect expression evaluation.. (3 Marks)

C)What is a Conditional Operator in C?Write a program snippet to demonstrate its usage.(6Marks)

Q6. A)What is the purpose of the if-else statement in C?Write a simple program snippet to
demonstrate its usage.
(6 Marks)

B) Differentiate between the while and do-while loops.Explain with an example.. (3


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)

C).Explain any four function of string handling with syntax . (3 Marks)


OR
Q9.A)Write a program to find the largest element in a two-dimensional array of integers.
Explain how nested loops are used to traverse the array. (6 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)Write a C Program to Count the Number of Vowels in a String. (3 Marks)

Q10)A)What is the purpose of user-defined functions in C?Explain with an example of a simple


function.
(3 Marks)
B)What is a structure in C?Write the syntax for declaring a structure type and a structure
variable. (3 Marks)

C) Write a program in C to calculate the factorial of a number using recursion. (6 Marks)


OR
Q11)A)Write a program to create a structure for a student that includes name, roll number, and marks
as members. (6 Marks)

B)Differentiate between functions with arguments and no arguments in C.


Provide examples for each. (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)

Q14) a.Define Relational Operators.Provide examples to illustrate their use in C. (3 Marks)

b. What is the difference between Pre-Increment and Post-Increment Operators?


Explain with examples. (3 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)

B) Explain the concept of Operator Precedence and Associativity in C.


Provide an example to show how they affect expression evaluation.. (3 Marks)

C)What is a Conditional Operator in C?Write a program snippet to demonstrate its usage.(6Marks)

Q16. A)What is the purpose of the if-else statement in C?Write a simple program snippet to
demonstrate its usage.
(6 Marks)

B) Differentiate between the while and do-while loops.Explain with an example.. (3


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)

C).Explain any four function of string handling with syntax . (3 Marks)


OR
Q19.A)Write a program to find the largest element in a two-dimensional array of integers.
Explain how nested loops are used to traverse the array. (6 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)Write a C Program to Count the Number of Vowels in a String. (3 Marks)

Q20)A)What is the purpose of user-defined functions in C?Explain with an example of a simple


function.
(3 Marks)
B)What is a structure in C?Write the syntax for declaring a structure type and a structure
variable. (3 Marks)

C) Write a program in C to calculate the factorial of a number using recursion. (6 Marks)


OR
Q11)A)Write a program to create a structure for a student that includes name, roll number, and marks
as members. (6 Marks)

B)Differentiate between functions with arguments and no arguments in C.


Provide examples for each. (3 Marks)

C) What are the categories of user-defined functions in C? Explain any two . (3 Marks)

You might also like