Home / C++ Programming / OOPS Concepts :: General Questions

C++ Programming :: OOPS Concepts

  1. In which of the following a virtual call is resolved at the time of compilation?

  2. A.
    From inside the destructor.
    B.
    From inside the constructor.
    C.
    From inside the main().
    D.
    Both A and B.

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Which of the following statements regarding inline functions is correct?

  4. A.
    It speeds up execution.
    B.
    It slows down execution.
    C.
    It increases the code size.
    D.
    Both A and C.

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Which one of the following is the correct way to declare a pure virtual function?

  6. A.
    virtual void Display(void){0};
    B.
    virtual void Display = 0;
    C.
    virtual void Display(void) = 0;
    D.
    void Display(void) = 0;

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which of the following keyword is used to overload an operator?

  8. A.
    overload
    B.
    operator
    C.
    friend
    D.
    override

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What will happen if a class is not having any name?

  10. A.
    It cannot have a destructor.
    B.
    It cannot have a constructor.
    C.
    It is not allowed.
    D.
    Both A and B.

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which inheritance type is used in the class given below?
    class A : public X, public Y
    {}

  12. A.
    Multilevel inheritance
    B.
    Multiple inheritance
    C.
    Hybrid inheritance
    D.
    Hierarchical Inheritance

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Which one of the following is correct about the statements given below?

    1. All function calls are resolved at compile-time in Procedure Oriented Programming.
    2. All function calls are resolved at compile-time in OOPS.

  14. A.
    Only II is correct.
    B.
    Both I and II are correct.
    C.
    Only I is correct.
    D.
    Both I and II are incorrect.

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Which of the following is an invalid visibility label while inheriting a class?

  16. A.
    public
    B.
    private
    C.
    protected
    D.
    friend

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which one of the following options is correct?

  18. A.
    Friend function can access public data members of the class.
    B.
    Friend function can access protected data members of the class.
    C.
    Friend function can access private data members of the class.
    D.
    All of the above.

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Which of the following statements is correct in C++?

  20. A.
    Classes cannot have data as protected members.
    B.
    Structures can have functions as members.
    C.
    Class members are public by default.
    D.
    Structure members are private by default.

    View Answer

    Workspace

    Discuss Discuss in Forum