Home / CSE MCQs / C++ - MCQs :: Classes - C++

CSE MCQs :: C++ - MCQs

  1. What does your class can hold?
  2. A.
    data
    B.
    functions
    C.
    both a & b
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. How many specifiers are present in access specifiers in class?
  4. A.
    1
    B.
    2
    C.
    3
    D.
    4

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. How many kinds of classes are there in c++?
  6. A.
    1
    B.
    2
    C.
    3
    D.
    4

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which is used to define the member of a class externally?
  8. A.
    :
    B.
    : :
    C.
    #
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which other keywords are also used to declare the class other than class?
  10. A.
    struct
    B.
    union
    C.
    object
    D.
    both a & b

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which of the following is a valid class declaration?
  12. A.
    class A { int x; };
    B.
    class B { }
    C.
    public class A { }
    D.
    object A { int x; };

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. The fields in the class in c++ program are by default
  14. A.
    protected
    B.
    private
    C.
    public
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Constructors are used to
  16. A.
    initalize the objects
    B.
    construct the data members
    C.
    both a & b
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. When struct is used instead of the keyword class means, what will happen in the program?
  18. A.
    access is public by default
    B.
    access is private by default
    C.
    access is protected by default
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Which class is used to design the base class?
  20. A.
    abstract class
    B.
    derived class
    C.
    base class
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum