Signup/Sign In

C++ Programming MCQs Test 7

This Test will cover complete C++ with very important questions, starting off from basics to advanced level.
Q. Which of the following is the correct way of declaring a function as constant?
Q. Which of the following factors support the statement that, Reusability is a desirable feature of a language?
Q. Which of the following is a mechanism of Static Polymorphism?
Q. What happens if the base and derived class contains definition of a function with same prototype?

Q. Pick up the valid declaration for overloading ++ in postfix, where T is the class name?
Q. In which of the following a virtual call is resolved at the time of compilation?
Q. Which one of the following is the correct way to declare a pure virtual function?
Q. What is the output of the following C++ program?
#include <iostream>
using namespace std;

int main()
{
  char *s = "Fine";
	*s = 'N';
	cout << (s) << endl;
	return 0;
}
Q. What is the output of the following C++ program?
#include <iostream>
using namespace std;

class Base
{
  public:
	void f()
  {
	  cout << "Base\n";
	}
};

class Derived : public Base
{
  public:
	void f()
  {
	  cout<<"Derived\n";
	}
};

int main()
{
  Derived obj;
  obj.Base::f();
  return 0;
}

Q. What is correct about the static data member of a class?
Q. Which of the following provides a reusable mechanism?
Q. What does the following statement mean?
int (*fp)(char*)
Q. What is the output of the following C++ program?
#include <iostream>
using namespace std;

int main()
{
  int a[] = {10, 20, 30};
	cout << *a+1;
}
Q. Choose the pure virtual function definition from the following.
Q. What is the output of the following C++ program?
#include <iostream>
using namespace std;

int main()
{
  int i = 1, j = 2, k = 3, r;
	r = (i, j, k);
	cout << r << endl;
	return 0;
}

Related Tests: