goto transfers program control to a labeled location, though it's discouraged for code readability.
Q.62Easy
Which statement is used to skip remaining iterations and move to next iteration?
Answer: B
continue is the C keyword that jumps to the next iteration of the loop.
Q.63Easy
In C, which control flow statement is used to terminate a loop prematurely?
Answer: A
The 'break' statement is used to exit or terminate a loop immediately. 'continue' skips the current iteration, 'exit' terminates the entire program.
Q.64Easy
What is the primary difference between a while loop and a do-while loop?
Answer: A
A do-while loop executes the body at least once before checking the condition. A while loop checks the condition first, so it may not execute at all.
Q.65Easy
In a nested loop structure, which statement will skip only the inner loop's current iteration?
Answer: B
The 'continue' statement skips the remaining statements of the current iteration and moves to the next iteration. In nested loops, it affects only the innermost loop.
Advertisement
Q.66Easy
In the expression (x > 5) ? (y = 10) : (y = 20), what does y equal if x is 3?
Answer: B
The ternary operator evaluates the condition (x > 5). Since 3 is not greater than 5, the expression evaluates to false, and the false part executes, setting y to 20.
Q.67Easy
Which control flow structure allows execution of code only if a certain condition is met?
Answer: B
The if statement executes a block of code conditionally. Loops repeat code, and switch cases are for multi-way branching based on a single expression.
Q.68Easy
In a switch statement, which keyword provides a default case if no cases match?
Answer: B
The 'default' keyword in a switch statement provides code to execute when no case values match the switch expression.
Q.69Easy
What is the correct syntax for a for loop that iterates from 0 to 9?
Answer: B
for(int i=0; i<10; i++) correctly iterates from 0 to 9 (10 iterations total). Using i<=10 would iterate 11 times, and starting from 1 would skip 0.
Q.70Easy
Which control structure allows checking multiple conditions in sequence using else-if?
Answer: C
The if-else-if chain allows testing multiple different conditions sequentially. switch is used for a single expression with multiple values.
Q.71Easy
Which keyword is used to exit a loop prematurely in C?
Answer: B
The 'break' statement is used to exit or terminate a loop prematurely. 'exit' terminates the entire program, while 'return' exits functions.
Q.72Easy
Analyze the code: What happens when condition in if statement is false?
if(0) { statements; } else { statements; }
Answer: B
When the if condition is false (0 is false in C), the else block executes. This is basic if-else control flow.
Q.73Easy
In the ternary operator (? :), what happens if the condition is false?
Answer: B
The ternary operator syntax is: condition ? true_expr : false_expr. If condition is false, false_expr is evaluated.
Q.74Easy
What will be the result?
for(int i = 1; i <= 4; i++) {
if(i == 3) break;
printf("%d ", i);
}
Answer: B
When i=3, break executes and exits the loop immediately. Only i=1 and i=2 are printed. Output: 1 2
Q.75Easy
What is printed by this code?
int x = 1, y = 2;
if(x > y) printf("A");
else if(x < y) printf("B");
else printf("C");
Answer: B
Since x=1 and y=2, x>y is false, but x<y is true, so 'B' is printed. The else if condition matches.
Q.76Easy
Which statement best describes the difference between break and continue?
Answer: A
break completely exits/terminates the loop. continue skips the rest of current iteration and jumps to the next iteration.
Q.77Easy
What value does the ternary operator return?
int result = (5 > 3) ? 10 : 20;
Answer: C
The condition (5 > 3) is true, so the ternary operator evaluates and returns the true expression value: 10.
Q.78Easy
Which of the following control flow statements will cause a compilation error in C?
Answer: A
break and continue statements can only be used within loops or switch statements. Using break outside these constructs results in a compilation error.
Q.79Easy
What is the primary difference between while and do-while loops?
Answer: B
do-while loop checks the condition after executing the loop body, ensuring at least one execution. while loop checks before executing.
Q.80Easy
In a switch statement, if a case label is missing the break statement, what occurs?
Answer: C
Missing break causes fall-through behavior where execution continues to the next case label until a break or end of switch is encountered.