The document contains multiple choice questions (MCQs) on the C programming language, covering topics such as fundamentals, operators, control structures, and functions. Each question is followed by four options and the correct answer is provided. The questions assess knowledge of identifiers, keywords, data types, operators, control flow, function definitions, and recursion in C.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
180 views3 pages
C LANGUAGE Multiple Choice Questions
The document contains multiple choice questions (MCQs) on the C programming language, covering topics such as fundamentals, operators, control structures, and functions. Each question is followed by four options and the correct answer is provided. The questions assess knowledge of identifiers, keywords, data types, operators, control flow, function definitions, and recursion in C.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Multiple Choice Questions (MCQs) on C Language
1. C Fundamentals:
1. Which of the following is a valid identifier in C?
o A) 123var o B) _myVar o C) if o D) 1_variable o Answer: B) _myVar 2. Which of the following is not a keyword in C? o A) switch o B) function o C) int o D) void o Answer: B) function 3. Which data type can store only two values in C? o A) int o B) float o C) char o D) _Bool o Answer: D) _Bool 4. What is the size of an int data type in C? o A) 1 byte o B) 2 bytes o C) 4 bytes o D) 8 bytes o Answer: C) 4 bytes 5. Which of the following is not a valid constant in C? o A) 'A' o B) 12.34 o C) 012 o D) "Hello o Answer: D) "Hello (incomplete string)
2. Operators and Expressions:
6. Which operator is used for assigning a value to a variable in C?
o A) == o B) = o C) ++ o D) && o Answer: B) = 7. Which of the following is a unary operator in C? o A) + o B) ++ o C) && o D) == o Answer: B) ++ 8. What will be the output of the following expression: 5 + 10 / 2? o A) 7.5 o B) 10 o C) 15 o D) 10.5 o Answer: B) 10 (due to operator precedence) 9. Which operator has the highest precedence in C? o A) * o B) + o C) && o D) () o Answer: D) () 10. Which operator is used to compare two values in C? o A) == o B) = o C) && o D) || o Answer: A) ==
3. Control Structures:
11. Which of the following control structure allows multiple conditions?
o A) if-else o B) switch o C) while o D) for o Answer: B) switch 12. In a 'for' loop, how many times will the following loop run: for (i = 0; i < 5; i++)? o A) 5 o B) 6 o C) 4 o D) 0 o Answer: A) 5 13. Which control structure will stop the loop and transfer control outside the loop? o A) break o B) continue o C) goto o D) return o Answer: A) break 14. Which loop checks the condition at the end of the loop? o A) while o B) for o C) do-while o D) None o Answer: C) do-while 15. What does the keyword continue do in a loop? o A) Exits the loop o B) Skips the remaining statements and moves to the next iteration o C) Restarts the loop o D) Jumps to a specified location o Answer: B) Skips the remaining statements and moves to the next iteration
4. Functions:
16. Which of the following is the correct way to define a function in C?
o A) function_name(parameters); o B) void function_name(parameters) { /body/ } o C) function_name{parameters}; o D) void (function_name(parameters)) { /body/ } o Answer: B) void function_name(parameters) { /body/ } 17. What is the correct way to call a function in C? o A) call function_name(); o B) function_name(); o C) function_name; o D) invoke function_name(); o Answer: B) function_name(); 18. Which of the following is a correct function prototype? o A) int function(int, float); o B) function(int, float); o C) int function(float, int); o D) void function; o Answer: A) int function(int, float); 19. Which of the following supports recursion in C? o A) A function calling itself o B) A function calling another function o C) Using if-else structure o D) Using for loop o Answer: A) A function calling itself 20. What is the return type of a function that does not return any value in C? o A) int o B) void o C) char o D) float o Answer: B) void