computer MCQs
12th • Chapter 12
49 Questions TextBook
1
Which of the following is NOT a loop construct in C?
2
The repetition of a set of statements in a program is called a what?
3
In a while loop, the condition is checked at the ____ of the loop.
4
Which loop guarantees that the body is executed at least once?
5
A variable whose value controls the number of iterations is known as a ____.
6
In a while loop, where is the loop control variable typically initialized?
7
What character must be at the end of a do-while statement?
8
Which part of the for loop is mandatory and cannot be omitted?
A
Initialization expressionC
Increment/decrement expression 9
A loop inside the body of another loop is called a ____.
10
An end marker that follows the last item in a list of items is called a ____.
11
What is the term for the statements that are executed when the loop's condition is true?
12
The 'goto' statement performs what kind of transfer of control?
13
In type casting, a variable of one type behaves as another type ____.
14
How many expressions are there in a standard for loop statement, separated by semicolons?
15
Which operator was used in Example 2 to combine the sub-conditions for input validation?
16
An increase in the level of nesting generally increases the ____ of the loop.
17
In a 'for' loop, the initialization expression is executed how many times?
18
A label is meaningful only to which statement?
19
What could be a potential issue if the 'if (total_students > 0)' check is omitted in Example 4?
D
Runtime error (division by zero) 20
Using '(float)total_students' is an example of what?
21
In a 'for' loop like 'for(;;)', what kind of loop is created?
B
A loop that does not run 22
In Example 1, what is the purpose of 'count = count + 1;'?
A
To initialize the counterD
To increment the loop control variable 23
The do-while loop checks the test condition after executing the ____.
24
Which expression in a 'for' loop is optional?
B
Initialization and increment/decrement 25
In Example 3, which loop acts as the outer loop?
26
What is the general form of a sentinel-controlled loop?
B
Get data, then process in a loopC
Get all data first, then loop 27
The 'goto' statement requires a ____ to transfer control to.
28
The phenomenon where the fractional part is truncated in integer division is avoided by using?
29
If the condition in a while loop is false initially, the loop body executes how many times?
30
In the syntax 'while (condition)', the parentheses are ____.
D
used for initialization 31
The compound statement enclosed in braces in a loop is called the ____.
32
Which loop is preferred by most programmers because of its flexibility?
33
In a nested loop, the ____ loop completes all its iterations for each single iteration of the ____ loop.
34
A sentinel value must be a value that could ____ occur as normal data.
35
The process of converting one data type into another is known as?
36
What is the third type of program control structure mentioned, besides sequence and selection?
37
In the code 'for (count = 1; count <= 10; count++)', what is 'count <= 10'?
38
When does a 'for' loop terminate?
A
When the initialization failsB
When the condition becomes falseC
When the increment expression is zeroD
After 100 iterations by default 39
What happens immediately after the body of a 'while' loop is executed?
B
Control jumps back to the condition checkC
The loop control variable is re-initializedD
The next statement outside the loop is executed 40
In a 'do-while' loop, if the condition is false on the first check, how many times has the body run?
41
What is the output of the first iteration of the loop in Example 1?
42
Which header file is needed for the 'sqrt()' function used in Example 5?
43
Omitting the semicolon at the end of a 'do-while' loop will cause a ____.
44
In a 'for' loop, if the increment/decrement part is omitted, where must the loop control variable be updated?
B
In the initialization part 45
Which statement allows repeating a set of statements up to a fixed number of times or until a criterion is met?
46
The keyword 'do' lets the program flow move into the body of the loop without checking any ____.
47
In Example 3, the variable 'outer' is initialized to what value in the first iteration?
48
A negative number was chosen as a sentinel value in Example 4 because ____.
C
a student cannot have negative marksD
it stops the program faster 49
The 'label' in a 'goto' statement must be in the same ____.