Contents

To implement a stack using queue(with only enqueue and dequeue operations), how many queues will you need?
a) 1                        
b) 2                        
c) 3                        
d) 4

b

Explanation: Either the push or the pop has to be a costly operation, and the costlier operation requires two queues.


Express -15 as a 6-bit signed binary number.
a) 001111                            
b) 101111
c) 101110                             
d) 001110

b

Explanation: The first 4 1s from the right represent the number 15, 2 more bits are padded to make it 6 digits and the leftmost bit is a 1 to represent that it is -15.