C++ Programming Multiple Choice Questions - OOPS Concept

This section focuses on the "OOPS Concept" in C++ programming langauge. These Multiple Choice Questions (MCQ) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. The OOPs concept in C++, exposing only necessary information to users or clients is known as

A. Data hiding
B. Encapsulation
C. Hiding complexity
D. Abstraction

View Answer


2. A class is made abstract by declaring at least one of its functions as?

A. abstract classes
B. pure virtual function
C. abstract functions
D. Interface

View Answer


3. Which is private member functions access scope?

A. Member functions which can used outside the class
B. Member functions which are accessible in derived class
C. Member functions which can only be used within the class
D. Member functions which can’t be accessed inside the class

View Answer


4. What is the output of this program?

#include <iostream>
using namespace std;
class team
{ 
    public : int member; 
    void LFC() 
    { 
	    cout<<"Its base class";
    };
};
class course:public team
{
    public : 
    void LFC()
    { 
      cout<<"Its derived class"; 
    }
};

int main() 
{ 
team t; course c;
t.LFC();
c.LFC();
} 

A. Its base classIts derived class
B. Its base class Its derived class
C. Its derived classIts base class
D. Its derived class Its base class

View Answer


5. C++ was originally developed by

A. Sir Richard Hadlee
B. Clocksin and Mellish
C. Donald E. Knuth
D. Bjame Stroustrup

View Answer


6. What is the output of this program?

#include <iostream>
using namespace std;

class course
{ 
  char name[10];
  public : void LFC()
  { 
    cout<<"Its course system";
  }
};

class team : public course
{
    public: void LFC()
    { 
      cout<<"Its team course system";
    }
};

int main()
{
      team t;
      t.LFC();
}

A. Its team course system
B. Its course system
C. Its team course systemIts course system
D. Its course systemIts team course system

View Answer


7. Can main() function be made private?

A. Yes, always
B. Yes, if program doesn't contain any classes
C. No, because main function is user defined
D. No, never

View Answer


8. At what point of time a variable comes into existence in memory is determined by its

A. Data type
B. Storage class
C. Scope
D. All of the above

View Answer


9. Which of the following concepts is used to implement late binding?

A. Static function
B. Virtual function
C. Const function
D. Operator function

View Answer


10. For Cat and Animal class, correct way of inheritance is

A. Class Cat: public Animal
B. Class Animal: public Cat
C. Both are correct way
D. None is correct way

View Answer





Also check :


Discussion


* You must be logged in to add comment.