Basic Concepts of Object Oriented Programming OOP MCQs

B. Programming
C. Both A and B
D. None of These

Explanation : Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which can contain data and functions. Data describe the properties or inforamation about object whereas functions depicts the behaviour of the object.

A. Java
B. C++
C. SmallTalk
D. Kotlin

ANSWER: C) SmallTalk
Explanation : Smalltalk was the first purely object oriented programming language developed

A. Encapsulation
B. Inheritance
C. Polymorphism
D. None of These

ANSWER: A) Encapsulation
Explanation : Encapsulation is a language feature that packages attributes and behaviors into a single unit. That is, data and methods comprise a single entity.

A. Parent of an object
B. Instance of an object
C. Blueprint of an object
D. Scope of an object

ANSWER: C) Blueprint of an object
Explanation : A class is a template, or blueprint, from which objects are created. A class includes both data members as well as functions to manipulate that data.

D. All of these

ANSWER: D) All of these
Explanation : An object is a representation or an abstraction of some entity such as a car, a soda machine, an ATM machine, a slot machine, a dog, a person, a house, a string of twine, a string of characters, a bank account, a pair of dice, a deck of cards, a point in the plane, a TV, a DVD player, an iPod, a rocket, an elevator, a square, a rectangle, a circle, a camera, a movie star, a shooting star, a computer mouse, a live mouse, a phone, an airplane, a song, a city, a state, a country, or a computer window.

A. Encapsulation
B. Inheritance
C. Polymorphism
D. Information hiding

ANSWER: D) Information hiding
Explanation : Every object hides its state and show through behavior . This concept is known as Information Hiding. Information hiding states “Show only those details to the outside world which are necessary for the outside world and hide all other details from the outside world.” Information hiding is one of the most important principles of OOP inspired from real life which says that all information should not be accessible to all persons. Private information should only be accessible to its owner.

A. Alan Kay
B. Andrea Ferro
C. Dennis Ritchie
D. Adele Goldberg

ANSWER: A) Alan Kay
Explanation : Alan Kay is formar inventor of OOP, Andrea Ferro and Adele Goldberg was a part of SmallTalk Development team. Dennis invented C++. Alan actually had got rewarded for OOP invention.

A. Data members
B. Member functions
C. Static data allowed
D. Public access specifier

ANSWER: B) Member functions
Explanation : Class Provide function to manipulate data members. Theses member function are not a part of structures.

A. Code reusability
B. Modularity
C. Duplicate/Redundant data
D. Efficient Code

ANSWER: C) Duplicate/Redundant data
Explanation : OOP promotes code reusibility and eliminate Duplicate/Redundant data. Code reusability is done using inheritance. Modularity is supported by using different code files and classes.

A. True
B. False
C. May be
D. None of these

ANSWER: B) False
Explanation : OOP mainly depends on the concept of class. For pure OOP implimentation everything must be an object and objects are instantiated with the help of a class.

A. Polymorphism
B. Abstraction
C. Encapsulation
D. Inheritance

ANSWER: D) Inheritance
Explanation : Inheritance illusterated the reuse of code already written and also can avoid creation of many new functions or variables, as that can be done one time and be reused, using classes.

A. C++
B. Java
C. Kotlin
D. Small Talk

Explanation : Jave does not support multiole inheritance so we can say JAVA does not support all 4 types of inheritance.

A. Only 1
B. Only 100
C. Only 999
D. As many as you want

ANSWER: D) As many as you want
Explanation : These is no limit on number of classes in OOP. You can write as many classes as you need.

A. 1970’s
B. 1980’s
C. 1993
D. 1995

ANSWER: A) 1970’s
Explanation : OOP was firstly intrduced in 1970’s by Alan and his team. Later it was used by some programming languages and got implemented successfully.

A. It supports usual declaration of primitive data types
B. It doesn’t support all types of inheritance
C. It allows code to be written outside classes
D. It does not support pointers

ANSWER: A) It supports usual declaration of primitive data types
Explanation : As Java supports usual declaration of data variables, it is partial implementation of OOP. Because according to rules of OOP, object constructors must be used, even for declaration of variables.

A. Code can be written without using classes
B. Code must contain at least one class
C. A class must have member functions
D. At least one object should be declared in code

ANSWER: B) Code must contain at least one class
Explanation : In C++, it’s not necessary to use classes, and hence codes can be written without using OOP concept. Classes may or may not contain member functions, so it’s not a necessary condition in C++. And, an object can only be declared in a code if its class is defined/included via header file.

A. iostream.h
B. stdio.h
C. stdlib.h
D. OOP can be used without using any header file

ANSWER: D) OOP can be used without using any header file
Explanation : OOP can be implimented without using any header file. Because OOP depends on concept of classes not header files.

A. Inheritance and Encapsulation
B. Encapsulation and Polymorphism
C. Encapsulation and Information Hiding
D. Abstraction and Polymorphism

ANSWER: C) Encapsulation and Information Hiding
Explanation : Encapsulation and Information hiding are two interrelated concepts.

A. Use of this pointer
B. Use of pointers
C. Use of pass by value
D. Use of parameterized constructor

ANSWER: A) Use of this pointer
Explanation : this pointer is used to call own data and methods of an object whenever needed. This helps us call the members of an object recursively, and differentiate the variables of different scopes.

A. Simplicity
B. Clarity
C. Better Understanding
D. All of the given

ANSWER: D) All of the given
Explanation : Encapsulation is one of the major concepts of the OOP. It states that an object should combine all its attributes (data members) and behaviours (methods) in a single unit. It provides simplicity and clarity, Reduces complexity and ease of understanding.