CPP Programming MCQs | Page - 4
Dear candidates you will find MCQ questions of CPP Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
β
Correct Answer: (B)
A postfix ++ has a dummy parameter
Q. Which of the following operator functions cannot be global?
β
Correct Answer: (C)
Conversion Operator
Q. Which of the following is true about this pointer?
β
Correct Answer: (B)
It is passed as a hidden argument to all non-static function calls
Q. Which of the following in Object Oriented Programming is supported by Function overloading and default arguments features of C++?
β
Correct Answer: (B)
Polymorphism
Q. Output of the program?
#include<iostream>
using namespace std;
int fun(int x = 0, int y = 0, int z)
{ return (x + y + z); }
int main()
{
cout << fun(10);
return 0;
}
β
Correct Answer: (D)
Compiler Error
Q. Output of following program?
#include <iostream>
using namespace std;
int fun(int=0, int = 0);
int main()
{
cout << fun(5);
return 0;
}
int fun(int x, int y)
{
return (x+y);
}
β
Correct Answer: (B)
5
Q. Which of the following is true?
β
Correct Answer: (D)
Static methods can only access static members (data and methods)
Q. If a function is friend of a class, which one of the following is wrong?
β
Correct Answer: (C)
Friend functions are members of a class.
Q. Which one of the following is correct, when a class grants friend status to another class?
β
Correct Answer: (B)
All member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
Jump to