Exam 4: Making Decisions

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

What is the output of the following code segment if the user enters 90 for the score? Cout << "Enter your test score: "; Cin >> test_score; If (test_score < 60) Cout << "You failed the test." << endl; If (test_score > 60) Cout << "You passed the test." Else Cout << "You need to study harder next time." << endl;

(Multiple Choice)
4.8/5
(25)

This operator takes an operand and reverses its truth or Falsehood:

(Multiple Choice)
4.9/5
(36)

Input values should always be checked for

(Multiple Choice)
4.9/5
(43)

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 \quad int number = 5; 6 \quad if (number >= 0 && <= 100) 7 \quad\quad cout << "passed.\n"; 8 \quad else 9 \quad\quad cout << "failed.\n"; 10 \quad return 0; 11 }

(Multiple Choice)
4.7/5
(29)

What is the value of the following expression? True && !False

(Multiple Choice)
4.9/5
(31)

You should be careful when using the equality operator to compare floating point values because of potential round-off errors.

(True/False)
4.8/5
(33)

The value of result in the following expression will be 0 if x has the value of 12. result = x > 100 ? 0 : 1;

(True/False)
4.9/5
(35)

Which statement allows you to properly check the char variable code to determine whether it is equal to a C and then output This is a check?

(Multiple Choice)
4.8/5
(27)

The default section is required in a switch statement.

(True/False)
4.8/5
(31)

If the expression on the left side of the following is true, the expression on the right side will not be checked. (a > = b) || (c == d)

(True/False)
4.8/5
(31)

As a rule of style, when writing an if statement you should indent the conditionally-executed statements.

(True/False)
4.7/5
(37)

Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

(Multiple Choice)
4.8/5
(33)

What is the value of result after the following code executes? int a = 60; int b = 15; int result = 10; if (a = b) \quad result *= 2;

(Multiple Choice)
4.8/5
(38)

A variable, usually a bool or an int, that signals when a condition exists is known as a(n)

(Multiple Choice)
4.8/5
(24)

Which of the following expressions will determine whether x is less than or equal to y?

(Multiple Choice)
4.8/5
(37)

Which of the following is evaluated first, given the expression: A && B || C && !D

(Multiple Choice)
4.8/5
(35)

After the following code executes, what is the value of my_value if the user enters 0? Cin >> my_value; If (my_value > 5) My_value = my_value + 5; Else if (my_value > 2) My_value = my_value + 10; Else My_value = my_value + 15;

(Multiple Choice)
4.8/5
(27)

What is the output of the following code? int w = 98; int x = 99; int y = 0; int z = 1; if (x >= 99) { \quad if (x < 99) \quad\quad cout << y << endl; \quad else \quad\quad cout << z << endl; } else { \quad if (x == 99) \quad\quad cout << x << endl; \quad else \quad\quad cout << w << endl; }

(Multiple Choice)
4.7/5
(27)

Relational operators allow you to __________ numbers.

(Multiple Choice)
4.8/5
(29)

This operator represents the logical AND:

(Multiple Choice)
4.8/5
(29)
Showing 21 - 40 of 51
close modal

Filters

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