Practice Object Oriented Programming Questions and Answers
- What is the primary goal of Abstraction in OOP?
- Which of the following is a common mechanism to achieve abstraction in OOP?
- An abstract class in Java/C++:
- What is an interface in OOP (e.g., Java, C#)?
- Which statement about abstract methods is true?
- How does abstraction contribute to code maintainability?
- Which of the following best represents a real-world example of abstraction?
- What is the primary difference between an abstract class and an interface in Java (pre-Java 8)?
- If a class contains an abstract method, what must be true about the class itself?
- Which OOP principle is most closely related to the concept of "information hiding"?
- What is Encapsulation in OOP?
- Which access modifier is most commonly used to achieve data hiding in encapsulation?
- What are "getter" and "setter" methods primarily used for in the context of encapsulation?
- Which of the following is a benefit of encapsulation?
- Consider a BankAccount class with a balance field. To properly encapsulate balance, it should be declared as:
- Which of the following is the correct way to handle exceptions in Java?
- In Java, what is the difference between '==' and '.equals()' when comparing String objects?
- What does the following Java code snippet demonstrate? class Animal { Β Β void sound() { System.out.println("Some sound"); } } class Dog extends Animal {...
- What is the purpose of the 'static' keyword in Java?
- In .NET (C#), what is the difference between 'struct' and 'class'?
- What is 'recursion' in programming?
- Which of the following is not a valid type of inheritance in Java?
- Which of the following statements is incorrect in reference to Java?
- Which Object-Oriented Programming principle allows a subclass to provide its own specific implementation of a method that is already defined in its supercl...
- In Java, which keyword, when applied to a class declaration, prevents that class from being extended (inherited) by any other class?
- Which Object-Oriented Programming principle refers to bundling data (attributes) and the methods that operate on that data into a single unit, while restri...
- Which type of inheritance allows a class to inherit properties and behavior from more than one parent class simultaneously β supported directly in C++, b...
- Which statement about constructors in Object-Oriented Programming languages such as C++ or Java is correct?
- In C++, class D inherits from both class B and class C, and both B and C separately inherit from a common base class A (without using virtual inheritance)....
- A C++ base pointer refers to a derived object. The base function is virtual and overridden. What happens when called through the base pointer?
- A class exposes calculateSalary() while hiding internal rules and data. Which OOP concept is best illustrated?
- What is the output of the following Java code? class Counter { Β Β static int count = 0; Β Β Counter() { count++; } } public class Main { Β Β public ...
- Which OOP concept allows a single function or method name to behave differently based on the number or type of arguments passed to it?
- What is the primary purpose of a "constructor" in object-oriented programming?
- Which statement best distinguishes a "class" from an "object" in object-oriented programming?
More Topics
- Algorithms Questions
- Analog and Digital Communication Questions
- Artificial Intelligence & Machine Language Questions
- Basics of Computers Questions
- Big Data Analytics Questions
- C Programming Questions
- C++ Questions
- Cloud Computing Questions
- Compiler Design Questions
- Computer Architecture and Design Questions
- Cyber Security Questions
- Data Analytics Languages Questions
- Data Structure Questions
- Data Warehousing Questions
- Digital Logic Questions
- Emerging Technologies Questions
- IOT and mobile Computing Questions
- IT DBMS Questions
- IT Networking Questions
- IT Operating System Questions
- Java Language Questions
- Machine Learning Questions
- Memory Management Questions
- Microsoft Office Questions
- Miscellaneous Questions Questions
- Network Layer and IP Protocol Questions
- Numerical and Statistical Computing Questions
- OOPS Concepts Questions
- Previous Year Questions Questions
- Programming Concept Questions
- Python Questions
- Shell Scripting Questions
- Software Engineering and Web Technology Questions
- SQL Questions
- String Manipulation Questions
- TCP IP and OSI Questions