oops java quiz

Java OOPs Quiz – Part 1

oops java quiz

Test your coding prowess in our Ultimate Programming Java OOPs Quiz - Part 1 with Total 10 Questions.

Whether you're a seasoned developer or just dipping your toes into the programming world, challenge yourself with a range of questions spanning languages like Python, Java, and more.

Are you ready to conquer the coding conundrums? Put on your thinking hat and dive into the quiz now!

Name
Email
1. 
Which of the following is an object encapsulated inside the System class?

2. 
___ is used as a base class to derive specific classes of the same kind.

3. 
Which of the following class has empty methods:

4. 
Which of these is correct way of inheriting class A by class B?

5. 
What will be the output of the following Java code?

class OutputΒ 
Β  Β  {
Β  Β  Β  Β  public static void main(String args[])
Β  Β  Β  Β  {
Β  Β  Β  Β  Β  Β  Β Object obj = new Object();
Β  Β  Β  System.out.print(obj.getclass());
Β  Β  Β  Β  }
Β  Β  }

6. 
A program which shows an example of

class Student{
Β int id;
Β String name;
}
Β 
class MainStudent{Β Β 
Β public static void main(String args[]){
Β  Student s1 = new Student();
Β  s1.id=100;
Β  s1.name="Sadiq";
Β  System.out.println(s1.id+" "+s1.name);
Β }
}

7. 
What is an anonymous object in Java?

8. 
Which polymorphism behavior do you see in below class?

class Paint {
Β // all methods have same name
Β public void Color(int x) {
Β }
Β 
Β public void Color(int x, int y) {
Β }
Β 
Β public void Color(int x, int y, int z) {
Β }
}

9. 
Whose car will be called in the following program?

class Father {
Β 
Β public void car() {
Β  System.out.println("Father's Car");
Β }
}
Β 
class Son extends Father {
Β 
Β public void car() {
Β  System.out.println("Son's Car");
Β }
}
Β 
public class Sample {
Β 
Β public static void main(String[] args) {
Β 
Β  Son john = new Son();
Β  john.car();
Β }
Β 
}

10. 
What does encapsulation ensure in Java?