0% found this document useful (0 votes)
35 views

QB Oop ct1 2020

This document contains a question bank on object-oriented programming concepts for SYCO1/CO2. It includes 30 multiple choice questions covering topics like loops, operators, variables, object-oriented languages, if/else statements, arrays, classes, constructors, destructors, inheritance, and polymorphism. The questions are designed to test fundamental OOP concepts in C++.

Uploaded by

Blaise D'silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

QB Oop ct1 2020

This document contains a question bank on object-oriented programming concepts for SYCO1/CO2. It includes 30 multiple choice questions covering topics like loops, operators, variables, object-oriented languages, if/else statements, arrays, classes, constructors, destructors, inheritance, and polymorphism. The questions are designed to test fundamental OOP concepts in C++.

Uploaded by

Blaise D'silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

2020-2021

QUESTION BANK(OOP)
SYCO1/CO2

1> Loop control structure is also called a


a) Non repetitive control structure
b)Sequence control structure
c)repetitive control structure
d)Decision control structure
Answer- c
2>In C++ ______ can be achieved either at compile-time or at run-time.
a) Inheritance
b) Encapsulation
c) Polymorphism
d) None of the above
Answer : c
3>Operator % in C++ language is called?
a) Percentage Operator
b) Quotient Operator
c) Modulus
d) Division
Answer : c
4>Which of the statement we need to write , in order to check any condition.
a) if
b) break
c) continue
d) exit
Answer : a
5> Variables in C++ can be declared in which different places?
a) Inside function
b) In the definition of function parameter
c) Outside of all the functions
d) All of the above
Answer d
6>_____________ are two Object-Oriented(OO) languages which are designed for
making simulations.
a) Python & JAVA
b) Swift & Kotlin
c) Simula-67 & Smalltalk
d) None of the above
Ans c) Simula-67 & Smalltalk
7> When one statement contains another if statement then the statement is called as _________.
a) if statement
b) if-else statement
c) Nested if statement
d) Nested if-else statement
Answer: c)
8> While loop is also called as ?
a)Entry controlled loop
b)Exit controlled loop
c)Both A and B
d)None of these
Answe a
9> How many times is a do while loop guaranteed to loop?

a) a)0
b) Infinitely
c) 1
d) Variable
answer c

10> The static member functions __________________


a) Have access to all the members of a class
b) Have access to only constant members of a class
c) Have access to only the static members of a class
d) Have direct access to all other class members also
Answer: c
11>Which rule will not affect the friend function?
a) private and protected members of a class cannot be accessed from outside
b) private and protected member can be accessed anywhere
c) protected member can be accessed anywhere
d) private member can be accessed anywhere
Answer: a
12>What is an array of objects?
a) An array of instances of class represented by single name
b) An array of instances of class represented by more than one name
c) An array of instances which have more than 2 instances
d) An array of instances which have different types
Answer: a
13>Which among the following is a mandatory condition for array of objects?
a) All the objects should be of different class
b) All the objects should be of same program classes
c) All the objects should be of same class
d) All the objects should have different data
Answer: c
14>Which among the following is called first ,automatically ,whenever an object is created ?
a) Class
b) Constructor
c) New
d) Trigger
answer-b)
15> What is a copy constructor?
a) A constructor that allows a user to move data from one object to another
b) A constructor to initialize an object with the values of another object
c) A constructor to check the whether to objects are equal or not
d) A constructor to kill other copies of a given object.
Answer-b)
16> Why constructors are efficient instead of a function init() defined by the user to initialize the
data members of an object?
a) Because user may forget to call init() using that object leading segmentation fault
b) Because user may call init() more than once which leads to overwriting values
c) Because user may forget to define init() function
d) All of the mentioned
Answer-d)
17> .How many parameters does a default constructor require?
a) 1
b) 2
c) 0
d) 3
Answer-c)
18> What is syntax of defining a destructor of class A?
a) A(){}
b) ~A(){}
c) A::A(){}
d) ~A(){};
Answer-b)
19> What is the role of destructors in Classes?
a) To modify the data whenever required
b) To destroy an object when the lifetime of an object ends
c) To initialize the data members of an object when it is created
d) To call private functions from the outer world
answer-b)
20>Why do we use constructor overloading?
a) To use different types of constructors
b) Because it’s a feature provided
c) To initialize the object in different ways
d) To differentiate one constructor from another
Ans – c) To initialize the object in different ways

21>Which among the following best describes the constructors?


a) A function which is called whenever an object is referenced
b) A function which is called whenever an object is created to initialize the members
c) A function which is called whenever an object is assigned to copy the values
d) A function which is called whenever an object is to be given values for members
Ans - b) A function which is called whenever an object is created to initialize the
members

22>Which among the following best describes the destructor?


a) A function which is called just before the objects are destroyed
b) A function which is called after each reference to the object
c) A function which is called after termination of the program
d) A function which is called before calling any member function
ans- a) A function which is called just before the objects are destroyed
23>What is the role of a constructor in classes?
a) To modify the data whenever required
b) To destroy an object
c) To initialize the data members of an object when it is created
d) To call private functions from the outer world
Ans- c) To initialize the data members of an object when it is created
24>What is a copy constructor?
a) A constructor that allows a user to move data from one object to another
b) A constructor to initialize an object with the values of another object
c) A constructor to check the whether to objects are equal or not
d) A constructor to kill other copies of a given object.
Ans - b) A constructor to initialize an object with the values of another object
25>What is the role of destructors in Classes?
a) To modify the data whenever required
b) to destroy an object when the lifetime of an object ends
c) To initialize the data members of an object when it is created
d) to call private functions from the outer world.
ans - b) to destroy an object when the lifetime of an object ends

26>If a derived class object is created, which constructor is called first?


a) Base class constructor
b) Derived class constructor
c) Depends on how we call the object
d) Not possible
Ans - a) Base class constructor
27>Which among the following best describes the inheritance?
a) Copying the code already written once
b) Using the code already written
c) Using already defined functions in programming language
d) Using the data and functions into derived segment
Ans- d) Using the data and functions into derived segment
28>Capability of one class to acquire properties and characteristics from another class.
a) Constructor
b) Inheritance
c) Virtual Function
d) Destructor
Ans-b) Inheritance

29>___________ constructor are always called in the derived class Constructor.


a) Sub class
b) Super class
c) Child class
d) Base class
Ans- d) Base class

30>Multiple derived classes inherits from single base classes


a) Multiple Inheritance
b) Multilevel Inheritance
c) Hierarchical Inheritance
d) Hybrid Inheritance
Ans- c) Hierarchical Inheritance

---------------------------------------------ALL THE BEST----------------------------------------------------------------------------

You might also like