Filters
Question type

Study Flashcards

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


A) 2
B) 4
C) 6
D) 8

E) A) and B)
F) A) and D)

Correct Answer

verifed

verified

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?


A) 0
B) 8
C) 15
D) 23

E) B) and D)
F) C) and D)

Correct Answer

verifed

verified

The method compareTo is part of the class String.

A) True
B) False

Correct Answer

verifed

verified

A program uses selection to implement a branch.

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

All switch structures include default cases.

A) True
B) False

Correct Answer

verifed

verified

All switch cases include a break statement.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is a relational operator?


A) =
B) ==
C) !
D) &&

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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


A) -9
B) -5
C) -1
D) 1

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

Showing 41 - 50 of 50

Related Exams

Show Answer