Java Module 2 Quiz

Java Module 2 Quiz

University

10 Qs

quiz-placeholder

Similar activities

WizQuiz

WizQuiz

University

15 Qs

Class Diagrams

Class Diagrams

University

15 Qs

ENT110 C Programming Quiz2

ENT110 C Programming Quiz2

University

10 Qs

Java Classes

Java Classes

12th Grade - University

10 Qs

Topic 1-1: Introduction to Computer & Programming Language

Topic 1-1: Introduction to Computer & Programming Language

University

10 Qs

How Much You Know Computer?

How Much You Know Computer?

University

15 Qs

Writing Classes in Java

Writing Classes in Java

University

5 Qs

Functions - C

Functions - C

12th Grade - University

10 Qs

Java Module 2 Quiz

Java Module 2 Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Mr. V

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

hi hi

 

 

hi world

world world

Compilation fails.

An exception is thrown at runtime.

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

4

3

2

1

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

D

B

A

C,F

E

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Given:

11.  abstract class Vehicle { public int speed() { return 0; }

12.  class Car extends Vehicle { public int speed() { return 60; }

13.  class RaceCar extends Car { public int speed() { return 150; }

...

21.  RaceCar racer = new RaceCar();

22.  Car car = new RaceCar();

23.  Vehicle vehicle = new RaceCar();

24.  System.out.println(racer.speed() + ", " + car.speed()

25. + ", " + vehicle.speed());

What is the result?

0,0,0

150,60,0

150,150,150

60,0,150

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Given:

5.  class Building { }

6.  public class Barn extends Building {

7.  public static void main(String[] args) {

8.  Building build1 = new Building();

9.  Barn barn1 = new Barn();

10.  Barn barn2 = (Barn) build1;

11.  Object obj1 = (Object) build1;

12.  String str1 = (String) build1;

13.  Building build2 = (Building) barn1;

14. }

15. }

Which is true?

If line 10 is removed, the compilation succeeds.

 

If line 13 is removed, the compilation succeeds.

If line 11 is removed, the compilation succeeds.

More than one line must be removed for compilation to succeed.

If line 12 is removed, the compilation succeeds.

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Given:

21.  class Money {

22.  private String country = "Canada";

23.  public String getC() { return country; }

24. }

25.  class Yen extends Money {

26.  public String getC() { return super.country; }

27. }

28.  public class Euro extends Money {

29.  public String getC(int x) { return super.getC(); }

30.  public static void main(String[] args) {

31.  System.out.print(new Yen().getC() + " " + new Euro().getC());

32. }

33. }

What is the result?

null Canada

 

Compilation fails due to an error on line 26.

Canada null

Canada Canada

Compilation fails due to an error on line 29.

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the maximum number of levels possible in a Multilevel Inheritance in Java?

32

16

8

no limit

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?