Assesment 4
How many times would the following loop iterate? Set k = 1 Do display k set k = k + 1 Until k > 2 2 Infinite 3 1
2
How many times would the following loop iterate? For j = 1 to 5 Step 2 Display j End For 4 5 0 3
3
Which type of loop repeats a statement or set of statements as long as the Boolean expression is false? Do-While For Do-Until While
Do-Until
Select all that apply. Which of the following are posttest loops? Do-While While Do-Until For
Do-While, Do-Until
In a For loop the programmer must know the exact number of iterations the loop must perform before writing the code. TRUE/FALSE
False
The test condition in a While loop must always be an integer value. TRUE/FALSE
False
You can only use positive integers as step values in a For statement. TRUE/FALSE
False
Which type of loop is specifically designed to initialize, test, and increment or decrement a counter variable? For Do-While Do-Until While
For
How many times would the following loop iterate? Set k = 1 While k <= 5 Display k End While Infinite 0 5 4
Infinite
If an expression is False, the _________ operator will return True. All are unary operators NOT AND OR
NOT
A(n) _______ represents a special value that marks the end of a list of values. Step End For Counter Sentinel
Sentinel
A While loop repeats infinitely when there is no statement inside the loop body that will make the test condition false. TRUE/FALSE
True
A condition-controlled loop can be used to iterate the body of the loop a specific number of times. TRUE/FALSE
True
Modules can be called from statements in the body of any loop. TRUE/FALSE
True
The Do-While loop is a posttest loop. TRUE/FALSE
True
The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body. TRUE/FALSE
True
Which type of loop uses a Boolean expression to control the number of times a loop repeats? condition-controlled For count-controlled accumulator
condition-controlled
Statements that appear between While and End While statements are known as the _________. While statements loop body iteration values loop
loop body
Which of the following is the structure that causes a statement or set of statements to execute repeatedly? decision selection repetition sequence
repetition
The amount by which the counter variable is incremented or decremented in a For loop is known as the ________. accumulator incremental value step amount counter index
step amount