Filters
Question type

Study Flashcards

A control structure alters the normal sequential flow of execution in a program.

Correct Answer

verifed

verified

What is the output of the following code? char lastInitial = 'A'; Switch (lastInitial) { Case 'A': \quad Cout << "section 1" << endl; \quad Break; Case 'B': \quad Cout << "section 2" << endl; \quad Break; Case 'C': \quad Cout << "section 3" << endl; \quad Break; Case 'D': \quad Cout << "section 4" << endl; \quad Break; Default: \quad Cout << "section 5" << endl; }


A) section 1
B) section 2
C) section 3
D) section 5

Correct Answer

verifed

verified

What does <= mean?


A) less than
B) greater than
C) less than or equal to
D) greater than or equal to

Correct Answer

verifed

verified

Which of the following is the "not equal to" relational operator?


A) !
B) |
C) !=
D) &

Correct Answer

verifed

verified

The symbol > is a(n)____________________ operator.

Correct Answer

verifed

verified

To output results correctly,the switch structure must include a(n)____________________ statement after each cout statement,except the last cout statement.

Correct Answer

verifed

verified

Suppose x is 5 and y is 7.Choose the value of the following expression: (x != 7) && (x <= y)


A) false
B) true
C) 0
D) null

Correct Answer

verifed

verified

What is the output of the following C++ code? int x = 35; int y = 45; int z; if (x > y) \quad z = x + y; else \quad z = y - x; Cout << x << " " << y << " " << z << endl;


A) 35 45 80
B) 35 45 10
C) 35 45 -10
D) 35 45 0

Correct Answer

verifed

verified

The value of the expression 7 + 8 <= 15 is ____________________.

Correct Answer

verifed

verified

Once an input stream enters a(n)____________________ state,all subsequent input statements associated with that input stream are ignored,and the computer continues to execute the program,which produces erroneous results.

Correct Answer

verifed

verified

A(n)____________________ structure does not require the evaluation of a logical expression.

Correct Answer

verifed

verified

switch

The conditional operator ?: takes ____ arguments.


A) two
B) three
C) four
D) five

Correct Answer

verifed

verified

What is the output of the following code? if (6 > 8) { \quad Cout << " ** " << endl ; \quad Cout << "****" << endl; } else if (9 == 4) \quad cout << "***" << endl; else \quad cout << "*" << endl;


A) *
B) **
C) ***
D) ****

Correct Answer

verifed

verified

A

In C++,the logical operator AND is represented by ____________________.

Correct Answer

verifed

verified

For a program to use the assert function,it must include which of the following?


A) #include <assert>
B) #include <cassert>
C) #include <assertc>
D) #include NDEBUG

Correct Answer

verifed

verified

What is the output of the following code fragment if the input value is 4? int num; Int alpha = 10; Cin >> num; Switch (num) { Case 3: \quad Alpha++; \quad Break; Case 4: Case 6: \quad Alpha = alpha + 3; Case 8: \quad Alpha = alpha + 4; \quad Break; Default: \quad Alpha = alpha + 5; } Cout << alpha << endl;


A) 13
B) 14
C) 17
D) 22

Correct Answer

verifed

verified

The expression (x >= 0 && x <= 100)evaluates to false if either x < 0 or x >= 100.

Correct Answer

verifed

verified

Which of the following operators has the highest precedence?


A) !
B) *
C) %
D) =

Correct Answer

verifed

verified

A

Every else must be paired with a(n)____________________.

Correct Answer

verifed

verified

In a ____ control structure,the computer executes particular statements depending on some condition(s) .


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

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer