Exam 4: Control Structures I: Selection

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

Which of the following is not a logical operator?

(Multiple Choice)
4.7/5
(46)

=! is a relational operator.

(True/False)
4.8/5
(40)

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

The symbol >= is a logical operator.

(True/False)
4.8/5
(35)

A program uses selection to implement a branch.

(True/False)
4.8/5
(44)

What does >= mean?

(Multiple Choice)
4.9/5
(36)

int x, y;if (x 4) { If (x > 7) Y = 4; Else Y = 6; } Else Y = 8;Based on the code above, what is the value of y if x = 9?

(Multiple Choice)
4.8/5
(36)

int x; X = (1 'K' >= 'F') ? 5 : 12Based on the code above, what is the value of x?

(Multiple Choice)
4.8/5
(31)

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

(True/False)
4.9/5
(31)

int x, y;if (x 4) { If (x > 7) Y = 4; Else Y = 6; } Else Y = 8;Based on the code above, what is the value of y if x = 4?

(Multiple Choice)
5.0/5
(38)

'A' = 7 || 4 Based on the code above, which part of the expression is not evaluated?

(Multiple Choice)
4.9/5
(33)

The expression !(x is true only if x is a positive number.

(True/False)
4.9/5
(34)

The conditional operator ?: takes ____ arguments.

(Multiple Choice)
4.7/5
(38)

int x, y;if (x 4) { If (x > 7) Y = 4; Else Y = 6; } Else Y = 8;Based on the code above, what is the value of y if x = 1?

(Multiple Choice)
4.9/5
(48)

Which of the following will cause a syntax error, if you are trying to compare x to 5?

(Multiple Choice)
4.8/5
(43)

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

(True/False)
4.9/5
(42)

What is the output of the following Java code?int x = 0; If (x > 0) System.out.println("positive "); System.out.println("zero "); System.out.println("negative");

(Multiple Choice)
4.9/5
(31)

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

(True/False)
4.9/5
(35)

The expression 'A' 'B' evaluates to false while the expression 'A' 'B' evaluates to true.

(True/False)
4.9/5
(37)

The method compareTo is part of the class String.

(True/False)
4.9/5
(37)
Showing 21 - 40 of 50
close modal

Filters

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