Question: 1. Because Java byte code is the same on all computers, compiled Java programs a. are nonexistent b. must be re-compiled for each different machine

1. Because Java byte code is the same on all computers, compiled Java programs

a.

are nonexistent

b.

must be re-compiled for each different machine before they can be run

c.

are highly portable

d.

cannot run on computers with different operating systems

2. What output will be displayed as a result of executing the following code?

int x = 5, y = 20;

x += 32;

y /= 4;

System.out.println("x = " + x + ", y = " + y);

a.

x = 160, y = 80

b.

x = 32, y = 4

c.

x = 37, y = 5

d.

x = 9, y = 52

3. For the following code, which statement is not true?

public class Sphere

{

private double radius;

public double x;

private double y;

private double z;

}

a.

The z field is available to code written outside the Sphere class.

b.

The radius field is not available to code written outside the Sphere class.

c.

The radius, x, y, and z fields are members of the Sphere class.

d.

The x field is available to code that is written outside the Sphere class.

4. What will be the value of bonus after the following statements are executed?

int bonus, sales = 10000;

if (sales < 5000)

bonus = 200;

else if (sales < 7500)

bonus = 500;

else if (sales < 10000)

bonus = 750;

else if (sales < 20000)

bonus = 1000;

else

bonus = 1250;

a.

750

b.

1250

c.

500

d.

1000

5. In the following statement, which is the superclass?

public class ClassA extends ClassB implements ClassC

a.

ClassA

b.

ClassB

c.

ClassC

d.

both ClassB and ClassC are superclasses

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!