Question 1

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

C++ enables to define functions that take constants as an argument.

C++ enables to define functions that take constants as an argument.

We cannot change the argument of the function that is declared as constant.

We cannot change the argument of the function that is declared as constant.

Both A and B.

Both A and B.

We cannot use the constant while defining the function.

We cannot use the constant while defining the function.

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 will be correct if the function has three arguments passed to it?

The trailing argument will be the default argument.nt.

The trailing argument will be the default argument.nt.

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 3

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

Constructors can have default parameters.

Constructors can have default parameters.

Constructors cannot have default parameters.

Constructors cannot have default parameters.

Constructors cannot have more than one default parameter.

Constructors cannot have more than one default parameter.

Constructors can have at most five default parameters.

Constructors can have at most five default parameters.

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 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 5

Time: 00:00:00
Where the default value of parameter have to be specified?

Function call

Function call

Function definition

Function definition

Function prototype

Function prototype

Both B or C

Both B or C

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 statement is incorrect?

A default argument is checked for the type at the time of declaration and evaluated at the time of the call.

A default argument is checked for the type at the time of declaration and evaluated at the time of the call.

We can provide a default value to a particular argument in the middle of an argument list.

We can provide a default value to a particular argument in the middle of an argument list.

We cannot provide a default value to a particular argument in the middle of an argument list.

We cannot provide a default value to a particular argument in the middle of an argument list.

Default arguments are useful in situations where some arguments always have the same value.

Default arguments are useful in situations where some arguments always have the same value.

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

Please login to submit your explanation

Question 7

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 8

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

#include
struct MyData
{
public:
int Addition(int a, int b = 10)
{
return (a *= b + 2);
}
float Addition(int a, float b);
};
int main()
{
MyData data;
cout< cout< return 0;
}

12 12

12 12

12 18

12 18

3 14

3 14

18 12

18 12

Compilation fails.

Compilation fails.

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