Loops - CPE 211

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/25

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

26 Terms

1
New cards

Unless block statements are used, the body of a while loop can be a single C++ statement only?

True

2
New cards

End of File controlled loops can be used to read information from an input file of unknown length

True

3
New cards

The end of file status bit is changed from false to true when an attempt is made to read beyond the end of an input file?

True

4
New cards

Event controlled loops terminate(exit) when a specific event occurs causing the loop to be exited?

True

5
New cards

In a loop, event counters are incremented every time the loop body is executed.

False

6
New cards

A flag controlled loop continues to execute until the boolean flag has its starting value changed from true to false or false to true which causes the loop to exit.

True

7
New cards

For sentinel controlled loops, the best sentinel is a value that is not expected as normal input for the program?

True

8
New cards

A while loop continues to loop through the loop body as long as the while expression being tested is true?

True

9
New cards

Count controlled loops terminate(exit) when some event occurs in the body of the while loop?

False

10
New cards

In C++ it is a syntax error if a loop is declared inside the body of another loop?  - (in other words it is illegal in c++ to nest loops)

False

11
New cards

Which of the following are types of Event Controlled Loops?

Flag Controlled, Sentinel Controlled, End Of File Controlled

12
New cards

Which of the following are functions that return the boolean status of a file stream status bit?

eof()

good()

fail()

13
New cards

In a switch statement there can be 0 or more statements associated with a Switch Label?

True

14
New cards

A continue statement will cause the immediate exit of the loop in which it appears?

False

15
New cards

In a switch statement, once control branches into the switch statement at a case label, control proceeds sequentially untll either a break statement or the end of the switch statement is encountered - whichever occurs first.

True

16
New cards

Break statements are optional in a switch statement?

True

17
New cards

A break statement causes the immediate exit from the loop or switch statement in which it appears?

True

18
New cards

In C++ programming, all loops should have a break statement in them?

False

19
New cards

In a switch statement, a variable can be used as a case label?

False

20
New cards

The default label is required in a switch statement?

False

21
New cards

In a switch statement, if the switch expression matches a case label, control branches to the statements associated with the default label?

False

22
New cards

The body of a do-while loop will execute 0 or more times?

False

23
New cards

A do-while loop ends with a semi-colon (;) after the while expression?

True

24
New cards

A break statement can be used in which of the following C++ control structures?

while loop

for loop

do-while loop

switch statement

25
New cards

Which of the following data types can be used as switch expressions?

Integer (int)

Boolean (bool)

Character (char)

26
New cards

A continue; statement can be used in which of the following C++ control structures?

while loop

for loop

do-while loop