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.
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
In Java, statements present inside which functions are executed ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
Question 4 of 15
4. Question
Which of the following is a valid overloading concept in Java ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
Question 7 of 15
7. Question
Which of the following is not true of Abstract methods in Java ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
Question 10 of 15
10. Question
Which of the following is not possible without interfaces in Java ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following is not one of the four main concepts of OOPs in Java ?
CorrectIncorrect -
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 ?
CorrectIncorrect -
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 ?
CorrectIncorrect
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!
