WorksheetsQuiz 1 in CC 102
Total questions: 30
Worksheet time: 21mins
It is a value where the loop control variable will be compared to.
Loop Control Variable
Sentinel Value
Boolean Value
Loop update
It is a loop that never stops.
empty loop
infinite loop
for loop
while loop
It is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.
empty loop
infinite loop
for loop
while loop
In this type of loop, the initialization of the loop control variable is typed before the structure of the loop. The loop update on the other hand is placed inside the loop body.
empty loop
infinite loop
for loop
while loop
In this type of loop, the comparison happens at the end of the do while loop so the body of the loop is executed at least once even if the comparison expression evaluates to false,
do while loop
infinite loop
for loop
while loop
A loop that will not do anything.
do while loop
infinite loop
empty loop
while loop
It holds the value that will be compared to the limit of the loop.
do while loop
loop udate
sentinel value
loop control variable
Operator that subtracts 1 to its operand.
increment
assignment
decrement
comparison
Operator that adds 1 to its operand.
increment
assignment
decrement
comparison
A loop update using ________will continue to do the iteration until such time that the user of the program tells the program to stop the execution of the looping process.
increment
prompt
decrement
comparison
TRUE OR FALSE. The loop update using prompt is a process where there will be a question prompting the user if he wants to continue or stop executing the loop.
TRUE
FALSE
TRUE OR FALSE. In for loop, the initialization of the loop control variable is executed first, and only once.
TRUE
FALSE
TRUE OR FALSE. Increment and decrement are only for adding or subtracting 1 from the current value of the loop control variable
TRUE
FALSE
TRUE OR FALSE. If you are using prefix form, the increment or decrement will be done after evaluating the expression.
TRUE
FALSE
TRUE OR FALSE. If you are using postfix form, the increment or decrement will be done before the complete expression is evaluated.
TRUE
FALSE
TRUE OR FALSE. The sentinel value is set to decide if the loop will continue or stop based on the result of the comparison
TRUE
FALSE
TRUE OR FALSE. The result of the comparison is always a Boolean value, that is, true or a false.
TRUE
FALSE
TRUE OR FALSE. C++ provides a structure which will help you do repetitive tasks without typing them over and over again. It is called the repetition structure or looping.
TRUE
FALSE
TRUE OR FALSE. The loop control variable should last be initialized before it can be used in the program
TRUE
FALSE
TRUE OR FALSE. The loop update can change the value by incrementing or decrementing.
TRUE
FALSE
What is the updated value of a?
where
a=10;
a-=2;
a++;
(a)
What is the updated value of a?
where:
y=5;
a=2+y;
y-=2;
++a;
(a)
What is the updated value of y?
where:
y=3;
a=2+y;
y-=2;
++y;
(a)
What is the updated value of x?
where:
x=1;
y=1;
x=x+5;
x=x+y;
(a)
What is the updated value of y?
where:
x=3;
y=10;
x=x+5;
y=x+y;
(a)
What is the updated value of y?
where:
x=2;
y=5;
x=x+y;
y=x*y;
(a)
What is the updated value of y?
where:
x=25;
y=5;
x=x/y;
y=x*y;
(a)
What is the updated value of y?
where:
x=5;
y=x;
y= x * y;
(a)
What is the output of this code?
for(x=1;x<4;x++)
{
cout<<x;
}
(a)
What is the output of this code?
int a=5;
while(a>1)
{
cout<<a;
a--;
}
(a)
