Dhanasar V
How many times will the following loop iterate? Set k = 1 While k < = 5 Display k End While A) Infinite B) No iterations C) Two D) Three E) Five
A) Infinite
Which structure causes a statement or set of statements to execute repeatedly? A) Repetition B) Sequence C) Start Over D) Decision E) None of the above
A) Repetition
To ________ a variable means to decrease its value. A) Negate B) Decrement C) Increment D) Reference E) Initialize
B) Decrement
Which loop is specifically designed to initialize, test, and increment a counter variable? A) Do-While B) For C) Do-Until D) While E) None of the above
B) For
Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration? A) Do-While B) For C) Do-Until D) While E) None of the above
B) For
How many times will the following loop iterate? Set k = 1 Do Display k Set k = k + 1 Until k > 1 A) Three B) One C) Infinite D) Two E) No iterations
B) One
The ________ represents a special value that marks the end of a list of values. A) Stop B) Sentinel C) End D) Any of the above E) None of the above
B) Sentinel
The statements that appear between the While and the End While clauses are called the ________. A) Loop B) Statements C) Body of the loop D) Loop statements E) While statements
C) Body of the loop
What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements? A) Do-while B) While C) Condition-controlled D) Count-controlled E) Do-until
C) Condition-controlled
How many times will the following loop iterate? For j = 1 To 5 Step 2 Display j End For A) Four B) Five C) Three D) No iterations E) Infinite
C) Three
The following is an example of what type of loop? For k = 7 To maxValue A) While B) Condition-controlled C) Do-until D) Count-controlled E) Do-while
D) Count-controlled
Which loop repeats a statement or set of statements as long as the Boolean expression is false? A) While B) Do-While C) For D) Do-Until E) None of the above
D) Do-Until
Which of these are posttest loops? A) Do-While and For B) While and Do-Until C) While and Do-While D) Do-While and Do-Until E) Do-Until and For
D) Do-While and Do-Until
A loop that accumulates a total as it reads each number from a series is often said to keep a what? A) Maximum value B) Accumulation C) Average D) Running total E) None of the above
D) Running total
The amount by which the counter variable is incremented in a For loop is known as what? A) Additive Index B) Counter differential C) Incremental value D) Step amount E) None of the above
D) Step amount
Which pair of loops causes a statement or set of statements to repeat as long as a condition is true? A) Do-While and For B) Do-Until and For C) Do-While and Do-Until D) While and Do-While E) While and Do-Until
D) While and Do-While
26) How many times will the following loop iterate? Set k = 1 While k > 5 Display k End While A) Five B) One C) Infinite D) Two E) No iterations
E) No iterations
In a count-controlled loop, the counter performs ________ action(s). A) Two B) One C) Five D) Four E) Three
E) Three
True/False: A posttest loop does not perform any iteration if the Boolean expression is false to begin with.
False
True/False: In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.
False
True/False: In the For statement, you can only use positive integers as step values
False
True/False: The While loop gets its name from the way it works: While a condition is false, do some task.
False
True/False: The While loop will never execute if its condition is true to start with.
False
True/False: A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.
True
True/False: A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
True
True/False: Any loop that can be written as a Do-While loop can also be written as a While loop.
True
True/False: Modules can be called from statements in the body of any loop.
True
True/False: The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body.
True
True/False: The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.
True
True/False: The conditions that control a loop repetition are Boolean expressions.
True