Site icon DataFlair

Quiz on Java OOP Concept

quiz on java oOP concept

Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java

Object-oriented programming (OOP) isn’t just a fancy term in Java – it’s the cornerstone of how you build robust applications. Imagine constructing a house with bricks; OOP provides the blueprints and methodologies for creating well-structured, reusable code blocks that act like those essential bricks.

By mastering OOP concepts, you’ll not only write cleaner code, but you’ll empower yourself to develop modular programs that can be easily scaled and maintained. This interactive quiz acts as your virtual practice ground, challenging your grasp of fundamental OOP principles in Java.

By taking the quiz and exploring the explanations for each answer, you’ll identify areas where you can solidify your knowledge and become a more proficient Java programmer. So, dive in, test yourself, and embark on a rewarding journey to OOP mastery! 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

     In Java, statements present inside which functions are executed ?

    Correct
    Incorrect
  2. Question 2 of 15
    2. Question

    class Demo {

    public void print ( String a )

    {

    System.out.println(a);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    Demo d = new Demo();

    d.print(“DataFlair”);

    }

    }

    What is the output of the program ?

    Correct
    Incorrect
  3. Question 3 of 15
    3. Question

    class Parent {

    String a = “Data”;

    }

    class Child extends Parent {

    String b = “Flair”;

    }

    class Derived extends Child {

    public void method() {

    System.out.println(a+b);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    Derived obj = new Derived();

    obj.method();

    }

    }

    What is the output of the program ?

    Correct
    Incorrect
  4. Question 4 of 15
    4. Question

    Which of the following is a valid overloading concept in Java ?

    Correct
    Incorrect
  5. Question 5 of 15
    5. Question

    class Encapsulation {

    private String a;

    public void getname(String c)

    {

    return c;

    }

    public void setname( String c)

    {

    a=c;

    System.out.println(a);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    Encapsulation e = new Encapsulation ();

    e.getname(“Encapsulation);

    e.setname(“Encapsulation”);

    }

    }

    What is the output of the program ?

    Correct
    Incorrect
  6. Question 6 of 15
    6. Question

    abstract class One {

    abstract void print(){

    System.out.println(“DataFlair”);

    }

    }

    class Two extends One {

    abstract void print();

    }

    class Main {

    public static void main ( String args [ ] )

    {

    Two t = new Two();

    t.print();

    }

    }

    What will be the output of the program ?

    Correct
    Incorrect
  7. Question 7 of 15
    7. Question

    Which of the following is not true of Abstract methods in Java ?

    Correct
    Incorrect
  8. Question 8 of 15
    8. Question

    class Early {

    public void display()

    {

    System.out.println(“Example of Static binding”);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    Early e = new Early();

    e.display();

    }

    }

    What will be the output of the program ?

    Correct
    Incorrect
  9. Question 9 of 15
    9. Question

    class Function {

    private void display()

    {

    String a = “Private”;

    System.out.println(a);

    }

    }

    class Sample {

    public void show()

    {

    System.out.println(a);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    Function f = new Function();

    Sample s = new Sample();

    s.show();

    }

    }

    What is the error in the program ?

    Correct
    Incorrect
  10. Question 10 of 15
    10. Question

    Which of the following is not possible without interfaces in Java ?

    Correct
    Incorrect
  11. Question 11 of 15
    11. Question

    class A {

    public void show()

    {

    System.out.println(“Class A method”);

    }

    }

    class B {

    public void show()

    {

    System.out.println(“Class B method”);

    }

    }

    class C extends A and B {

    public void show()

    {

    System.out.println(“Class C method”);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    C c = new C();

    c.show();

    }

    }

    What will be the output of the program ?

    Correct
    Incorrect
  12. Question 12 of 15
    12. Question

    class Main {

    public static void main ( String args [ ] )

    {

    String a ;

    a = “Objects are garbage collected”;

    Main m = new Main();

    System.out.println(a);

    }

    What will be the output of the program ?

    Correct
    Incorrect
  13. Question 13 of 15
    13. Question

    Which of the following is not one of the four main concepts of OOPs in Java ?

    Correct
    Incorrect
  14. Question 14 of 15
    14. Question

    class Polymorphism {

    string a = “Character”;

    }

    class Example extends Polymorphism {

    String a = “Literal”;

    public void display()

    {

    System.out.println(a);

    }

    }

    Class Main {

    public static void main ( String args [ ] )

    {

    Example e = new Example ();

    e.display();

    }

    }

    What is the output of the program ?

    Correct
    Incorrect
  15. Question 15 of 15
    15. Question

    class StaticBinding {

    public void print()

    {

    System.out.println(“Early Binding”);

    }

    }

    class LateBinding extends StaticBinding {

    public void print()

    {

    System.out.println(“Dynamic Binding”);

    }

    }

    class Main {

    public static void main ( String args [ ] )

    {

    StaticBinding obj = new LateBinding();

    obj.print();

    }

    }

    What will be the output of the program ?

    Correct
    Incorrect

Summary:

Congratulations on taking the plunge and testing your knowledge with the Java OOP Concept Quiz! This quiz wasn’t just about ticking boxes; it was a chance to assess your understanding of the fundamental building blocks of object-oriented programming in Java.

Concepts like classes, objects, inheritance, and polymorphism were all on the table, and by reviewing both the questions you aced and the ones that challenged you, you’ve gained valuable insights into your Java OOP skillset.

But remember, the quest for OOP mastery is a marathon, not a sprint! This quiz was just the beginning. To truly solidify your grasp of these core concepts, delve deeper into the world of Java OOP. Explore online courses and tutorials that offer comprehensive explanations and practical examples.

Challenge yourself with practice problems that test your ability to apply your knowledge in real-world scenarios. The more you explore and experiment, the more comfortable and confident you’ll become with the power of OOP in Java. So, don’t stop here – keep learning, keep practising, and keep building your skills as a Java OOP programmer!

Exit mobile version