Gate CS-2016-1 Question Paper With Solutions

Q. 51 Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below.

Gate CS-2016-1 Question Paper With Solutions

The maximum possible number of iterations of the while loop in the algorithm is______

(A) 16

(B) 32

(C) 256

(D) 64

Answer: (C)

Explanation:

Gate CS-2016-1 Question Paper With Solutions

Gate CS-2016-1 Question Paper With Solutions

Gate CS-2016-1 Question Paper With Solutions

Learn More:   Gate ME-2008 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here