Javatpoint Logo
Javatpoint Logo

17) The 16-bit 2's complement representation of an integer is 1111 1111 1111 0101; its decimal representation is ________.

  1. 9
  2. 11
  3. -11
  4. -13

Answer: C

Explanation:

The given number is in 2's complement representation. Since, its most significant bit (MSB) is 1, so value of this number is negative. Now we have to take 2's complement of given number and then find its decimal value. Therefore,

2's complement of (1111 1111 1111 0101) = (1's complement of (1111 1111 1111 0101) + 1)

= ((0000 0000 0000 1010) + 1) = 0000 0000 0000 1011 = +11

Hence, 2's complement of +11 = -11

Therefore option (C) will be the correct answer.


18) We want to design a synchronous counter that counts the sequence 0-1-0-2-0-3 and then repeats. The minimum number of J-K flip-flops required to implement this counter is ________.

  1. 3
  2. 4
  3. 5
  4. 6

Answer: B

Explanation:

Given,

0→1→0→2→0→3

or, 0000→0001→0100→0010→1000→0011

We can see that there are 6 states in which 3 of them correspond to same states.

To differentiate between 0,1,2,3 we need 2 bits.

To differentiate between three 0's we need another 2 bits.

So, total 4-bits→4FFs

Hence, we need four JK flipflops to implement this counter.


19) A processor can support a maximum memory of 4 GB, where the memory is word-addressable (a word consists of two bytes). The size of the address bus of the processor is at least ________ bits.

  1. 30
  2. 31
  3. 32
  4. None

Answer: B

Explanation:

Given,

Maximum Memory = 4GB = 232 bytes

Size of a word = No of bits per word = 2 bytes

We know,

Size of Memory = No of words (Addresses) * No of bits per word

232 bytes = No of words (Addresses) * 2 bytes

No of words (Addresses) = 231

Therefore, Number of Address lines = 31

Hence option (B) is the correct answer.


20) A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?

  1. Both operations can be performed in O(1) time
  2. At most one operation can be performed in O(1) time but the worst case time for the other operation will be Ω(n)
  3. The worst case time complexity for both operations will be Ω(n)
  4. Worst case time complexity for both operations will be Ω(log n)

Answer: A

Explanation:

Both operations can be performed in O(1) time in Circular queue implementation. In a circular queue the Enqueue and Dequeue operation is done at the last node. It needed a single pointer at last node.


21) Consider the following directed graph:

Gate 2016 CS set 1

The number of different topological orderings of the vertices of the graph is

  1. 2
  2. 4
  3. 6
  4. 8

Answer: C

Explanation:

Here, the given directed graph start with a and end with f. i.e. a _ _ _ _ f

Blank spaces between a _ _ _ _ f are to be filled with b, c, d, e.

So, number of ways to arrange b, c, d, e = 4!/(2!∗2!) = 6

Hence, Final arrangement given below,
   a - b - c - d - e - f
   a - d - e - b - c - f
   a - b - d - c - e - f
   a - d - b - c - e - f
   a - b - d - e - c - f
   a - d - b - e -c - f

Therefore, option (C) will be the correct answer.


22) Consider the following C program.

Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?

  1. f(s,*s)
  2. i = f(i,s)
  3. f(i,*s)
  4. f(i,*p)

Answer: D

Explanation:

f(s,∗s) - In the first option, the 1st argument is short and not int, 2nd argument is a type error. So, it is wrong.

I = f(i,s) - Second option used to store the value of f(i,s) into i. The return type is not void. So, it is wrong.

f(i,∗s) - In the third option, the 1st argument is int, and 2nd argument is a syntax error. So, it is wrong.

f(i,∗p) - In the last option, both the arguments and return type is same. So it doesn't give any error.

Therefore option (D) will be the correct answer.


23) The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

  1. Θ(n log n), Θ(n log n), and Θ( n2 )
  2. Θ(n2 ), Θ( n2 ), and Θ(n log n)
  3. Θ( n2 ), Θ(n log n), and Θ(n log n)
  4. Θ( n2 ), Θ(n log n), and Θ( n2 )

Answer: D

Explanation:

We know,
   Worst case running times of Insertion sort = Θ(n2)
   Worst case running times of Merge sort = Θ(nlogn)
   Worst case running times of Quick sort = Θ(n2)
Therefore option (D) will be the correct answer.


24) Let G be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increased by the same value, then which of the following statements is/are TRUE?

P: Minimum spanning tree of G does not change
Q: Shortest path between any pair of vertices does not change

  1. P only
  2. Q only
  3. Neither P nor Q
  4. Both P and Q

Answer: A

Explanation:

Statement P is true, because if we increase all the weights by the same value, then it will yield the same Minimum spanning tree.

Statement Q is false. We can understand it with the below example.

Before Increase:

Gate 2016 CS set 1

After increase all the weights by 4:

Gate 2016 CS set 1

Before increase, the shortest path between A and B is 14 (A -> C -> B)

After increase by 4, the shortest path between A and B is 19 (A -> B)

Therefore option (A) will be the correct answer.


GATE 2016 CS Set 1-1
GATE 2016 CS Set 1-2
GATE 2016 CS Set 1-4
GATE 2016 CS Set 1-5
GATE 2016 CS Set 1-6
GATE 2016 CS Set 1-7
GATE 2016 CS Set 1-8






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA