Filters
Question type

Study Flashcards

If the expression in an assert statement evaluates to true, the program terminates.

Correct Answer

verifed

verified

The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4 is ____________________.

Correct Answer

verifed

verified

The term ____________________ describes a process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.

Correct Answer

verifed

verified

short-circ...

View Answer

The conditional operator ?: takes ____ arguments.


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

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

Consider the following statements. int score; string grade; if (score >= 65) grade = "pass"; else grade = "fail"; If score is equal to 75, the value of grade is "____________________".

Correct Answer

verifed

verified

The ____________________ of relational and logical operators is said to be from left to right.

Correct Answer

verifed

verified

Which of the following will cause a logical error if you are attempting to compare x to 5?


A) if (x == 5)
B) if (x = 5)
C) if (x <= 5)
D) if (x >= 5)

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

What is the value of x after the following statements execute? int x; X = (5 <= 3 && 'A' < 'F') ? 3 : 4


A) 2
B) 3
C) 4
D) 5

Correct Answer

verifed

verified

A compound statement functions as if it was a single statement.

Correct Answer

verifed

verified

In C++, both ! and != are relational operators.

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

The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.

Correct Answer

verifed

verified

Suppose that x is an int variable. Which of the following expressions always evaluates to true?


A) (x > 0) || ( x <= 0)
B) (x >= 0) || (x == 0)
C) (x > 0) && ( x <= 0)
D) (x > 0) && (x == 0)

Correct Answer

verifed

verified

Assume you have three int variables: x = 2, y = 6, and z. Choose the value of z in the following expression: z = (y / x > 0) ? x : y;.


A) 2
B) 3
C) 4
D) 6

Correct Answer

verifed

verified

What is the output of the following code? char lastInitial = 'S'; 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 2
B) section 3
C) section 4
D) section 5

Correct Answer

verifed

verified

Which of the following expressions correctly determines that x is greater than 10 and less than 20?


A) 10 < x < 20
B) (10 < x < 20)
C) 10 < x && x < 20
D) 10 < x || x < 20

Correct Answer

verifed

verified

The expression in an if statement is sometimes called a(n) ____.


A) selection statement
B) action statement
C) decision maker
D) action maker

Correct Answer

verifed

verified

Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer