zoukankan      html  css  js  c++  java
  • C++ OOP Concept 2错题

    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.

  • 相关阅读:
    树套树+【UVALive】6709 Mosaic 二维线段树
    汇编实验1. 计算1+2+3+…+10,将结果显示在屏幕上。4
    Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 2) D. Destruction of a Tree
    HDU 4417 Super Mario主席树
    spoj+B
    2018-2019赛季多校联合新生训练赛第五场(2018/12/14)补题题解
    迷宫问题 POJ
    浅谈二分搜索与二分查找
    Moving Tables POJ
    Humidex POJ
  • 原文地址:https://www.cnblogs.com/hhlys/p/13062845.html
Copyright © 2011-2022 走看看