C++ Language | 10 Minute‐Test 8


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.

The value 132.54 can represented using which data type ?

A.
double
B.
void
C.
int
D.
bool

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The given value is with decimal points, so float or double can be used.

2.

What is the value of the following 8-bit integer after all statements are executed?
int x = 1;
x = x << 7;
x = x >> 7;

A.
1
B.
-1
C.
127
D.
implementaton defined

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Right shift of signed integers is undefined, and has
implementation-defined behaviour.

3.

Which of these expressions will make the rightmost set bit zero in an input integer x?

A.
x = x | (x-1
B.
x = x & (x-1)
C.
x = x | (x+1)
D.
x = x & (x+1)

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

4.

Which one of the following is not a possible state for a pointer.

A.
hold the address of the specific object
B.
point one past the end of an object
C.
zero
D.
point to a tye

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

:A pointer can be in only 3 states a,b and c.

5.

Which of the given statements are false ?
1. extern int func;
2. extern int func2(int,int);
3. int func2(int,int);
4. extern class foo;

A.
3 and 4 only
B.
2 and 3 only
C.
only 4
D.
2, 3 and 4

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

No extern are allowed for class declarations.

6.

What is the use of function call operator ?

A.
overloading the methods
B.
overloading the objects
C.
overloading the parameters
D.
none of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None

7.

What is the name of the myfile2 file after executing this program ?

#include <stdio.h>

int main ()

{

int result ;

char oldname [] = "myfile2.txt" ;

char newname [] = "newname.txt" ;

result = rename( oldname, newname );

if ( result == 0 )

puts ( "success" ) ;

else

perror( "Error" ) ;

return 0 ;

}

 

A.
name
B.
new
C.
newname
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

In this program, We are renaming the myfile2 to newname by using the function rename.
Output:
myfile2.txt is renamed to newname.txt

8.

The data elements in structure are also known as what ?

A.
objects
B.
members
C.
data
D.
none of the above

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None

9.

What is the index number of the last element of an array with 9 elements ?

A.
99
B.
8
C.
0
D.
Programmer defined

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Because the first element always starts at 0. So it is on 8 position.


10.

Which symbol is used to create multiple inheritance ?

A.
Dot
B.
Comma
C.
Dollar
D.
none of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

:For using multiple inheritance, simply specify each base class
(just like in single inheritance), separated by a comma.

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