100% found this document useful (1 vote)
84 views

Object Oriented Programming (OOP) Solved MCQs (Set-1)

The document contains 25 multiple choice questions about object oriented programming concepts like classes, constructors, inheritance, access specifiers, etc. Some key points covered are: - Classes allow data to be hidden and closely model real world entities. - Constructors are functions that are called when a new object is created. - When one class inherits from another, the parent constructor is called before the child constructor. - Member functions can access data in the object they are called for but not other class objects.

Uploaded by

Muhammad Sarim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
84 views

Object Oriented Programming (OOP) Solved MCQs (Set-1)

The document contains 25 multiple choice questions about object oriented programming concepts like classes, constructors, inheritance, access specifiers, etc. Some key points covered are: - Classes allow data to be hidden and closely model real world entities. - Constructors are functions that are called when a new object is created. - When one class inherits from another, the parent constructor is called before the child constructor. - Member functions can access data in the object they are called for but not other class objects.

Uploaded by

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

Object Oriented Programming (OOP) MCQs

[set-1]

1. Every class has at least one constructor function, even when none is declared.
A. true
B. false
Answer: A

2. Can constructors be overloaded?


A. true
B. false
Answer: A
m
oin terms of Access Modifier?
. c
3. What is the difference between struct and class
te
A. by default all the struct members are private while by default class members are public.
a
B. by default all the struct members are protected while by default class members are private.

q M
C. by default all the struct members are public while by default class members are private.

c
D. by default all the struct members are public while by default class members are protected.
Answer: C
M
4. An abstract class can be instantiated.
A. true
B. false
Answer: B

5. The default access level assigned to members of a class is


A. private
B. public
C. protected
D. needs to be assigned
Answer: A

6. There is nothing like a virtual constructor of a class.


A. true
B. false
Answer: B

7. Which of the following operators allow defining the member functions of a class
outside the class?
A. ::
B. ?
C. :?
D. %
Answer: A

8. Which type of class has only one unique value for all the objects of that same
class?
A. this
B. friend
C. static
D. both a and b
Answer: C

9. Which one of the following is not a fundamental data type in C++?


A. float
B. string
C. int
D. char
Answer: B

10. What is a constructor?


A. a class automatically called whenever a new object of this class is created.
B. a class automatically called whenever a new object of this class is destroyed.
C. a function automatically called whenever a new object of this class is created.
D. a function automatically called whenever a new object of this class is destroyed.
Answer: C

11. Under what conditions a destructor destroys an object?


A. scope of existence has finished
B. object dynamically assigned and it is released using the operator delete.
C. program terminated.

Download more sets at McqMate.com


D. both a and b.
Answer: D

12. When class B is inherited from class A, what is the order in which the
constructers of those classes are called
A. class a first class b next
B. class b first class a next
C. class b's only as it is the child class
D. class a's only as it is the parent class
Answer: A

13. Which one of the following is not a valid reserved keyword in C++?
A. explicit
B. public
C. implicit
D. private
Answer: C

14. Variables declared in the body of a particular member function are known as
data members and can be used in all member functions of the class.
A. true
B. false
Answer: B

15. In a class definition, data or functions designated private are accessible


A. to any function in the program.
B. only if you know the password.
C. to member functions of that class.
D. only to public members of the class.
Answer: C

16. A member function can always access the data


A. in the object of which it is a member.
B. in the class of which it is a member.
C. in any object of the class of which it is a member.
D. in the public part of its class.
Answer: A

Download more sets at McqMate.com


17. Classes are useful because they
A. can closely model objects in the real world.
B. permit data to be hidden from other classes.
C. bring together all aspects of an entity in one place.
D. options a, b and c
Answer: D

18. For the object for which it was called, a const member function
A. can modify both const and non-const member data.
B. can modify only const member data.
C. can modify only non-const member data.
D. can modify neither const nor non-const member data.
Answer: D

19. Dividing a program into functions


A. is the key to object-oriented programming.
B. makes the program easier to conceptualize.
C. may reduce the size of the program.
D. option b and c
Answer: D

20. An expression
A. usually evaluates to a numerical value.
B. may be part of a statement.
C. always occurs outside a function.
D. option a and b
Answer: D

21. A variable of type char can hold the value 301.


A. true
B. false
Answer: B

22. In an assignment statement, the value on the left of the equal sign is always
equal to the value on the right.
A. true
B. false
Answer: B

Download more sets at McqMate.com


23. It’s perfectly all right to use variables of different data types in the same
arithmetic expression.
A. true
B. false
Answer: A

24. A function’s single most important role is to


A. give a name to a block of code.
B. reduce program size.
C. accept arguments and provide a return value.
D. help organize a program into conceptual units.
Answer: D

25. A function argument is


A. a variable in the function that receives a value from the calling program.
B. a way that functions resist accepting the calling program’s values.
C. a value sent to the function by the calling program.
D. a value returned by the function to the calling program.
Answer: C

Download more sets at McqMate.com

You might also like