Signup/Sign In

C++ Programming MCQs Test 3

This Test will cover complete C++ with very important questions, starting off from basics to advanced level.
Q. Which of the following parameter passing mechanism(s) is/are supported by C++, but not by C?
Q. cout stands for __________.
Q. The following program __________.
#include <iostream>
using namespace std;

void abc(int &p)
{
  cout << p;
}

void main(void)
{
  float m = 1.23;
	abc(m);
  cout << m;
}
Q. reference is not same as a pointer because __________.

Q. If a piece of code can be implemented as a macro or as an inline function, which of the following factors favour implementation as an inline function?
Q. The fields in a structure of a C program are by default __________.
Q. The fields in a class, of a C++ program are by default __________.
Q. For the below declarations, Which of the following statements is/are illegal?
Declaration 1: char a;
Declaration 2: const char aa ='h';
Declaration 3: char *na;
Declaration 4: const char *naa;

Statement 1: aa = a;
Statement 2: na = &a;
Statement 3: na = &aa;
Q. Forgetting to include a file(like cmath or math.h) that is necessary will result in __________.

Q. Assume that the random number generating function, rand(), returns an integer between 0 and 10000(both inclusive). If you want to simulate the throwing of a die using this random function, you will use the expression __________.
Q. Assume that the random number generating function, rand(), returns an integer between 0 and 10000(both inclusive). To randomly generate a number between a and b(both inclusive), you will use the expression __________.
Q. Which of the following comments about inline comments are true?
Q. Which of the following decides if a function that is declared inline, is indeed going to be treated inline in the executable code?
Q. Which of the following type of functions is an ideal candidate for being declared inline?
Q. One disadvantage of pass-by-reference is that the called function may inadvertently corrupt the caller's data. This can be avoided by :

Related Tests: