C++ Language | 10 Minute‐Test 1


Instruction

  • Total number of questions : 10.
  • Time alloted : 10 minutes.
  • Each question carry 1 mark.
  • No Negative marks
  • DO NOT refresh the page.
  • All the best :-).

1.

What is the size of wchar_t in C++ ?

A.
2
B.
4
C.
2 or 4
D.
based on the number of bits in the system

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Compiler wants to make CPU as more efficient in accessing the next value.

2.

Is bool a fundamental datatype in C++ ?

A.
yes
B.
No, it is a typedef of unsigned char
C.
No, it is an enum of {false,true}
D.
No, it is expanded from macros

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

C++ has bool as a fundamental data type.

3.

How many characters are specified in the ASCII scheme ?

A.
64
B.
128
C.
256
D.
none of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None

4.

0946, 786427373824, ‘x’ and 0X2f are _____, _____, ____ and _____ literals respectively

A.
decimal, character,octal, hexadecimal
B.
octal, hexadecimal, character, decimal
C.
hexadecimal, octal, decimal, character
D.
octal, decimal, character, hexadecimal

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Literal integer constants that begin with 0x or 0X are interpreted as
hexadecimal and the ones that begin with 0 as octal. The character literal are
written within ”.

5.

What will happen in this code?
int a = 100, b = 200;
int *p = &a, *q = &b;
p = q;

A.
b is assigned to a
B.
p now points to b
C.
a is assigned to b
D.
q now points to a

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Assigning to refrence changes the object to which the refrence is bound.

6.

What is the output of this program ?

#include <iostream>

using namespace std;

int g = 100;

int main ()

{

int a;

{

int b;

b = 20 ;

a = 35 ;

g = 65 ;

cout << b << a << g ;

}

a = 50 ;

cout << a << g ;

return 0 ;

}

 

A.
2035655065
B.
2035655035
C.
2035635065
D.
none of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The local values of a and g within the block are more dominant than the global values.
Output:
$ g++ dec1.cpp
$ a.out
2035655065

7.

What will happen when the function call operator is overloaded ?

A.
It will not modify the functions.
B.
It will modify the functions.
C.
It will modify the object.
D.
It will modify the operator to be interpreted.

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

It will modify how the operator is to be interpreted
when applied to objects of a given type.

8.

What is the output of this program ?

  1. #include
  2. using namespace std;
  3. void duplicate (int & a, int & b, int & c)
  4. {
  5. a * = 2 ;
  6. b * = 2 ;
  7. c * = 2 ;
  8. }
  9. int main ()
  10. {
  11. int x = 1 , y = 3 , z = 7 ;
  12.    duplicate ( x, y, z) ;
  13.   cout << x << y << z;
  14. return 0 ;

}

A.
1468
B.
2812
C.
2614
D.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

We are passing the values by reference and modified the data on the function block.
Output:
$ g++ call1.cpp
$ a.out
2614

9.

What will happen when the structure is declared ?

A.
it will not allocate any memory
B.
it will allocate the memory
C.
it will be declared and initialized
D.
none of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

While the structure is declared, it will not be initialized,
So it will not allocate any memory.

10.

Which operator works only with integer variables ?

A.
increment
B.
decrement
C.
both a & b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None

Submit your test now to view the Results and Statistics with answer explanation.