Classical

C Programming MCQ - Constant Variables & Data Types

26:   Which of the following comments regarding the reading of a string, using scanf(with optional) and get is true?
A. Both can be used interchangeably
B. Scanf is delimited by end of line, while gets is not
C. Scanf is delimited by blank, while gets is not
D. All of above
 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



27:  

If integer needs two bytes of storage, then maximum value of a signed interger is

A.

216-1

B.

215-1

C.

216

D.

None of these

 
 

Option: B

Explanation :

In signed magnitude form, one bit is dedicated to store the sign(e.g., 1 for negative and otherwise). Only the remaining 15 bits are available to store the magnitude. Hence the answer.

Click on Discuss to view users comments.

paddhu said: (12:04am on Sunday 25th August 2013)
it's (2^15)-1

Write your comments here:



28:  

The minimum number of temporary variables needed to swap the contents of two variables is

A.

1

B.

2

C.

3

D.

0

 
 

Option: D

Explanation :

without any temporary variable, one can swap two given variables. 

Click on Discuss to view users comments.

Write your comments here:



29:  

 If s and b are integers then  purpose of the following program fragment is to 

   b = s + b ;
   s = b - s ;
   b = b - s ;

 

A.

transfer the contents of s to b

B.

transfer the content of b to s

C.

exchange (swap) the contents of s and b 

D.

negate the contents of s and b

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here:



30:  

If integer needs two bytes of storage, then maximum value of an unsigned integer is

A.

216 - 1

B.

215 - 1

C.

216

D.

215

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:





Suggest an improvement