Exam 4: Control Structures I (Selection)

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

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.9/5
(35)

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

(True/False)
4.9/5
(26)

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
(37)

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

(True/False)
4.8/5
(31)

What is the output of the following C++ code? int x = 55; Int y = 5; Switch (x % 7) { Case 0: Case 1: \quad Y++; Case 2: Case 3: \quad Y = y + 2; Case 4: \quad Break; Case 5: Case 6: \quad Y = y - 3; } Cout << y << endl;

(Multiple Choice)
4.7/5
(42)

Which of the following operators has the lowest precedence?

(Multiple Choice)
4.9/5
(34)

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

(Multiple Choice)
4.9/5
(44)

In C++,!,&&,and || are called relational operators.

(True/False)
4.9/5
(38)

The operators != and == have the same order of precedence.

(True/False)
4.9/5
(42)

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

(Short Answer)
4.8/5
(37)

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
(30)

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

(Multiple Choice)
4.8/5
(40)

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
(41)

In C++,&& has a higher precedence than ||.

(True/False)
4.8/5
(40)

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

(Multiple Choice)
4.7/5
(36)

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

(Multiple Choice)
4.8/5
(32)

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

(True/False)
4.9/5
(39)

To develop a program,you can use an informal mixture of C++ and ordinary language,called ____.

(Multiple Choice)
4.8/5
(41)

The appearance of = in place of == resembles a(n)____.

(Multiple Choice)
4.7/5
(43)

A ____________________ operator allows you to make comparisions in a program.

(Short Answer)
4.8/5
(32)
Showing 21 - 40 of 50
close modal

Filters

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