
3CSE2 understanding Java Abstract Classes 2024
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
Sharfuddin Mohammed
Used 1+ times
FREE Resource
Enhance your content in a minute
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.
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?
Similar Resources on Wayground
10 questions
Recursion Practice, Recursion Practice, Recursion Practice...
Quiz
•
10th Grade - University
10 questions
CHAPTER 4: IDS AND IPS
Quiz
•
University
14 questions
LA6.C6: Graphics Window
Quiz
•
9th Grade - University
10 questions
CP N5 Theory Test 1
Quiz
•
University
10 questions
Python Quiz Techno India
Quiz
•
University
10 questions
CSS (Text-Font-Box)
Quiz
•
1st Grade - University
15 questions
1st session
Quiz
•
University
10 questions
Java Questions & Answers
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
