Question
QUESTION 1 Which are the three parts of the for statement? initialization, condition and update begin, end, body start, update, increment initialization, increment and body
QUESTION 1
-
Which are the three parts of the for statement?
initialization, condition and update
begin, end, body
start, update, increment
initialization, increment and body
1 points
QUESTION 2
-
In a while loop, the variable compared in the condition is usually initialized
after the loop
inside the loop at the bottom
inside the loop at the top
before the loop
1 points
QUESTION 3
-
Spaghetti code occurs when
when there is no way to exit a loop
when you place one loop inside another
when there is more that one way to exit a loop
you write your programs in Italy
1 points
QUESTION 4
-
Select all of the following which are loops in C.
infinite loop
do-while loop
if loop
do until loop
for loop
while loop
1 points
QUESTION 5
-
The purpose of a flag variable is to
ensure that a loop has one entry point and one exit point
indicate when something is wrong in the code
branch out of a loop before the normal end point
keep the loop going forever
1 points
QUESTION 6
-
In a do-while loop that is reading data until a special terminating value is read you must include _____ to avoid processing the terminating value.
a statement to multiply the terminating value by -1.
an if that encloses the code for processing the input values
another loop that encloses the code for processing the input values
a statement to increment the terminating value.
1 points
QUESTION 7
-
A nested loop is one
which can only count in the forward direction
which has multiple statements in its body
exists entirely within the body of another loop
which exists outside of the main function
1 points
QUESTION 8
-
Which type of loop must be executed at least once?
do-until loop
for loop
do-while loop
while loop
1 points
QUESTION 9
-
How can you make a for loop count downwards rather than upwards?
it cannot be done, you need a while loop
set the reverse option
set the initial value higher than the ending value and decrement it each time through the loop
multiply the loop control variable by -1 before using it
1 points
QUESTION 10
-
When the paths in a loop cross one another, you get
nested loops
faster code
an error
spaghetti code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started