
Java Bootcamp Day 4
Authored by Karthick M
Computers
University
Used 5+ times

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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?