Exam 4: Control Structures I (Selection)

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

Which of the following operators has the highest precedence?

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

A

A(n)____________________ structure does not require the evaluation of a logical expression.

Free
(Short Answer)
5.0/5
(36)
Correct Answer:
Verified

switch

What is the output of the following code? if (6 > 8) { \quad Cout << " ** " << endl ; \quad Cout << "****" << endl; } else if (9 == 4) \quad cout << "***" << endl; else \quad cout << "*" << endl;

Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
Verified

A

What is the output of the following code? char lastInitial = 'A'; 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.8/5
(29)

For a program to use the assert function,it must include which of the following?

(Multiple Choice)
4.7/5
(43)

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

(True/False)
4.8/5
(36)

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

(True/False)
4.9/5
(39)

The conditional operator ?: takes ____ arguments.

(Multiple Choice)
4.8/5
(39)

What is the output of the following C++ code? int x = 35; int y = 45; int z; if (x > y) \quad z = x + y; else \quad z = y - x; Cout << x << " " << y << " " << z << endl;

(Multiple Choice)
4.8/5
(39)

What is the output of the following code fragment if the input value is 4? int num; Int alpha = 10; Cin >> num; Switch (num) { Case 3: \quad Alpha++; \quad Break; Case 4: Case 6: \quad Alpha = alpha + 3; Case 8: \quad Alpha = alpha + 4; \quad Break; Default: \quad Alpha = alpha + 5; } Cout << alpha << endl;

(Multiple Choice)
4.8/5
(32)

In a ____ control structure,the computer executes particular statements depending on some condition(s).

(Multiple Choice)
4.9/5
(27)

Which of the following is the "not equal to" relational operator?

(Multiple Choice)
4.8/5
(32)

In C++,the logical operator AND is represented by ____________________.

(Short Answer)
4.9/5
(30)

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.

(Short Answer)
4.8/5
(47)

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

(Multiple Choice)
4.8/5
(35)

To output results correctly,the switch structure must include a(n)____________________ statement after each cout statement,except the last cout statement.

(Short Answer)
4.7/5
(28)

The symbol > is a(n)____________________ operator.

(Short Answer)
4.9/5
(37)

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

(True/False)
4.8/5
(37)

Every else must be paired with a(n)____________________.

(Short Answer)
4.8/5
(33)

What does <= mean?

(Multiple Choice)
4.8/5
(34)
Showing 1 - 20 of 50
close modal

Filters

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