Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Abstraction is a fundamental concept in Object-Oriented Programming (OOP) that allows you to focus on the “what” rather than the “how” of things. By hiding unnecessary details and exposing only essential functionalities, abstraction simplifies code, improves maintainability, and promotes code reusability.
This quiz on DataFlair will test your understanding of abstraction in Java and help you solidify your grasp of this critical concept. Let’s test your knowledge.
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
Which of the following concepts in OOPS is used to present only the required features to the
user?
CorrectIncorrect -
Question 2 of 15
2. Question
Which of the following is the correct syntax of the abstract class ?
CorrectIncorrect -
Question 3 of 15
3. Question
abstract class Organism {
public void Sound():
public void Sense();
}
class Human implements Organism {
void Sound() {
System.out.println(“Humans speaks languages”);
}
void Sense() {
System.out.println(“Humans have 6 senses”);
}
};
class Dog implements Organisms {
void Sound() {
System.out.println(“Dog Barks”);
}
void Senses {
System.out.println(“Dogs have 5 senses”);
}
};
class Main {
public static void main ( String args [ ] )
{
Organism h = new Human();
h.Sound();
h.Sense();
}
}
CorrectIncorrect -
Question 4 of 15
4. Question
Which of these is used to achieve 100% abstraction in Java ?
CorrectIncorrect -
Question 5 of 15
5. Question
abstract class Area {
}
class Circle implements Area {
void area (float r) {
System.out.println(Math.Pi*r*r);
}
};
class main {
public static void main ( String args [ ] )
{
Area a = new Circle();
a.area(3);
}
}
CorrectIncorrect -
Question 6 of 15
6. Question
abstract class Demo {
public void display();
}
class RealityShows extends Demo {
void display(String text) {
System.out.println(text);
}
};
class Webseries extends Demo {
void display(String text) {
System.out.println(text);
}
};
class Main {
public static void main (String args [ ] )
{
Demo d = new RealityShows();
Demo d = new Webseries();
d.display(“Telecasted in a pattern.”);
}
}
CorrectIncorrect -
Question 7 of 15
7. Question
Which of the following is not true about Abstract classes ?
CorrectIncorrect -
Question 8 of 15
8. Question
abstract class Functionality {
}
class One extends Functionality {
void print() {
System.out.println(“One is an extended class of Functionality”);
}
}
class Main {
public static void main ( String args [ ] )
{
Functionality o = new One();
o.display();
}
}
CorrectIncorrect -
Question 9 of 15
9. Question
abstract class Example {
void displayText();
}
class Demo extends Example {
void method() {
System.out.println(“Method body is executed.”);
}
};
class Main {
public static void main ( String args [ ] )
{
Example e = new Demo();
e.method();
}
}
CorrectIncorrect -
Question 10 of 15
10. Question
Which of the following keywords is used to declare abstract class ?
CorrectIncorrect -
Question 11 of 15
11. Question
abstract class One {
void calculate();
}
class Two extends One {
void calculate(int a) {
System.out.println(a+a);
}
}
class Three extends One {
void calculate(int a) {
System.out.println(a*a);
}
}
class Main {
public static void main ( String args [ ] )
{
One obj1 = new Two();
obj1.calculate(2);
One obj2 = new Three();
obj2.calculate(2);
}
}
CorrectIncorrect -
Question 12 of 15
12. Question
class Sample {
abstract void method();
}
class First extends Sample {
Abstract void method() {
System.out.println(“First abstract method”);
}
}
class Main {
public static void main ( String args [ ] )
{
Sample object = new First();
object.method();
}
}
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following classes contains a default parameter ?
CorrectIncorrect -
Question 14 of 15
14. Question
Which of the following programs contain abstract classes ?
CorrectIncorrect -
Question 15 of 15
15. Question
abstract class One {
public void method();
}
class Two extends One {
void method() {
System.out.println(“First extended class is executed”);
}
};
class Three extends One {
void method() {
System.out.println(‘Second extended class is executed”);
}
};
class Main {
public static void main ( String args [ ] )
{
One o = new Two();
o.method();
One o = new Three();
}
}
CorrectIncorrect
Summary:
Ready to put your knowledge of abstraction in Java to the test? This quiz by DataFlair provides a series of multiple-choice questions designed to assess your understanding of key abstraction principles.
Whether you’re a beginner or a seasoned Java programmer, this quiz can be a valuable tool to identify areas for improvement and solidify your mastery of abstraction concepts.
By attempting the quiz, you’ll gain insights into essential topics such as abstract classes, interfaces, and the benefits of using abstraction in your Java applications.
