码迷,mamicode.com
首页 > 编程语言 > 详细

C++ OOP Concept 2错题

时间:2020-06-08 00:17:46      阅读:66      评论:0      收藏:0      [点我收藏+]

标签:ann   into   xpl   can   over   member   ant   type   dep   

4. Out of the following, which is not a member of the class?
a) Static function
b) Friend function
c) Constant function
d) Virtual function

A:Friend function is not a member of the class. They are given the same access rights as the class member function have but they are not actual members of the class.

 

7. Why references are different from pointers?
a) A reference cannot be made null
b) A reference cannot be changed once initialized
c) No extra operator is needed for dereferencing of a reference
d) All of the mentioned

A:References cannot be made null whereas a pointer can be. References cannot be changed whereas pointers can be modified.
Pointers need * operator to dereference the value present inside it whereas reference does not need an operator for dereferencing.

 

8. Which of the following provides a programmer with the facility of using object of a class inside other classes?
a) Inheritance
b) Composition
c) Abstraction
d) Encapsulation

A:The concept of using objects of one class into another class is known as Composition.

 

There are two types of polymorphism in C++ namely run-time and compile-time polymorphisms.Run-time polymorphism is implemented using Inheritance and virtual in which object decides which function to call.Compile-time polymorphism is implemented using templates in which the types(which can be checked during compile-time) are used decides which function to be called.

 

13. Which concept means the addition of new components to a program as it runs?
a) Data hiding
b) Dynamic binding
c) Dynamic loading
d) Dynamic typing

A:Dynamic loading is the concept of adding new components to a program as it runs.

 

14. Which of the following explains the overloading of functions?
a) Virtual polymorphism
b) Transient polymorphism
c) Ad-hoc polymorphism
d) Pseudo polymorphism

A:Ad-hoc polymorphism is a type of polymorphism in which a function denotes heterogeneous implementation depending upon the types of argument.

C++ OOP Concept 2错题

标签:ann   into   xpl   can   over   member   ant   type   dep   

原文地址:https://www.cnblogs.com/hhlys/p/13062845.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!