CMIS Quiz 4
You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudocode. In the following pseudocode, what will be the value of sum after the code is run? Declarations num count = 0 num sum = 0 while count < 3 for X = 1 to 2 step 1 sum = sum + X endfor count = count + 1 endwhile 3 6 9 12
9
Many programs are not run at the command prompt in a text environment, but are run using a ____, which allows users to interact with a program in a graphical environment. UML GOOY GUM GUI
GUI
Which of the following is NOT a mistake that programmers commonly make with loops? Neglecting to initialize the loop control variable Using the wrong comparison with the loop control variable Neglecting to alter the loop control variable Including statements outside the loop that belong inside the loop
Including statements outside the loop that belong inside the loop
You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudocode. The following pseudocode is not working properly. The message should display 10 times. This is not working because the programmer made which common loop mistake? for count = 1 to 10 output "Hello" endfor Neglecting to initialize the loop control variable Neglecting to alter the loop control variable Using the wrong comparison with the loop control variable Including statements inside the loop that belong outside the loop
Neglecting to alter the loop control variable
You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudocode. The following pseudocode is not working properly. The message should display five times. This is not working because the programmer made which common loop mistake? Declarations num count string message = "OK" while count < 5 output message count = count + 1 endwhile Neglecting to initialize the loop control variable Neglecting to alter the loop control variable Using the wrong comparison with the loop control variable Including statements inside the loop that belong outside the loop
Neglecting to initialize the loop control variable
A(n) ____ is any numeric variable you use to count the number of times an event has occurred. accumulator holder scratchpad counter
counter
Reports that include some output for every input record are ____ reports. summary detail executive running total
detail
With a ____ loop, the loop body executes once before the loop-controlling condition is tested. do-while while do for
do-while
Commonly, you control a loop's repetitions by using either a counter or a ____ value. flag keystone control sentinel
sentinel
Often, the value of a loop control variable is not altered by arithmetic, but instead is altered by ____. infinite loops machine input user input the loop
user input
Loops are frequently used to ____ data; that is, to make sure values fall within an acceptable or reasonable range. validate enter add manipulate
validate
As long as a Boolean expression remains true, a ____ loop's body executes. do go while begin
while
The ____ statement uses a loop control variable and provides you with three actions automatically in one compact statement: initialization, evaluation and incrementation. do while for count
for
When you write a loop, you must control the number of repetitions it performs; if you do not, you run the risk of creating a(n) ____ loop. final infinite unbreakable permanent
infinite
When one loop is nested within another, the loop that is contained is the ____ loop. outer inner controlling bounding
inner
A ____ is the structure that repeats actions while some condition continues. decision loop branch block
loop
When you use a ____ within a computer program, you can write one set of instructions that operates on multiple, separate sets of data. counter variable loop sentinel
loop
Program logic gets more complicated when you must use loops within loops, creating ____ loops. interwoven stacked nested connected
nested
When one loop is nested within another, the containing loop is the ____ loop. inner controlling bounding outer
outer
Every high-level computer programming language contains a ____ statement that you can use to code any loop, including both indefinite and definite loops. do while for count
while