0% found this document useful (0 votes)
47 views28 pages

Oops Paper

The document contains a list of 50 questions related to object-oriented programming concepts. The questions cover topics like encapsulation, inheritance, polymorphism, abstraction, constructors, access specifiers, and other OOP concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views28 pages

Oops Paper

The document contains a list of 50 questions related to object-oriented programming concepts. The questions cover topics like encapsulation, inheritance, polymorphism, abstraction, constructors, access specifiers, and other OOP concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 28

SR.NO.

QUESTION
1 Which of the following is true about encapsulation in object-oriented programming?
2 What is inheritance in object-oriented programming?
3 What is polymorphism in object-oriented programming?
4 Which of the following statements is true about abstraction in object-oriented programming?
5 What is a constructor in object-oriented programming?
6 Who invented OOP?
7 Which is not a feature of OOP in general definitions?
8 Which was the first purely object oriented programming language developed?
9 When OOP concept did first came into picture?
10 Which feature of OOP indicates code reusability?
11 Which header file is required in C++ to use OOP?
12 Which among the following doesn’t come under OOP concept?
13 The feature by which one object can interact with another object is _____________
14 How many types of access specifiers are provided in OOP (C++)?
15 What is encapsulation in OOP?
16 Which of the following is not true about polymorphism?
17 What is an abstraction in object-oriented programming?
18 Which among the following can show polymorphism?
19 In which access should a constructor be defined, so that object of the class can be created in any function?
20 The copy constructors can be used to ________
21 Which among the following represents correct constructor?
22 What happens when an object is passed by reference?
23 Which access specifier is usually used for data members of a class?
24 How to access data members of a class?
25 Which feature of OOP reduces the use of nested classes?
26 Which keyword among the following can be used to declare an array of objects in java?
27 Which operator can be used to free the memory allocated for an object in C++?
28 Which of the following is not a property of an object?
29 Which type of members can’t be accessed in derived classes of a base class?
30 Single level inheritance supports _____________ inheritance.
31 Which keyword is used to declare virtual functions?
32 What happens if non static members are used in static member function?
33 What is friend member functions in C++?
34 Where is the memory allocated for the objects?
35 Encapsulation and abstraction differ as ____________
36 Which feature of OOP is exhibited by the function overriding?
37 How to access the private member function of a class?
38 Which is correct syntax for declaring pointer to object?
39 If data members are private, what can we do to access them from the class object?
40 Which among the following is not a necessary condition for constructors?
41 Object being passed to a copy constructor ___________
42 Instance of which type of class can’t be created?
43 ___________ underlines the feature of Polymorphism in a class.
44 Which feature in OOP is used to allocate additional functions to a predefined operator in any language?
45 Which feature can be implemented using encapsulation?
46 If the members have to be accessed from anywhere in the program and other packages also, which access specifi
47 Which among the following have least security according to the access permissions allowed?
48 How many public class(s) (outermost) can be there in a java program?
49 Which specifier can be used to inherit protected members as protected in subclass but public as public in subclass
50 In multi-level inheritance(all public), the public members of parent/superclass will ________
51 What is the additional feature in classes that was not in structures?
____ is considered to be a partitioned area of computer memory that stores and set of operations that can
52 access the data.
53 Which among the following best defines the abstract methods?
54 Which among the following is correct?
55 The abstract function definitions in derived classes is enforced at _________
56 Which of these specifiers would be applied to the constructors only?
57 The access specifier that is/are the most secure during inheritance is/are _______________.
58 A derived class is also called a ______________.
59 Hierarchical inheritance could be some subset of _________________ inheritance.
What is the name of the feature in which we enforce the definitions of the abstract function at the
60 compile time?
61 Which of these types of values result from a delete operator?
62 Which function is used to get any character that is present at a certain index of a string?
63 What is a delete operator?
64 Does delete return any value?
65 If delete is used to delete an object which was not allocated using new _______________
66 Delete operator _________________
67 Which is the correct syntax to delete an array of objects?
68 Which of the following type of class allows only one object of it to be created?
69 Which of the following is not a type of constructor?
70 Which of the following is not the member of class?
71 Which of the following concepts means determining at runtime what method to invoke?
72 Identify the scope resolution operator?
73 Which keyword should be used to declare static variables?
74 What do you call the languages that support classes but not polymorphism?
75 Which type of function among the following shows polymorphism?
76 Which among the following can’t be used for polymorphism?
77 How many types of member functions are generally there in C++?
78 What are inline member functions?
79 Static member functions _____________
80 Member function of a class can ____________
What is the name of the feature in which we enforce the definitions of the abstract function at the
compile time?
a. Dynamic Polymorphism
b. Static Polymorphism
c. Dynamic or Static Polymorphism according to need
d. Polymorphism
A
Encapsulation ensures data hiding and abstraction
The process of hiding the implementation details of an object
The ability of an object to take multiple forms
Abstraction ensures data hiding and inheritance
A method used to destroy objects
Andrea Ferro
Efficient Code
Kotlin
1980’s
Abstraction
OOP can be used without using any header file
Data hiding
Message reading
4
It is a way of combining various data members and member functions that operate on those data members into a single unit
Helps in redefining the same functionality
Hiding the implementation and showing only the features
Overloading &&
Any access specifier will work
Copy an object so that it can be passed to another primitive type variable
–classname()
Destructor is called at end of function
Protected
Dot, arrow or direct call
Inheritance
allocate
Unallocate
Properties
All can be accessed
Language independency
virt
Executes fine
Non-member functions which have access to all the members (including private) of a class
Cache
Hiding and hiding respectively
Polymorphism
Using class address
*className objectName;
Private data members can never be accessed from outside the class
Its name must be same as that of class
Must not be mentioned in parameter list
Parent class
Virtual Function
Function Overloading
Polymorphism
Public
Private
1
Private
Will continue to get inherited subsequently
Data members

Classes
Functions declared and defined in base class
Abstract functions should not be defined in all the derived classes
Runtime
a. Explicit
a. Protected
a. Small class
a. Multilevel

a. Dynamic Polymorphism
a. null
a. char charIn(StringName);
Deallocates a block of memory
Yes, positive value
Then out of memory error arises
Can be used on pointers with null value
delete [] objectName;
Virtual class
Copy constructor
Static function
Data hiding
#
const
Class based language
Inline function
Static member functions
2
Member functions which can be called without object
Contains “this” pointer for data members
Access all the members of the class
B
Encapsulation is used to achieve inheritance
The process of creating new classes using existing classes
The process of hiding the implementation details of an object
Abstraction is not related to data hiding
A method used to copy objects
Adele Goldberg
Code reusability
SmallTalk
1995
Polymorphism
stdlib.h
Message passing
Message Passing
3
It is a way of combining various data members and member functions into a single unit which can operate on any data
Increases overhead of function definition always
Hiding the important data
Overloading <<
Private
Copy an object for type casting
classname()
Destructor is called when called explicitly
Private
Dot operator
Binding
arr
Free()
Names
Protected
Multiple inheritance
virtually
Compile time error
Member function which doesn’t have access to private members
ROM
Binding and Hiding respectively
Encapsulation
Using object of class
className* objectName;
Create public member functions to access those data members
It must not have any return type
Must be passed with integer type
Abstract class
Inline function
Function Overriding
Overloading
Private
Default
2
Default
Will not be inherited after one subclass inheritance
Member functions

Objects
Functions only declared in base class
Abstract functions should be defined only in one derived class
Compile time
b. Implicit
b. Private
b. Subclass
b. Single level

b. Static Polymorphism
b. null pointer
b. char charAt(index);
Deallocates whole program memory
Yes, negative value
Then unreachable code error arises
Can be used on pointers with void value
delete * objectName;
Abstract class
Friend constructor
Friend function
Dynamic Typing
()
common
Procedure Oriented language
Virtual function
Member functions overloading
3
Member functions whose definition is expanded in place of its call
Contains “this” pointer if used for member functions
Access only Public members of the class
Which among the following have least security according to the access permissions allowed?
a) Private
Default
c) Protected
d) Public
1. ____ is considered to be a partitioned area of computer memory that stores and set of operations that
can access the data.
C
Encapsulation is not related to data hiding
The process of making data and methods private within a class
The process of creating multiple instances of a class
Abstraction hides the implementation details of an object and only shows the necessary features
A special method used to initialize objects
Alan Kay
Modularity
Java
1970’s
Encapsulation
iostream.h
Platform independent
Data transfer
2
It is a way of combining various data members into a single unit
It is feature of OOP
Hiding the implementation
Overloading ||
Public
Copy an object so that it can be passed to a function
()classname
Destructor is not called
Public
Arrow operator
Abstraction
new
Collect
Identity
Private
Compile time
virtual
Executes if that member function is not used
Member function which can modify any data of a class
HDD
Hiding and Binding respectively
Abstraction
Using object pointer
className objectName();
Create private member functions to access those data members
It must contain a definition body
Must be passed by value
Anonymous class
Enclosing class
Operator Overloading
Inheritance
Protected
Protected
3
Public
Will not be available to be called outside class
Static data allowed

Variables
Function which may or may not be defined in base class
Abstract functions must be defined in base class
Writing code time
c. Protected
c. Private and Default
c. Noticeable class
c. Multiple

c. Dynamic or Static Polymorphism according to need


c. void pointer
c. char charIn(index);
Deallocates only primitive data memory
Yes, zero value
Then unpredictable errors may arise
Can be used on pointer with value 0
objectName[] delete;
Singleton class
Default constructor
Const function
Dynamic binding
::
static
Object-based language
Undefined functions
Predefined operator overloading
4
Member functions whose definition is faster than simple function
Doesn’t contain “this” pointer
Access only the private members of the class
Instance of which type of class can’t be created?
a) Parent class
b) Abstract class
Anonymous class
d) Nested class
D Answer
Encapsulation is only used for method overloading A
The process of creating multiple instances of a class D
The process of creating new classes using existing classes A
Abstraction is only used for encapsulation A
A method used to define the behavior of objects C
Dennis Ritchie C
Duplicate/Redundant data D
C++ B
1993 C
Inheritance D
stdio.h C
Data binding C
Data Binding B
1 B
It is a way of combining various member functions into a single unit A
Ease in readability of program B
Showing the important data A
Overloading += B
Protected C
Copy an object so that it can be passed to a class C
~classname() D
Destructor is called when function is out of scope C
Default B
Dot or arrow as required D
Encapsulation A
create C
delete D
Attributes B
Public C
Runtime D
anonymous C
Runtime error B
Member function which can access all the members of a class A
RAM D
Can be used any way B
Inheritance A
Using address of member function D
className objectName; B
Create protected member functions to access those data members B
It can contains arguments C
Must be passed by reference D
Nested class B
Nested class A
Operator Overriding C
Abstraction D
Default A
Public D
As required C
Protected C
Will not be able to allocated with any memory space A
Public access specifier B

Functions B
Function which must be declared in derived class B
Abstract functions must be defined in all the derived classes D
Interpreting time B
d. Public A
d. Default B
d. Big class B
d. Hybrid D

d. Polymorphism A
d. void D
d. char charAt(StringName); B
Deallocates all the data reserved for a class A
No D
Then undefined variable error arises C
Can be used on pointer with any value C
delete objectName[]; A
Friend class C
Parameterized constructor B
Virtual function C
Dynamic loading C
&& C
stat C
If classes are supported, polymorphism will always be supported C
Class member functions B
Constructor overloading A
5 D
Member function which is defined in single line B
Doesn’t contain “this” pointer if member functions are referred C
Access subclass members A
Objects are the variables of the type ____?

A. String
B. Boolean
C. Class
D. All data types can be included
SR.NO. QUESTION A B C D Answer

1 Who invented OOP?


2 a) Andrea Ferro
3 b) Adele Goldberg
4 c) Alan Kay
5 d) Dennis Ritchie
6
7 Which is not a feature of OOP in general definitions?
8 a) Efficient Code
9 b) Code reusability
10 c) Modularity
11 d) Duplicate/Redundant data
12
13 Which was the first purely object oriented programming language developed?
14 a) Kotlin
15 b) SmallTalk
16 c) Java
17 d) C++
18
19 b) The process of creating new classes using existing classes
20
21 What is polymorphism in object-oriented programming?
22 a) The ability of an object to take multiple forms
23 b) The process of hiding the implementation details of an object
24 c) The process of creating multiple instances of a class
25 d) The process of creating new classes using existing classes
26 a) The ability of an object to take multiple forms
27 Answer:
28 a) The ability of an object to take multiple forms
29
30
31 What happens if non static members are used in static member function?
32 a) 1980’s
33 b) 1995
34 c) 1970’s
35 d) 1993
36
37 Which feature of OOP indicates code reusability?
38 a) Abstraction
39 b) Polymorphism
40 c) Encapsulation
41 d) Inheritance
42
43 Which header file is required in C++ to use OOP?
44 a) OOP can be used without using any header file
45 b) stdlib.h
46 c) iostream.h
47 d) stdio.h
48
49 Which among the following doesn’t come under OOP concept?
50 a) Data hiding
51 ____ is considered to Classes Objects Variables Functions b
52 c) Platform independent b
53 d) Data binding d
54 b
55 The feature by which one object can interact with another object is _ a
56 a) Message reading b
57 b) Message Passing b
58 c) Data transfer d
59 d) Data Binding a
60
61 What is an abstraction in object-oriented programming?
62 a) Hiding the implementation and showing only the features
63 b) Hiding the important data
64 c) Hiding the implementation
65 d) Showing the important data
66
67 Which among the following can show polymorphism?
68 a) Overloading &&
69 b) Overloading <<
70 c) Overloading ||
71 d) Overloading +=
72
73 In which access should a constructor be defined, so that object of the class can be created in any function?
74 a) Any access specifier will work
75 b) Private
76 c) Public
77 d) Protected
78
79
80
Instance of which type of class can’t be created?
a) Parent class
b) Abstract class
c) Anonymous class
d) Nested class

Which among the following have least security according to the access permissions allowed?
a) Private
b) Default
c) Protected

Objects
are the
variables
of the
d) Public type ____?

A. String

B.
Boolean
C. Class

D. All
data
types
can be
included
1. ____ is
considere
d to be a
partition
ed area
of
computer
memory
that
stores
and set
of
operation
s that can
access
the data.
What is the name
of the feature in
which we enforce
the definitions of
the abstract
function at the
compile time?
a. Dynamic
Polymorphism
b. Static
Polymorphism
c. Dynamic or
Static
Polymorphism
according to need
d. Polymorphism
any function?
the access permissions allowed?
Which
function is
Which of used to
these get any
types of character
values that is
result present at
from a a certain
delete index of a
operator? string? What is a delete operator? Does delete return any value?

a. char
charIn(Str
ingName)
a. null ; a) Deallocates a block of memory a) Yes, positive value
b. char
b. null charAt(ind
pointer ex); b) Deallocates whole program memory b) Yes, negative value
c. char
c. void charIn(ind
pointer ex); c) Deallocates only primitive data memory c) Yes, zero value

d. char
charAt(Str
ingName)
d. void ; d) Deallocates all the data reserved for a class d) No

Delete operator _________________ Which is the correct syntax to delete an array of objects?
a) Can be used on pointers with null value a) delete [] objectName;

b) Can be used on pointers with void value b) delete * objectName;

c) Can be used on pointer with value 0 c) objectName[] delete;

d) Can be used on pointer with any value d) delete objectName[];


What do you call the languages that support classes but not polymorphism?
a) Class based language

b) Procedure Oriented language

c) Object-based language

d) If classes are supported, polymorphism will always be supported

How many types of member functions


Which type of function among the following shows polymorphism? a) 2
a) Inline function b) 3
b) Virtual function c) 4
c) Undefined functions d) 5
d) Class member functions
Member function of a class can ____________
a) Access all the members of the class
b) Access only Public members of the class
c) Access only the private members of the class
d) Access subclass members
If delete is used to delete an object which was not allocated using new _______________

a) Then out of memory error arises

b) Then unreachable code error arises

c) Then unpredictable errors may arise

d) Then undefined variable error arises

Which of Which of Which of Which of


the the the the
following following is following is following
type of not a type not the concepts
class of member of means
allows only constructor class? determinin
one object ? g at
of it to be runtime
created? what
method to The
following
invoke? program
fragment Which keyword should be used to declare static variable
A
constructor
Virtual Copy Static void main is called
class constructor function Data hiding ( ) whenever a) const
A. an object is
declared
Abstract Friend Friend Dynamic
class constructor function Typing { b) common
B. an object is
used
Singleton Default Const Dynamic
class constructor function binding int x=10; c) static
C. a class is
declared
Parameteri
Friend zed Virtual Dynamic
class constructor function loading int &p=x; d) stat
cout << &p D. a class is
<< &x; used
}
A. prints 10 and
the address
of x
B. prints the
address of p
twice
C. prints the
address of x
twice
D. Both (b) &
types of member functions
Which among the following can’t be (c)
a) Static member functions
b) Member functions overloading What are inline member functions?
c) Predefined operator overloading a) Member functions which can be called without object
d) Constructor overloading b) Member functions whose definition is expanded in place of its call
c) Member functions whose definition is faster than simple function
lass can ____________ d) Member function which is defined in single line
bers of the class Static member functions _____________
members of the class a) Contains “this” pointer for data members
ate members of the class b) Contains “this” pointer if used for member functions
c) Doesn’t contain “this” pointer
d) Doesn’t contain “this” pointer if member functions are referred
be used to declare static variables?
called without object
on is expanded in place of its call
on is faster than simple function
d in single line

You might also like