
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
10 questions
Quiz-1

Quiz
•
University
10 questions
Business Law and Regulations Quiz 1

Quiz
•
2nd Grade - University
10 questions
Quizz 1 Java

Quiz
•
University
10 questions
HTML PHP C++

Quiz
•
University
15 questions
CS102 QUIZ

Quiz
•
University
15 questions
Business Law

Quiz
•
University
10 questions
B4 - The for Statement

Quiz
•
University
10 questions
Programacion

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Other
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University