You are on page 1of 5

Score for this attempt: 10 out of 10

Submitted Feb 14 at 12:25pm


This attempt took 9 minutes.

1 / 1 pts
Question 1

The switch statement is a ________.

multiple alternative decision structure

nested decision structure

sequence structure

test expression

1 / 1 pts
Question 2

If str1 and str2 are both String objects, which of the following
expressions will correctly determine whether or not they are equal?

str1 = str2

str1 && str2

str1.equals(str2)

str1 += str2

1 / 1 pts
Question 3
What will be the value of x after the following statements are executed?

30

20

25

1 / 1 pts
Question 4

What will be the value of ans after the following statements are
executed?

30

80

50

The code contains an error and will not compile.

1 / 1 pts
Question 5
What will be the value of pay after the following statements are
executed?

400.00

450.00

465.00

475.00

1 / 1 pts
Question 6

Which of the following expressions will determine whether x is less


than or equal to y?

x <= y

x => y

x >= y

x =< y

1 / 1 pts
Question 7

Which of the following is the correct boolean expression to test


for: int x being a value between, but not including, 500 and 650,
or int y not equal to 1000?

((x >= 500 && x <= 650) && (y != 1000))

((x > 500 AND x < 650) OR !(y.equal(1000)))


((x > 500 && x < 650) || (y != 1000))

((x < 500 && x > 650) || !(y == 1000))

1 / 1 pts
Question 8

Which of the following is the correct boolean expression to test


for: int x being a value less than or equal to 500 or greater
than 650, or int y not equal to 1000?

((x >= 500 && x < 650) && (y != 1000))

((x <= 500 OR x > 650) AND !(y.equal(1000)))

((x >= 500 || x < 650) || (y != 1000))

((x <= 500 || x > 650) && !(y == 1000))

1 / 1 pts
Question 9

________ works like this: If the expression on the left side of


the &&operator is false, the expression the right side will not be
checked.

Short-circuit evaluation

Reverse logic

Boolean logic

Relational evaluation

1 / 1 pts
Question 10
What will be printed when the following code is executed?
double x = 45678.259;
System.out.printf("%,.2f", x);

45678.259

0,045,678.26

45,678.26

45,678.3

Quiz Score: 10 out of 10

You might also like