Search Header Logo

Quiz#2

Authored by M R

Computers

University

Used 6+ times

Quiz#2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Given the following class declaration:
class Table {
int legs;

String color;
}

Which of the following choices represent the memory after creating an object of Table using the following statement:
Table tab1 = new Table( );

Media Image
Media Image
Media Image

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Read the following Java code:

public class Test {

public static void main (String [] args){

Plane p1 = new Plane( );

................................... // This is the blank

} }

class Plane {

String name;

double engine;}

Which of the following statements is correct to be written in the blank?

p1.engine = "Air";

p1. name = "Jet";

name = "Jet";

Plane.name="Jet";

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Read the following Java code:

public class Test {

public static void main (String [] args){

Plane p1 = new Plane( );

................................... // This is the blank

} }

class Plane {

String name;

double engine;

void run( )
{System.out.println(name);}

}

Which of the following statements is correct to be written in the blank to call the run method?

p1.run( );

System.out.println(p1.run( ));

double d = p1.run( );

p1.run("Jet",3.1);

run( );

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Read the following Java code:

public class Test {

public static void main (String [] args){

Plane p1 = new Plane( );

................................... // This is the blank

} }

class Plane {

private String name;

public double engine;

}

Which of the following statements is correct to be written in the blank?

engine = 3.5;

p1.engine = 3.5;

p1.name = "Jet";

name = "Jet";

p1 = ("Jet",3.5);

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Read the following Java code:

public class Test {

public static void main (String [] args){

Plane p1 = new Plane( );

p1.help( );

} }

class Plane {

private String name;

public double engine;

double help( )

{return engine + 5.1; }

}

What is the output after executing the code above?

5.1

0.0

Error in code

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?