WorksheetsDAY 2 - C& C++ Assessment _11th & 12th June 24
Total questions: 10
Worksheet time: 5mins
Which of the following operators has the highest precedence in C?
+ (Addition)
* (Multiplication)
&& (Logical AND)
= (Assignment)
will be the output of the following C code snippet?
30
25
20
15
Which of the following is a bitwise operator in C?
&&
||
&
==
What will be the output of the following C code snippet?
Positive
Negative
Compilation error
No output
Which of the following loops will execute at least once, regardless of the condition?
for loop
while loop
do-while loop
Infinite loop
What is the output of the following C code snippet?
0 1 2 3
0 1 2
1 2 3
1 2
Which of the following statements is true about the switch statement in C?
The switch statement can evaluate only integer expressions.
The switch statement can evaluate any type of expression.
The switch statement is limited to two cases.
The switch statement must always include a default case.
What is the output of the following C code snippet?
7
12
34
Compilation error
What is the base case in the following recursive function to calculate the factorial of a number?
if (n == 1)
if (n == 0)
if (n < 0)
No base case
Which of the following statements is true about functions in C?
Functions cannot return a value.
Functions can have default arguments.
Functions can call themselves.
Functions cannot take parameters.
