Site icon DataFlair

Quiz on Abstraction in Java

quiz on abstraction in java

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.

Time limit: 0

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

Quiz complete. Results are being recorded.

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

  1. Not categorized 0%
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  1. Current
  2. Review / Skip
  3. Answered
  4. Correct
  5. Incorrect
  1. Question 1 of 15
    1. Question

    Which of the following concepts in OOPS is used to present only the required features to the 

        user?

    Correct
    Incorrect
  2. Question 2 of 15
    2. Question

    Which of the following is the correct  syntax of the abstract class ?

    Correct
    Incorrect
  3. 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();

    }

    }

    Correct
    Incorrect
  4. Question 4 of 15
    4. Question

    Which of these is used to achieve 100% abstraction in Java ?

    Correct
    Incorrect
  5. 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);

    }

    }

    Correct
    Incorrect
  6. 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.”);

    }

    }

    Correct
    Incorrect
  7. Question 7 of 15
    7. Question

    Which of the following is not true about Abstract classes ?

    Correct
    Incorrect
  8. 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();

    }

    }

    Correct
    Incorrect
  9. 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();

    }

    }

    Correct
    Incorrect
  10. Question 10 of 15
    10. Question

    Which of the following keywords is used to declare abstract class ?

    Correct
    Incorrect
  11. 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);

    }

    }

    Correct
    Incorrect
  12. 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();

    }

    }

    Correct
    Incorrect
  13. Question 13 of 15
    13. Question

    Which of the following classes contains a default parameter ?

    Correct
    Incorrect
  14. Question 14 of 15
    14. Question

    Which of the following programs contain abstract classes ?

    Correct
    Incorrect
  15. 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();

    }

    }

    Correct
    Incorrect

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.

Exit mobile version