Exam 4: Control Structures I Selection

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the output of the following code? char lastInitial = 'S'; switch (lastInitial) { case 'A': Cout amanda "section 1" amandaendl; break; case 'B': cout << "section 2" << endl; break; case 'C': cout << "section 3" << endl; break; case 'D': cout << "section 4" << endl; break; default: cout << "section 5" << endl; }

Free
(Multiple Choice)
4.7/5
(42)
Correct Answer:
Verified

D

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

Free
(True/False)
4.8/5
(41)
Correct Answer:
Verified

False

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 "____________________".

Free
(Short Answer)
4.8/5
(31)
Correct Answer:
Verified

pass

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

(True/False)
4.7/5
(43)

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

(True/False)
4.9/5
(33)

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

(True/False)
4.9/5
(38)

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

(Multiple Choice)
4.8/5
(40)

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

(Multiple Choice)
4.7/5
(37)

You can disable assert statements by using which of the following?

(Multiple Choice)
4.7/5
(40)

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

(Multiple Choice)
4.9/5
(34)

What is the output of the following C++ code? int x = 35; Int y = 45; Int z; If (x > y) Z = x + y; Else Z = y - x; Cout << x << " " << y << " " << z << endl;

(Multiple Choice)
4.8/5
(34)

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

(True/False)
4.9/5
(27)

Which of the following operators has the lowest precedence?

(Multiple Choice)
4.7/5
(35)

What is the output of the following C++ code? What is the output of the following C++ code?

(Multiple Choice)
4.8/5
(35)

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;.

(Multiple Choice)
4.8/5
(35)

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

(Short Answer)
4.8/5
(38)

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.

(Short Answer)
4.8/5
(35)

Which of the following is a relational operator?

(Multiple Choice)
4.9/5
(41)

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

(True/False)
4.7/5
(41)

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

(Multiple Choice)
4.8/5
(31)
Showing 1 - 20 of 40
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)