Filters
Question type

Study Flashcards

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 B)
F) All of the above

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

What is the value of x after the following statements execute? What is the value of x after the following statements execute?   A)  5 B)  10 C)  20 D)  40


A) 5
B) 10
C) 20
D) 40

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

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) B) and D)
F) C) and D)

Correct Answer

verifed

verified

The function eof is a member of the data type ____________________.

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

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

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) C) 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) A) and B)
F) None of the above

Correct Answer

verifed

verified

The ____________________ statement is typically used for two purposes: • To exit early from a loop. • To skip the remainder of a switch structure.

Correct Answer

verifed

verified

Which of the following loops is guaranteed to execute at least once?


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

E) All of the above
F) None of the above

Correct Answer

verifed

verified

In a sentinel-controlled while loop, the body of the loop continues to execute until the EOF symbol is read.

A) True
B) False

Correct Answer

verifed

verified

The following while loop terminates when j > 20. The following while loop terminates when j > 20.

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) All of the above
F) B) and C)

Correct Answer

verifed

verified

The statement in the body of a while loop acts as a decision maker.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is a repetition structure in C++?


A) if
B) switch
C) while...do
D) do...while

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

Correct Answer

verifed

verified

What is the output of the following loop? What is the output of the following loop?   A)  St B)  Sto C)  Stop D)  This is an infinite loop.


A) St
B) Sto
C) Stop
D) This is an infinite loop.

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

Correct Answer

verifed

verified

Assume all variables are properly declared. The output of the following C++ code is 2 3 4 5. Assume all variables are properly declared. The output of the following C++ code is 2 3 4 5.

A) True
B) False

Correct Answer

verifed

verified

Suppose j, sum, and num are int variables, and the input is 26 34 61 4 -1. What is the output of the code? Suppose j, sum, and num are int variables, and the input is 26 34 61 4 -1. What is the output of the code?   A)  124 B)  125 C)  126 D)  127


A) 124
B) 125
C) 126
D) 127

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

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer