Docsity

CSCE 1337 Object Oriented Programming Chapter 3 Quiz: Practice Questions and Answers, Exams of Advanced Education

Toggle sidebar
bg1
CSCE 1337 Object Oriented Programing Chapter 3
Quiz 100% Verified
In an enumerated data type, different constants may not have the same value. -
ANSWER False
Which if the following are valid case statements in a switch - ANSWER case 1:
If you need to write a do-while loop that will ask the user to enter a number between 2
and 5 inclusive, and will keep asking until the user enters a correct number, what is the
loop condition? - ANSWER (2 > number || number > 5)
A function may return a boolean value? - ANSWER True
Given the following code, what is the final value of i?
int i,j;
for (i = 0 ; i < 4 ; i ++)
{ For (j = 0; j < 3 ; j++_
if (i ==2)
break;
} } - ANSWER 4
A boolean expression may evaluate to more than 2 values - ANSWER False
A break statement in a switch stops your program. - ANSWER False
pf3

Partial preview of the text

Download CSCE 1337 Object Oriented Programming Chapter 3 Quiz: Practice Questions and Answers and more Exams Advanced Education in PDF only on Docsity!

CSCE 1337 Object Oriented Programing Chapter 3

Quiz 100% Verified

In an enumerated data type, different constants may not have the same value. -ANSWER False

Which if the following are valid case statements in a switch - ANSWER case 1: If you need to write a do-while loop that will ask the user to enter a number between 2and 5 inclusive, and will keep asking until the user enters a correct number, what is the loop condition? - ANSWER (2 > number || number > 5) A function may return a boolean value? - ANSWER True Given the following code, what is the final value of i? int i,j;for (i = 0 ; i < 4 ; i ++) { For (j = 0; j < 3 ; j++_ if (i ==2)break; } } - ANSWER 4 A boolean expression may evaluate to more than 2 values - ANSWER False A break statement in a switch stops your program. - ANSWER False

What is wrong with the following for loop? for( int i=0; i < 10; i--) { cout << "Hello\n" } - ANSWER infinite loop Which of the following is not a good reason for choose a certain loop control? -ANSWER if the loop is in a function

it is illegal to make function calls inside a switch statement - ANSWER False if you want a loop to quit iterating if x < 10 and y > 3, what would be the proper loopcondition test? - ANSWER (x >=10 || y <=3)

When testing a program with a loop, which of the following tests should be done? -ANSWER A B C (one less then max, no iterations, the max number)

The break statement causes all loops to exit - ANSWER False What is not an advantage of an enum class of a standard enum? -less memory ANSWER Occupies

Which loop structures always execute at least once - ANSWER do-while loops All nested if-else statements can be converted into switch statements. -False ANSWER

All switch statements can be converted into nested if-else statements - ANSWER True A semicolon by its self is a valid C++ statement - ANSWER True