Filters
Question type

Study Flashcards

A loop that continues to execute endlessly is called a(n) ____ loop.


A) end
B) unhinged
C) infinite
D) definite

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

The control variable in a flag-controlled while loop is a bool variable.

A) True
B) False

Correct Answer

verifed

verified

What is the output of the following C++ code? What is the output of the following C++ code?   A)  24 0 B)  24 1 C)  25 0 D)  25 1


A) 24 0
B) 24 1
C) 25 0
D) 25 1

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

A loop ____________________ is a set of statements that remains true each time the loop body is executed.

Correct Answer

verifed

verified

invariant

Consider the following code. This code is an example of a(n) ____ while loop. Consider the following code. This code is an example of a(n)  ____ while loop.   A)  flag-controlled B)  counter-controlled C)  EOF-controlled D)  sentinel-controlled


A) flag-controlled
B) counter-controlled
C) EOF-controlled
D) sentinel-controlled

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

To generate a random number, you can use the function rand of the header file ____________________.

Correct Answer

verifed

verified

Which executes first in a do...while loop?


A) the statement
B) loop condition
C) the expression
D) update statement

E) None of the above
F) A) and C)

Correct Answer

verifed

verified

A

The number of iterations of a counter-controlled loop is known in advance.

A) True
B) False

Correct Answer

verifed

verified

Which of the following loops does not have an entry condition?


A) EOF-controlled while loop
B) sentinel-controlled while loop
C) do...while loop
D) for loop

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

In a while and for loop, the loop condition is evaluated before executing the body of the loop.Therefore, while and for loops are called ____________________ loops.

Correct Answer

verifed

verified

In ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s) .


A) looping
B) branching
C) selection
D) sequence

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

Assume that all variables are properly declared.The following for loop executes 20 times. for (i = 0; i <= 20; i++) cout << i;

A) True
B) False

Correct Answer

verifed

verified

Consider the following code.(Assume that all variables are properly declared.) This code is an example of a(n) ____ while loop. Consider the following code.(Assume that all variables are properly declared.)  This code is an example of a(n)  ____ while loop.   A)  sentinel-controlled B)  flag-controlled C)  EOF-controlled D)  counter-controlled


A) sentinel-controlled
B) flag-controlled
C) EOF-controlled
D) counter-controlled

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

The following while loop terminates when j > 20. j = 0; while (j < 20) j++;

A) True
B) False

Correct Answer

verifed

verified

In a counter-controlled while loop, the loop control variable must be initialized before the loop.

A) True
B) False

Correct Answer

verifed

verified

The control statements in the for loop include the initial statement, loop condition, and update statement.

A) True
B) False

Correct Answer

verifed

verified

What is the output of the following C++ code? What is the output of the following C++ code?   A)  0 B)  6 C)  8 D)  10


A) 0
B) 6
C) 8
D) 10

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

What executes immediately after a continue statement in a while and do-while loop?


A) loop-continue test
B) update statement
C) loop condition
D) the body of the loop

E) A) and D)
F) A) and B)

Correct Answer

verifed

verified

What is the next Fibonacci number in the following sequence? 1, 1, 2, 3, 5, 8, 13, 21, ...


A) 34
B) 43
C) 56
D) 273

E) C) and D)
F) A) and C)

Correct Answer

verifed

verified

What is the output of the following C++ code? What is the output of the following C++ code?   A)  10 B)  10 10 C)  10 11 D)  11 11


A) 10
B) 10 10
C) 10 11
D) 11 11

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

C

Showing 1 - 20 of 40

Related Exams

Show Answer