
3CSE2 understanding Java Abstract Classes 2024

Quiz
•
Computers
•
University
•
Medium
Sharfuddin Mohammed
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is an abstract class in Java?
An abstract class in Java is a class that cannot be instantiated and may contain abstract methods that must be implemented by subclasses.
An abstract class cannot have any fields or properties.
An abstract class must contain only concrete methods.
An abstract class can be instantiated directly.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you declare an abstract method?
Declare an abstract method by using the 'virtual' keyword in a concrete class.
Use the 'abstract' keyword in an abstract class to declare an abstract method.
Use the 'final' keyword in a class to declare an abstract method.
Abstract methods can be declared without any keywords in a regular class.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can an abstract class have concrete methods?
Yes, an abstract class can only have abstract methods.
No, an abstract class cannot have any methods.
Yes, an abstract class can have concrete methods.
An abstract class can only contain static methods.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of dynamic method dispatch?
To improve code readability and maintainability.
To reduce memory usage in applications.
To enforce strict type checking at compile time.
The purpose of dynamic method dispatch is to support runtime method resolution and enable polymorphism in object-oriented programming.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain polymorphism in Java with an example.
Animal myAnimal = new Animal(); myAnimal.sound(); // Outputs: Animal sound
class Dog extends Animal { void makeSound() { System.out.println("Woof"); } }
class Animal { void makeSound() { System.out.println("Sound"); } }
Example: class Animal { void sound() { System.out.println("Animal sound"); } } class Dog extends Animal { void sound() { System.out.println("Bark"); } } class Cat extends Animal { void sound() { System.out.println("Meow"); } } Animal myDog = new Dog(); Animal myCat = new Cat(); myDog.sound(); // Outputs: Bark myCat.sound(); // Outputs: Meow
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if a subclass does not override an abstract method?
The subclass cannot be instantiated.
The subclass inherits the abstract method's implementation.
The abstract method is automatically implemented.
The subclass can be instantiated with default behavior.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does method overriding differ from method overloading?
Method overriding allows multiple methods with the same name in different classes.
Method overriding is about redefining a method in a subclass, while method overloading is about having multiple methods with the same name but different signatures in the same class.
Method overriding is used to create new methods in the same class.
Method overloading is when a subclass inherits a method from its parent class.
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Java Quiz 1

Quiz
•
University
10 questions
Post-Test Creational Design Pattern

Quiz
•
University
10 questions
CMP128 Java Ch. 05 Methods

Quiz
•
University
10 questions
Java - Introduction

Quiz
•
University
8 questions
OOP Lesson 2

Quiz
•
University
10 questions
Object Oriented Programming W1

Quiz
•
University
11 questions
Processing Methods

Quiz
•
12th Grade - University
15 questions
Object Oriented Programming MCQs

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University