Sei sulla pagina 1di 7

16CS201 - OBJECT ORIENTED PROGRAMMING

SNS COLLEGE OF TECHNOLOGY


COIMBATORE – 35

DEPARTMENT OF INFORMATION TECHNOLOGY

Second Year, 3rd Semester

Multiple Choice Questions(MCQ)


Subject Code & Name: 16CS201 Object Oriented Programming

Prepared by : Mr.C.Senthil Kumar AP/IT

UNIT I
INTRODUCTION

1. Which of the following best defines a class?


a) Parent of an object
b) Instance of an object
c) Blueprint of an object
d) Scope of an object

Answer: b
2. What is the additional feature in classes that was not in structures?
a) Data members
b) Member functions
c) Static data allowed
d) Public access specifier

Answer: b
3. Which Feature of OOP illustrated the code reusability?
a) Polymorphism
b) Abstraction
c) Encapsulation
d) Inheritance

Answer: d
4. Which concept of OOP is false for C++?
a) Code can be written without using classes

SNSCT- Department of Information Technology (IT) Page 1


16CS201 - OBJECT ORIENTED PROGRAMMING

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
5. Which header file is required in C++ to use OOP?
a) iostream.h
b) stdio.h
c) stdlib.h
d) OOP can be used without using any header file

Answer: d
6. Which of the two features match each other?
a) Inheritance and Encapsulation
b) Encapsulation and Polymorphism
c) Encapsulation and Abstraction
d) Abstraction and Polymorphism

Answer: c
7. Class is pass by _______
a) Value
b) Reference
c) Value or Reference, depending on program
d) Copy

Answer: b
8. What is default access specifier for data members or member functions declared
within a class without any specifier, in C++ ?
a) Private
b) Protected
c) Public
d) Depends on compiler
Answer: a

SNSCT- Department of Information Technology (IT) Page 2


16CS201 - OBJECT ORIENTED PROGRAMMING

9. Size of a class is :
a) Sum of size of all the variables declared inside the class
b) Sum of size of all the variables along with inherited variables in the class
c) Size of largest size of variable
d) Classes doesn’t have any size

Answer: d
10. Which of the following describes a friend class?
a) Friend class can access all the private members of the class, of which it is a friend
b) Friend class can only access protected members of the class, of which it is a friend
c) Friend class don’t have any implementation
d) Friend class can’t access any data member of another class but can use it’s methods
Answer: a

11. What is scope of a class nested inside another class?


a) Protected scope
b) Private scope
c) Global scope
d) Depends on access specifier and inheritance used

Answer: d
12. Which among the following is false, for member function of a class?
a) All member functions must be defined
b) Member functions can be defined inside or outside the class body
c) Member functions need not be declared inside the class definition
d) Member functions can be made friend to another class using friend keyword

Answer: c
13. Which syntax for class definition is wrong?
a) class student{ };
b) student class{ };
c) class student{ public: student(int a){ } };
d) class student{ student(int a){} };

Answer: b

SNSCT- Department of Information Technology (IT) Page 3


16CS201 - OBJECT ORIENTED PROGRAMMING

14. Which of the following pairs are similar?


a) Class and object
b) Class and structure
c) Structure and object
d) Structure and functions

Answer: b
15. Which among the following is false for class features?
a) Classes may/may not have both data members and member functions
b) Class definition must be ended with a colon
c) Class can have only member functions with no data members
d) Class is similar to union and structures

Answer: b
16. Which of the following is not the member of class?
A. Static function

B. Friend function

C. Const function

D. Virtual function
Answer: Option B
17. Which of the following concepts means determining at runtime what method to
invoke?
A. Data hiding

B. Dynamic Typing

C. Dynamic binding

D. Dynamic loading
Answer: Option C

18. Which of the following concept of oops allows compiler to insert arguments in a
function call if it is not specified?
A. Call by value
. B. Call by reference

C. Default arguments

D. Call by pointer
Answer: Option C

SNSCT- Department of Information Technology (IT) Page 4


16CS201 - OBJECT ORIENTED PROGRAMMING
19. Which of the following concepts of OOPS means exposing only necessary information to client?
A. Encapsulation

B. Abstraction

C. Data hiding

Data binding
D.

Answer: Option C

20. Which of the following approach is adapted by C++?


A. Top-down

B. Bottom-up

C. Right-left

D. Left-right
Answer: Option B

21. Which of the following is correct about function overloading?


A. The types of arguments are different.

B. The order of argument is different.

C. The number of argument is same.

D. Both A and B.
Answer: Option D

22. Which of the following concepts means wrapping up of data and functions together?
A. Abstraction

B. Encapsulation

C. Inheritance

D. Polymorphism
Answer: Option B

23. Which of the following operator is overloaded for object cout?


A. >>

B. <<

C. +

D. =
Answer: Option B

SNSCT- Department of Information Technology (IT) Page 5


16CS201 - OBJECT ORIENTED PROGRAMMING

24. Which of the following is the correct way of declaring a function as


constant?
A. const int ShowData(void) { /* statements */ }

B. int const ShowData(void) { /* statements */ }

C. int ShowData(void) const { /* statements */ }

D. Both A and B
Answer: Option C

25. Which among the following doesn’t come under OOP concept?
a) Platform independent
b) Data binding
c) Message passing
d) Data hiding

Answer: a
26. Which one of the following options is correct?
A. Friend function can access public data members of the class.

B. Friend function can access protected data members of the class.

C. Friend function can access private data members of the class.

D. All of the above.


Answer: Option D

27. What is correct about the static data member of a class?


A. A static member function can access only static data members of a class.

B. A static data member is shared among all the object of the class.

C. A static data member can be accessed directly from main().

D. Both A and B.
Answer: Option D

28. Which of the following statement is correct?


A. Class is an instance of object.

B. Object is an instance of a class.

C. Class is an instance of data type.

D. Object is an instance of data type.


Answer: Option B

SNSCT- Department of Information Technology (IT) Page 6


16CS201 - OBJECT ORIENTED PROGRAMMING

29: cout stands for

A.class output

B. character output

C. console output

D.call output

Answer: C
30. Which of the following comments about inline comments are true?

A.A function is declared inline by typing the keyword inline before the return value of
the function.

B. A function is declared inline by typing the keyword inline after the return value of the
function.

C. A function that is declared inline may not be treated inline.

D.Both (a) & (c)

Answer: D

SNSCT- Department of Information Technology (IT) Page 7

Potrebbero piacerti anche