Classical

C Programming MCQ - Mixed Bag

31:  

How many bits are absolutely necessary to store an ASCII character ?

A.

7

B.

8

C.

16

D.

15

 
 

Option: A

Explanation :


32:  

 a << 1 is equivalent to

A.

multiplying a by 2

B.

dividing a by 2

C.

adding 2 to a

D.

none of the above

 
 

Option: A

Explanation :

The left shift operator <<, pushes out the most significant (left-most) bit. If it happens to be a 1 , a << 1, will not be same as multiplying a by 2


33:  

Assume an unsigned integer occupies 1 byte. Let myVar be an unsigned integer. Then myVar « 1 multiplies myVar by 2 if it is not greater than

A.

127

B.

255

C.

256

D.

128

 
 

Option: A

Explanation :

If the most significant bit is to be zero, the maximum number that can be swred in 7 bits is 127.


34:  

In a certain machine, the sum of an integer and its 1's complement is 226 - 1. Then sizeof intl. in bits, will be

A.

16

B.

32

C.

unpredictable

D.

none of above

 
 

Option: D

Explanation :

The sum (or bit-wise OR) of a number and its complement will be all 1's. How many 1's depends on how many bits are needed to represent the number. lithe sum is 220 - 1. then the sizeof(int) in bits must be 20.


35:  

 Which of the following comments about the preprocessor directive # are correct?

A.

It converts the formal argument in the macro definition into a string

B.

It strips out redundant blanks

C.

It concatenates adjacent strings, if any.

D.

All of the above

 
 

Option: D

Explanation :




Suggest an improvement