Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In what follows, you have multiple choice questions related to the provided java code. Put your answers in the below table. 1 2 3 4

In what follows, you have multiple choice questions related to the provided java code. Put your answers in the below table.

1

2

3

4

5

6

7

8

9

10

public interface One {

public abstract void A();

}

public abstract class Two implements One{

public void A(){

System.out.println("2A");

}

public void B(){

System.out.println("2B");

}

public abstract void C();

public void D(){

System.out.println("2D");

}

}

public class Three extends Two{

public void A(){

System.out.println("3A");

}

public void C(){

System.out.println("3C");

}

}

public class Four {

public void A(){

System.out.println("4A");

}

}

public class MCQ{

public static void main(String[] args){

// To Do code here taken from the next page

}

}

In each question you have lines of java code. You should assume that these lines of code are in the main method, and choose the correct output from the corresponding multiple choices.

1

Two tst = new Three();

tst.D();

  1. 2D
  2. Compile time error
  3. Runtime error

2

Two tst = new Three();

tst.C();

  1. 3C
  2. Compile time error
  3. Runtime error

3

One tst = new One();

tst.A();

  1. 1A
  2. Compile time error
  3. Runtime error

4

Two tst = new Two();

tst.B();

  1. 2B
  2. Compile time error
  3. Runtime error

5

Object tst = new Four();

tst.A();

  1. 4A
  2. Compile time error
  3. Runtime error

6

Object o = new Four();

Three tst = (Three) o;

tst.A();

  1. 3A
  2. Compile time error
  3. Runtime error

7

Three tst = new Two();

tst.C();

  1. 3C
  2. Compile time error
  3. Runtime error

8

Three tst = new Three();

tst.B();

  1. 2B
  2. Compile time error
  3. Runtime error

9

Two tst = new Three();

tst.A();

  1. 2A
  2. 3A
  1. Runtime error

10

One tst = new Three();

tst.A();

  1. 2A
  2. 3A
  1. Runtime error

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

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago