Question 1

Time: 00:00:00
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?

Compile-time error.

Compile-time error.

Preprocessing error.

Preprocessing error.

Runtime error.

Runtime error.

Runtime exception.

Runtime exception.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 2

Time: 00:00:00
Which of the following statement is correct?

A destructor has the same name as the class in which it is present.

A destructor has the same name as the class in which it is present.

A destructor has a different name than the class in which it is present.

A destructor has a different name than the class in which it is present.

A destructor always returns an integer.

A destructor always returns an integer.

A destructor can be overloaded.

A destructor can be overloaded.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 3

Time: 00:00:00
A __________ is a constructor that either has no parameters or if it has parameters, all the parameters have default values.

default constructor

default constructor

copy constructor

copy constructor

Both A and B

Both A and B

None of these

None of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 4

Time: 00:00:00
Which of the following statements about virtual base classes is correct?

It is used to provide multiple inheritances.

It is used to provide multiple inheritances.

It is used to avoid multiple copies of the base class in derived class.

It is used to avoid multiple copies of the base class in derived class.

It is used to allow multiple copies of the base class in a derived class.

It is used to allow multiple copies of the base class in a derived class.

It allows private members of the base class to be inherited in the derived class.

It allows private members of the base class to be inherited in the derived class.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 5

Time: 00:00:00
Which of the following statement will be correct if the function has three arguments passed to it?

The trailing argument will be the default argument.

The trailing argument will be the default argument.

The first argument will be the default argument.

The first argument will be the default argument.

The middle argument will be the default argument.

The middle argument will be the default argument.

All the argument will be the default argument.

All the argument will be the default argument.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 6

Time: 00:00:00
Which of the following function declaration is/are incorrect?

int Sum(int a, int b = 2, int c = 3);

int Sum(int a, int b = 2, int c = 3);

int Sum(int a = 5, int b);

int Sum(int a = 5, int b);

int Sum(int a = 0, int b, int c = 3);

int Sum(int a = 0, int b, int c = 3);

Both B and C are incorrect.

Both B and C are incorrect.

All are correct.

All are correct.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 7

Time: 00:00:00
Which of the following statement is incorrect?

The default value for an argument can be a global constant.

The default value for an argument can be a global constant.

The default arguments are given in the function prototype.

The default arguments are given in the function prototype.

The compiler uses the prototype information to build a call, not the function definition.

The compiler uses the prototype information to build a call, not the function definition.

The default arguments are given in the function prototype and should be repeated in the function definition.

The default arguments are given in the function prototype and should be repeated in the function definition.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 8

Time: 00:00:00

What will be the output of the following program?

#include
typedef void(*FunPtr)(int);
int Look(int = 10, int = 20);
void Note(int);
int main()
{
FunPtr ptr = Note;
(*ptr)(30);
return 0;
}
int Look(int x, int y)
{
return(x + y % 20);
}
void Note(int x)
{
cout<< Look(x) << endl;
}

10

10

20

20

30

30

40

40

Compilation fails

Compilation fails

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 9

Time: 00:00:00
What will be the output of the following program?

#include
int main()
{
float Amount;
float Calculate(float P = 5.0, int N = 2, float R = 2.0);
Amount = Calculate();
cout<< Amount << endl;
return 0;
}

float Calculate(float P, int N, float R)
{
int Year = 1;
float Sum = 1 ;
Sum = Sum * (1 + P * ++N * R);
Year = (int)(Year + Sum);
return Year;
}

21

21

22

22

31

31

32

32

None of these

None of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 10

Time: 00:00:00
What will be the output of the following program?

#include
class BaseCounter
{
protected:
long int count;

public:
void CountIt(int x, int y = 10, int z = 20)
{
count = 0;
cout<< x << " " << y << " " << z << endl;
}
BaseCounter()
{
count = 0;
}
BaseCounter(int x)
{
count = x ;
}
};
class DerivedCounter: public BaseCounter
{
public:
DerivedCounter()
{ }
DerivedCounter(int x): BaseCounter(x)
{ }
};
int main()
{
DerivedCounter objDC(30);
objDC.CountIt(40, 50);
return 0;
}

30 10 20

30 10 20

Garbage 10 20

Garbage 10 20

40 50 20

40 50 20

20 40 50

20 40 50

40 Garbage Garbage

40 Garbage Garbage

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice! \r\n","Keep trying! \r\n","Not bad! \r\n","Good work! \r\n","Perfect! \r\n"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments