C++ Language | 10 Minute‐Test 6


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.

Identify the user-defined types from the following ?

A.
enumeration
B.
classes
C.
both a and b
D.
int

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

They must be defined by the users before use unlike the other types which are
readily available.

2.

For what values of the expression is an if-statement block not executed ?

A.
0 and all negative values
B.
0 and -1
C.
.0
D.
0, all negative values, all positive values except 1

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The if-statement block is only not executed when the expression evaluates to 0. It’s just syntactic sugar for a
branch-if-zero instruction.

3.

What is the output of this program ?

    #include <stdio.h>

    int main()

    {

        char a = '\012 ';

 

        printf ("%d" , a );

        return 0;

    }

 

A.
Compilation error
B.
12
C.
10
D.
Empty

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The value ‘\012’ means the character with value 12 in octal, which is decimal 10.

4.

The operator used for dereferencing or indirection is ____

A.
*
B.
&
C.
_>
D.
_>>

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None

5.

Choose the correct option.
extern int i;
int i;

A.
both 1 and 2 declare i
B.
1 declares the variable i and 2 defines i
C.
1 declares and defines i, 2 declares i
D.
1 declares i,2 declares and defines i

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The keyword extern is not a definition and is not allocated storage until it is initialized.

6.

Identify the incorrect statements.
int var = 10;
int *ptr = &(var + 1); //statement 1
int *ptr2 = &var; //statement 2
&var = 40; //statement 3

A.
Statement 1 and 2 are wrong
B.
Statement 2 and 3 are wrong
C.
Statement 1 and 3 are wrong
D.
All the three are wrong

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

In statement 1 lvalue is required as unary ‘&’ operand
and in statement 3 lvalue is required as left operand.

7.

How many streams are automatically created when executing a program ?

A.
1
B.
2
C.
3
D.
4

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

There are streams that are automatically created when executing a program.
They are stdin, stdout and stderr.

8.

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 the operator to be interpreted.



9.

Which of the following accesses a variable in structure *b ?

A.
b->var;
B.
b.var;
C.
b-var;
D.
b>var;

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Because in a structure pointer, the data element is declared as above only.



10.

Which concepts does the preincrement uses ?

A.
Call by value
B.
Call by reference
C.
queue
D.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

none

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