Question 1
Which of the following is an entry-controlled loop in C?
while
do-while
for
if-else
Question 2
Which statement is used to skip the current iteration in a loop?
break
exit
Continue
goto
Question 3
What is the default value of a loop control variable in C?
0
1
Undefined
Compiler Dependent
Question 4
Which loop executes the body at least once, regardless of the condition?
for
while
do-while
if-else
Question 5
What is the keyword to exit prematurely from current loop only?
stop
return
exit
break
Question 6
What is the keyword to exit from a loop prematurely?
stop
return
exit
break
Question 7
Which of the following is TRUE about switch statements in C?
switch can evaluate expressions
case labels must be strings
default is mandatory
You cannot use break in switch
Question 8
Which part(s) of a for loop are optional in C?
Initialization
Condition
Increment
All of the above
Question 9
Can you place a function call inside the initialization part of the for loop?
for (printf("Init\n"); i < 3; i++) {
printf("Body\n");
No, only variable declarations are allowed
Only arithmetic expressions are allowed
Causes a runtime error
Yes, function calls are valid
Question 10
#include <stdio.h>
int main()
{
int i = 1024;
for (; i; i >>= 1)
printf("GeeksQuiz");
return 0;
}
How many times will GeeksQuiz be printed in the above program?
10
11
Infinite
The program will show compile-time error
There are 21 questions to complete.