Filters
Question type

Study Flashcards

You can use either a(n) ____ or a ____ to store the value of a logical expression.


A) float, double
B) char, string
C) int, bool
D) float, string

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

Suppose found = true and num = 6.The value of the expression (!found) || (num > 6) is ____________________.

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

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

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

Correct Answer

verifed

verified

Which of the following operators has the highest precedence?


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

Correct Answer

verifed

verified

Suppose x is 5 and y is 7.Choose the value of the following expression: Suppose x is 5 and y is 7.Choose the value of the following expression:   A)  false B)  true C)  0 D)  null


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

Correct Answer

verifed

verified

The operators !, &&, and || are called relational operators.

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

Putting ____________________ in front of a logical expression reverses the value of that logical expression.

Correct Answer

verifed

verified

In C++, the operators != and == have the same order of precedence.

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

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 C++ code? What is the output of the following C++ code?   A)  2 B)  5 C)  8 D)  10


A) 2
B) 5
C) 8
D) 10

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

Putting a semicolon after the parentheses following the expression in an if statement (that is, before the statement) is a(n) ____________________ error.

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

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

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer