Exam 4: Control Structures I: Selection

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

Including a semicolon before the action statement in a one-way selection causes a syntax error.

(True/False)
4.8/5
(44)

All switch structures include default cases.

(True/False)
4.9/5
(38)

A program uses selection to implement a branch.

(True/False)
4.8/5
(42)

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

(True/False)
5.0/5
(37)

Which of the following is a relational operator?

(Multiple Choice)
4.7/5
(39)

Based on the code above, what is the value of y if x = 5?

(Multiple Choice)
4.9/5
(37)

Suppose that you have the following code: int sum = 0; int num = 8; if (num < 0) sum = sum + num; else if (num > 5) sum = num + 15; After this code executes, what is the value of sum?

(Multiple Choice)
4.9/5
(33)

All switch cases include a break statement.

(True/False)
4.9/5
(30)

If str1 is "Hello" and str2 is "Hi", which of the following could not be a result of str1.compareTo(str2);?

(Multiple Choice)
4.9/5
(37)

The method compareTo is part of the class String.

(True/False)
4.9/5
(48)
Showing 41 - 50 of 50
close modal

Filters

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