Object-oriented Programming Quiz Questions And Answers

Reviewed by Godwin Iheuwa
Godwin Iheuwa, MS, Computer Science |
Computer Expert
Review Board Member
Godwin is a proficient Database Administrator currently employed at MTN Nigeria. He holds as MS in Computer Science from the University of Bedfordshire, where he specialized in Agile Methodologies and Database Administration. He also earned a Bachelor's degree in Computer Science from the University of Port Harcourt. With expertise in SQL Server Integration Services (SSIS) and SQL Server Management Studio, Godwin's knowledge and experience enhance the authority of our quizzes, ensuring accuracy and relevance in the realm of computer science.
, MS, Computer Science
Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Techtween
T
Techtween
Community Contributor
Quizzes Created: 1 | Total Attempts: 46,238
Questions: 12 | Attempts: 46,828

SettingsSettingsSettings
Object-oriented Programming Quiz Questions And Answers - Quiz

Get ready for an Object-oriented programming quiz. Welcome to a whole new test on object-oriented programming. The OOP paradigm of programming has changed how programmers used to look at problems. This paradigm of programming primarily focuses on "objects" rather than functions, so it is way too effective in solving real-world problems. This quiz comprises different questions of the concepts of the same with different levels of toughness. So, let's begin.


Object-Oriented Programming Questions and Answers

  • 1. 

    The method with the same name or different return type and difference in the parameters either in number or type is known as:

    • A.

      Function overloading

    • B.

      Compile Time Overloading

    Correct Answer
    A. Function overloading
    Explanation
    The method with the same name but with different parameters (either in number or type) is known as function overloading. This allows a class to have multiple methods with the same name but different parameter lists, and the appropriate method is called based on the arguments passed during the method invocation. The term "Compile Time Overloading" is also correct, as function overloading is resolved at compile time. So, both A and B are correct in this context.

    Rate this question:

  • 2. 

    To call a base class constructor in a derived class, it is needed to call the base class initializer.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In most object-oriented programming languages, when you create a derived class (subclass), and you want to call the constructor of its base class (superclass), you typically need to invoke the base class constructor using the base class initializer. This is usually done using the super() keyword in languages like Java or the base() keyword in languages like C#.

    Rate this question:

  • 3. 

    Can objects of abstract classes be instantiated?

    • A.

      Yes

    • B.

      No

    Correct Answer
    B. No
    Explanation
    Objects of abstract classes cannot be instantiated because abstract classes are incomplete and cannot be fully implemented. They are designed to be extended by subclasses, which provide the missing implementation details. Therefore, attempting to create an object of an abstract class would result in a compilation error.

    Rate this question:

  • 4. 

    The process by which one object can acquire the properties of another object:

    • A.

      Encapsulation

    • B.

      Inheritance

    • C.

      Polymorphism

    Correct Answer
    B. Inheritance
    Explanation
    Inheritance is the process by which one object can acquire the properties of another object. It allows a class to inherit the attributes and methods of another class, known as the parent or base class. This promotes code reusability and helps in creating a hierarchical relationship between classes. The child class can access and use the methods and variables of the parent class, and also add its own unique features. Inheritance is an essential concept in object-oriented programming and facilitates the organization and structuring of code.

    Rate this question:

  • 5. 

    Constructors are used to:

    • A.

      To build a user interface.

    • B.

      Free memory.

    • C.

      Initialize a newly created object.

    • D.

      To create a sub-class.

    Correct Answer
    C. Initialize a newly created object.
    Explanation
    Constructors are special methods in object-oriented programming that are used to initialize a newly created object. They are called automatically when an object is created and are responsible for setting initial values for the object's attributes. By initializing the object, constructors ensure that it is in a valid and usable state from the moment it is created. Constructors are not used to build a user interface, free memory, or create a sub-class.

    Rate this question:

  • 6. 

    An object that has more than one form is referred to as:

    • A.

      Inheritance

    • B.

      Interface

    • C.

      Abstract class

    • D.

      Polymorphism

    Correct Answer
    D. Polymorphism
    Explanation
    Polymorphism refers to the ability of an object to take on different forms or has different behaviors. In object-oriented programming, polymorphism allows objects of different classes to be treated as objects of a common superclass. This means that a single method can be used to perform different actions depending on the type of object it is called on. Polymorphism promotes code reusability and flexibility, as it allows for the creation of generic code that can be applied to multiple objects with different forms or behaviors.

    Rate this question:

  • 7. 

    Information Hiding can also be termed as:

    • A.

      Data hiding

    • B.

      Encapsulation

    • C.

      Inheritance

    Correct Answer
    A. Data hiding
    Explanation
    Information hiding can also be termed as Data hiding. It refers to the practice of restricting access to certain details of an object and only revealing what is necessary for the functioning of the object. This concept is often associated with encapsulation, where the implementation details of an object are hidden from the outside world, and only the necessary interfaces are exposed. However, information hiding specifically emphasizes the concealment of data details, ensuring that the internal representation of data is not directly accessible from outside the object.

    Rate this question:

  • 8. 

    Pick the term that relates to polymorphism:

    • A.

      Dynamic binding

    • B.

      Dynamic allocation

    • C.

      Static typing

    • D.

      Static allocation

    Correct Answer
    A. Dynamic binding
    Explanation
    Dynamic binding refers to the process of determining the specific implementation of a method or function at runtime, based on the actual type of the object or variable it is being called on. This allows for the implementation to be selected dynamically, enabling polymorphism. Polymorphism is the ability of an object to take on many forms, where different objects can be treated as instances of a common superclass, and methods can be called on them based on their individual implementations. Therefore, dynamic binding is closely related to polymorphism as it allows for the flexibility and versatility of objects in object-oriented programming.

    Rate this question:

  • 9. 

    Main method can be overridden:

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The main method in Java is a special method that serves as the entry point for a Java program. It cannot be overridden because it is a static method and cannot be inherited. The main method is declared with a specific signature and is called by the Java Virtual Machine (JVM) to execute the program. Therefore, it is not possible to override the main method in Java.

    Rate this question:

  • 10. 

    The keyword that is used to access the method or member variables from the superclass:

    • A.

      Super

    • B.

      Using

    • C.

      Is_a

    • D.

      Has_a

    Correct Answer
    A. Super
    Explanation
    The keyword "super" is used to access the method or member variables from the superclass. It is used when a subclass wants to refer to a method or variable that it has inherited from its superclass. By using the "super" keyword, the subclass can call the superclass's version of the method or access its variables. This allows for code reuse and helps in implementing inheritance in object-oriented programming.

    Rate this question:

  • 11. 

    What modifiers are allowed for methods in an Interface? (choose one or more answers)

    • A.

      Public

    • B.

      Private

    • C.

      Abstract

    Correct Answer(s)
    A. Public
    C. Abstract
    Explanation
    Methods in an interface can only have the "public" and "abstract" modifiers. The "public" modifier allows the method to be accessed from other classes, while the "abstract" modifier indicates that the method does not have a body and must be implemented by any class that implements the interface. The "private" modifier is not allowed because it restricts access to the method and would contradict the purpose of an interface, which is to define a contract for implementing classes.

    Rate this question:

  • 12. 

    When sub class declares a method that has the same type of arguments as a method declared by one of its superclasses, it is termed as:

    • A.

      Method overriding

    • B.

      Method overloading

    • C.

      Operator overloading

    • D.

      Operator overriding

    Correct Answer
    A. Method overriding
    Explanation
    Method overriding occurs when a subclass declares a method that has the same type of arguments as a method declared by one of its superclasses. This allows the subclass to provide its own implementation of the method, which overrides the implementation in the superclass. This is a fundamental concept in object-oriented programming, as it allows for polymorphism and the ability to have different behavior for the same method in different subclasses.

    Rate this question:

Godwin Iheuwa |MS, Computer Science |
Computer Expert
Godwin is a proficient Database Administrator currently employed at MTN Nigeria. He holds as MS in Computer Science from the University of Bedfordshire, where he specialized in Agile Methodologies and Database Administration. He also earned a Bachelor's degree in Computer Science from the University of Port Harcourt. With expertise in SQL Server Integration Services (SSIS) and SQL Server Management Studio, Godwin's knowledge and experience enhance the authority of our quizzes, ensuring accuracy and relevance in the realm of computer science.

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 13, 2024
    Quiz Edited by
    ProProfs Editorial Team

    Expert Reviewed by
    Godwin Iheuwa
  • Sep 15, 2011
    Quiz Created by
    Techtween

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.