Programming MCQs

MCQ Questions on C++ With Answers Set-3

Pinterest LinkedIn Tumblr
This set of MCQ questions on C++ includes the collections of fundamental of object oriented programming in C++. It includes MCQ questions on C++ functions, operator overloading, keywords, encapsulation, inheritance and polymorphism.It also includes about static and dynamic binding along with major features that are required for object based programming.

1. When a function is defined inside a class, this function is called ………….
A) Inside function
B) Class function
C) Inline function
D) Interior function

2. Which of the following cannot be passed to a function?
A) Reference variable
B) Arrays
C) Class objects
D) Header files

3. State true of false.
i) We cannot make the function inline by defining a function outside the class.
ii) A member function can be called by using its name inside another member function of the same class, this is known as nesting of member function.
A) True, True
B) True, False
C) False, True
D) False, False

4. Which of the following operators could be overloaded?
A) Size of
B) +
C) +=
D) ::

5. Which of the following is true about the static member variable in C++.
i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted.
ii) It is visible only within the class, but its lifetime is the entire program.
A) i-True, ii-True
B) ii-False, ii-True
C) i-True, ii-False
D) i-False, iii-False

6. Which of the following keywords are used to control access to a class member?
A) default
B) break
C) protected
D) goto

7. What will be the values of x, m and n after execution of the following statements?
Int x, m, n;
m=10;
n=15;
x= ++m + n++;
A) x=25, m=10, n=15
B) x=27, m=10, n=15
C) x=26, m=11, n=16
D) x=27, m=11, n=16


8. The major goal of inheritance in C++ is
A) To facilitate the conversion of data types
B) To help modular programming
C) To facilitate the re usability of code
D) To extend the capabilities of a class

9. A variable is defined within a block in a body of a function. Which of the following are true?
A) It is visible throughout the function.
B) It is visible from the point of definition to the end of the program.
C) It is visible from the point of definition to the end of the block.
D) It is visible throughout the block.

10. The friend functions are used in situations where
A) We want to exchange data between classes
B) We want to have access to unrelated classes
C) Dynamic binding is required
D) We want to create versatile overloaded operators.

11. ………….. means that the code associated with a given procedure call is not known until the time of the call at run time.
A) dynamic binding
B) run time binding
C) early binding
D)static binding

12. Through ………………., we can eliminate redundant code and extend the use of existing classes.
A) Encapsulation
B) Polymorphism
C) Inheritance
D) Overloading

13. State whether the following statements about the benefits of OOP are True or False.
i) Software complexity can be easily managed.
ii) It is easy to partition the work in a project based on objects.
A) True, False
B) False, True
C) True, True
D) False, False

14. Major features that are required for object based programming is/are
i) Data encapsulation    ii) Data hiding   iii) Automatic initialization  iv) operator overloading
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv

15. In OOP, a problem is considered as a collection of number of entities called ………………
A) class
B) objects
C) functions
D) message

Answers

1. C) Inline function
2. D) Header files
3. C) False, True
4. B) +
5. B) ii-False, ii-True
6. C) protected
7. C) x=26, m=11, n=16
8. C) To facilitate the reusability of code
9. D) It is visible throughout the block.
10. A) We want to exchange … classes
11. A) dynamic binding
12. C) Inheritance
13. C) True, True
14. D) All i, ii, iii and iv
15. B) objects

Read Next:Solved Multiple Choice Questions of C++ set-4

Read More:C and C++ MCQ Questions

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.