Search Header Logo

Java Bootcamp Day 4

Authored by Karthick M

Computers

University

Used 5+ times

Java Bootcamp Day 4
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of inheritance in Java?

Code repetition

Code hiding

Code reuse

Code encryption

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to inherit a class in Java?

implements

inherits

extend

extends

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following inheritance types is not supported directly in Java?

Single

Multilevel

Hierarchical

Multiple (via classes)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code:

class Animal {

void makeSound() { System.out.println("Animal sound"); }

}

class Dog extends Animal {

void makeSound() { System.out.println("Bark"); }

}

What will new Dog().makeSound(); output?

Animal sound

Bark

Error

Null

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is achieved by using the super keyword in Java?

Access static members

Access parent class members

Access child class members

Access private members of parent class

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output?

class A {

A() { System.out.print("A "); }

}

class B extends A {

B() { System.out.print("B "); }

}

public class Test {

public static void main(String[] args) {

new B();

}

}

A B

B A

AB

Compilation Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What concept does method overriding support in Java?

Encapsulation

Inheritance

Abstraction

Polymorphism

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?