
Spring Semester Quiz 6

Quiz
•
Other
•
University
•
Easy

Ashong Nartey
Used 7+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will be the output of the following code?
class A {
void display() {
System.out.println("Class A");
}
}
class B extends A {
void display() {
System.out.println("Class B");
}
}
public class Main {
public static void main(String[] args) {
A obj = new B();
obj.display();
}
}
Class A
Class B
Compilation Error
Runtime Error
2.
MULTIPLE SELECT QUESTION
20 sec • 3 pts
Which of the following statements about the Object class in Java is/are FALSE?
Every Java class extends Object class either directly or indirectly.
Only classes without a superclass extend Object class.
The Object class cannot be extended.
Object class is an abstract class.
3.
MULTIPLE SELECT QUESTION
20 sec • 3 pts
The following are not among the primary purposes of encapsulation in Java?
To restrict access to data and ensure data hiding.
To group related methods together.
To implement multiple inheritance.
To allow direct access to class fields.
4.
FILL IN THE BLANK QUESTION
20 sec • 1 pt
Which keyword is used to refer to the immediate parent class in Java?
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What happens if an abstract class does not have any abstract methods?
Java will automatically provide an abstract method.
It will not compile.
The class can still be abstract.
It becomes a concrete class.
6.
FILL IN THE BLANK QUESTION
20 sec • 1 pt
What will be the output of this code?
class Animal {
void makeSound() {
System.out.println("Animal makes a sound");
}
}
class Dog extends Animal {
void makeSound() {
System.out.println("Dog barks");
}
}
public class Main {
public static void main(String[] args) {
Animal a = new Dog();
a.makeSound();
}
}
7.
MULTIPLE SELECT QUESTION
20 sec • 3 pts
Which of the following statements about abstract classes is/are FALSE?
Abstract classes cannot have constructors.
Abstract classes cannot have final methods.
An object of an abstract class cannot be instantiated.
Abstract classes cannot have static methods.
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Tech quiz Round 1

Quiz
•
University
20 questions
Java Simple - 1

Quiz
•
University
18 questions
MIDTERM EXAM

Quiz
•
University
10 questions
Java set 1

Quiz
•
University
15 questions
Java Class and Object Quiz

Quiz
•
University
10 questions
Java

Quiz
•
University
20 questions
MSDS

Quiz
•
University
12 questions
JAVA FUNDAMENTALS

Quiz
•
University
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade