Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is sum after the following loop terminates? int sum = 0; int item = 0; do { item++; sum += item; if (sum >

What is sum after the following loop terminates?

int sum = 0; int item = 0; do { item++; sum += item; if (sum > 4) break; } while (item < 5);

A.

6

B.

7

C.

8

D.

5

The statement System.out.printf("%10s", 123456) outputs ________. (Note: in rhe answers * represents a space)

A.

23456*****

B.

123456****

C.

****123456

D.

12345*****

Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?

A.

((x < 100) && (x > 1)) && (x < 0)

B.

((x < 100) && (x > 1)) || (x < 0)

C.

(1 > x > 100) || (x < 0)

D.

1 < x < 100 && x <

Which of the following expressions is equivalent to (x > 1)?

A.

x >= 1

B.

!(x < 1)

C.

!(x <= 1)

D.

!(x = 1)

One byte has ________ bits.

A.

8

B.

12

C.

4

D.

16

What is the result of 45 / 4?

A.

11.25

B.

10

C.

12

D.

11

What is x after the following statements?

int x = 2; int y = 1; x *= y + 1;

A.

x is 2.

B.

x is 1.

C.

x is 3.

D.

x is 4.

Which of the following expression yields an integer between 0 and 100, inclusive?

A.

(int)(Math.random() * 100 + 1)

B.

(int)(Math.random() * 101)

C.

(int)(Math.random() * 100)

D.

(int)(Math.random() * 100) + 1

The following code displays ________.

double temperature = 0; if (temperature >= 100) System.out.println("too hot"); else if (temperature <= 40) System.out.println("too cold"); else System.out.println("jusr right");

A.

too hot

B.

too cold

C.

just right

D.

too hot too cold just right

A Java statement ends with a ________.

A.

comma (,)

B.

period (.)

C.

semicolon (;)

D.

closing brace

What is the output for y?

int y = 0; for (int i = 0; i < 10; ++i) y += i; System.out.println(y);

A.

11

B.

45

C.

12

D.

10

The equal comparison operator in Java is ________.

A.

=

B.

==

C.

<>

D.

!=

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

how to solve a risk management problems?

Answered: 1 week ago

Question

=+2. About the body copy (review chapter 3).

Answered: 1 week ago

Question

=+i. Does it reflect the brand's personality?

Answered: 1 week ago

Question

=+. Does it speak from the audience's point of view?

Answered: 1 week ago