HirePro C/CPP Quiz 1

Question 1

Time: 00:00:00
what will be the value of b of following C++ code?
#include
using namespace std;
int main() {
int a=20, b= a+(a)++ + (++a);
cout<<(b++);
}

63

63

64

64

60

60

61

61

Question 2

Time: 00:00:00
Which of the following is used for comment in C++

//

//

/

/

/* /

/* /

// */

// */

Question 3

Time: 00:00:00
Which of the following in C++ does not represent type of constructor

Default constructor

Default constructor

Friend constructor

Friend constructor

Copy constructor

Copy constructor

Parameterized constructor

Parameterized constructor

Question 4

Time: 00:00:00
Which of the following statements regarding this C++ pointer is true

All static variables in a class receive this pointer as a hidden argument.

All static variables in a class receive this pointer as a hidden argument.

All of a class's functions take this pointer as a secret argument

All of a class's functions take this pointer as a secret argument

All non-static functions of a class receive this pointer as a hidden argument.

All non-static functions of a class receive this pointer as a hidden argument.

In all static functions of a class, this pointer is supplied as a hidden argument.

In all static functions of a class, this pointer is supplied as a hidden argument.

Question 5

Time: 00:00:00
What will be the value of a for N =2 in C++ code?

#include
using namespace std;

int main() {
int a = 5;
for (int i = 0; i i; j--) {
a = a + i + j;
}
}
cout<<a;
return 0;
}

11

11

5

5

12

12

10

10

Question 6

Time: 00:00:00
Which of the following types does C++ offer but C does not

Double

Double

bool

bool

float

float

Int

Int

Question 7

Time: 00:00:00
What purpose does indentation serve in C++

makes a distinction between inner data and comments

makes a distinction between inner data and comments

makes a distinction between comments and extraneous data

makes a distinction between comments and extraneous data

makes a distinction between code and comments

makes a distinction between code and comments

makes a distinction between comments and external data

makes a distinction between comments and external data

Question 8

Time: 00:00:00
which performs better when calling C++ functions

Call by reference

Call by reference

Call by object

Call by object

Call by pointer

Call by pointer

Call by value

Call by value

Question 9

Time: 00:00:00
In C++, the function declaration is terminated by which of the following

;

;

:

:

)

)

\

\

Question 10

Time: 00:00:00
What does C++'s inheritance mean

Creating new classes from existing ones

Creating new classes from existing ones

Class overloading

Class overloading

Class names that are the same

Class names that are the same

Combining data into one class

Combining data into one class

null
null