Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

C++ Programming

Cpp Programming Quiz 178 – Which of the following statement is incorrect?

Question: Which of the following statement is incorrect?
[A]. Default arguments can be provided for pointers to functions.
[B]. A function can have all its arguments as default.[C]. Default argument cannot be provided for pointers to functions.
[D]. A default argument cannot be redefined in later declaration.

Answer: Option C

Cpp Programming Quiz 178 – Which of the following statement is incorrect? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 180 – Which of the following statement is incorrect?

Question: Which of the following statement is incorrect?
[A]. A default argument is checked for type at the time of declaration and evaluated at the time of call.
[B]. We can provide a default value to a particular argument in the middle of an argument list.[C]. We cannot provide a default value to a particular argument in the middle of an argument list.
[D]. Default arguments are useful in situations where some arguments always have the same value.

Answer: Option B

Cpp Programming Quiz 180 – Which of the following statement is incorrect? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 181 – Which of the following statement is correct?

Question: Which of the following statement is correct?
[A]. The default value for an argument cannot be function call.
[B]. C++ allows the redefinition of a default parameter.[C]. Both A and B.
[D]. C++ does not allow the redefinition of a default parameter.

Answer: Option D

 

Cpp Programming Quiz 181 – Which of the following statement is correct? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 182 – Which of the following function prototype is perfectly acceptable?

Question: Which of the following function prototype is perfectly acceptable?
[A]. int Function(int Tmp = Show());
[B]. float Function(int Tmp = Show(int, float));[C]. Both A and B.
[D]. float = Show(int, float) Function(Tmp);

Answer: Option A

 

Cpp Programming Quiz 182 – Which of the following function prototype is perfectly acceptable? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 183 – Which of the following statement is incorrect?

Question: Which of the following statement is incorrect?
[A]. The default value for an argument can be a global constant.
[B]. The default arguments are given in the function prototype.[C]. Compiler uses the prototype information to build a call, not the function definition.
[D]. The default arguments are given in the function prototype and should be repeated in the function definition.

Answer: Option D

Cpp Programming Quiz 183 – Which of the following statement is incorrect? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 185 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class Base
{
public:
int S, A, M;
Base(int x, int y)
{
S = y - y;
A = x + x;
M = x * x;
}
Base(int, int y = 'A', int z = 'B')
{
S = y;
A = y + 1 - 1;
M = z - 1;
}
void Display(void)
{
cout<< S << " " << A << " " << M << endl; } }; class Derived : public Base { int x, y, z; public: Derived(int xx = 65, int yy = 66, int zz = 67): Base(x) { x = xx; y = yy; z = zz; } void Display(int n) { if(n) Base::Display(); else cout<< x << " " << y << " " << z << endl; } }; int main() { Derived objDev; objDev.Display(-1); return 0; }

[A].65 65 65
[B].65 66 67
[C].A A A
[D].A B C

Answer: Option A

Cpp Programming Quiz 185 – What will be the output of the following program? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 186 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#include
void Tester(float xx, float yy = 5.0);
class IndiaBix
{
float x;
float y;
public:
void Tester(float xx, float yy = 5.0)
{
x = xx;
y = yy;
cout<< ++x % --y; } }; int main() { IndiaBix objBix; objBix.Tester(5.0, 5.0); return 0; }

[A].The program will print the output 0.
[B].The program will print the output 1.
[C].The program will print the output 2.
[D].The program will print the output garbage value. 

Answer: Option E

Cpp Programming Quiz 186 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 187 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class Bix
{
int x, y;
public:
void show(void);
void main(void);
};
void Bix::show(void)
{
Bix b;
b.x = 2;
b.y = 4;
cout<< x << " " << y; } void Bix::main(void) { Bix b; b.x = 6; b.y = 8; b.show(); } int main(int argc, char *argv[]) { Bix run; run.main(); return 0; }

[A].2 4
[B].6 8
[C].The program will report error on Compilation.
[D].The program will report error on Linking. 

Answer: Option B

Cpp Programming Quiz 187 – What will be the output of the following program? Read More »

Cpp Programming, Functions