Javatpoint Logo
Javatpoint Logo

GATE 2017 CS Set 2

9) Consider the following statements about the routing protocols, Routing Information Protocol(RIP) and Open Shortest Path First(OSPF) in an IPv4 network.

I. RIP uses distance vector routing
II. RIP packets are sent using UDP
III. OSPF packets are sent using TCP
IV. OSPF operation is based on link-state routing

Which of the following above are CORRECT?

  1. I and IV only
  2. I, II and III only
  3. I, II and IV only
  4. II, III and IV only

Answer: C

Explanation:

Statement (1)-> is "CORRECT". RIP is the DVR protocol which employs the hop count as a routing metric.

Statement (2)-> is "CORRECT". RIP uses the UDP as its transport protocol and is assigned the reserved port no 520.

Statement (3)-> is "INCORRECT." OSPF does not use a transport protocol, such as UDP (or) TCP, but encapsulates its data directly in IP packets.

Statement (4)-> is "CORRECT". OSPF is a routing protocol which uses link state routing (LSR) and works within a single autonomous system.

Therefore option (C) is the right answer.


10)

Gate 2017 CS set 2

Answer: C

Explanation:

Gate 2017 CS set 2

11) Let p, q, r denote the statement "It is raining", "It is cold", and "It is pleasant", respectively. Then the statement "It is not raining and it is pleasant, and it is not pleasant only if it is raining and it is cold" is represented by:

  1. (¬ p ∧ r) ∧ ((¬ r → (p ∧ q))
  2. (¬ p ∧ r) ∧ ((p ∧ q) → ¬ r)
  3. (¬ p ∧ r) ∨ ((p ∧ q) → ¬ r)
  4. (¬ p ∧ r) ∨ ((r → (p ∧ q))

Answer: A

Explanation:

p = It is raining, q = It is cold, and r = It is pleasant

It is not raining and it is pleasant = (¬ p ∧ r)

It is not pleasant only if it is raining and it is cold = ¬r → (p∧q)

So the given statement is represented by: (¬ p ∧ r) ∧ ((¬ r → (p ∧ q))

Therefore option (A) will be the right answer.


12) Given the following binary number in 32 bit (single precision) IEEE-754 format:

00111110011011010000000000000000

The decimal value closest to this floating-point number is:

  1. 1.45 * 101
  2. 1.45 * 10-1
  3. 2.27 * 10-1
  4. 2.27 * 101

Answer: C

Explanation:

In 32 bit (single precision) IEEE-754 format, a binary number can be represented in three parts: Sign-bit(1 bit) Exponent-bits(8 bit), and Mantissa-bits(23 bits) where the exponent is represented with Excess-127 code.
Give, 00111110011011010000000000000000
Here, Sign-bit = 0, So number is positive.

     Exponent-bits = 01111100 = 124
         ∴ E = 124-127 = -3 (Excess-127)
           Mantissa bits = 11011010000000000000000
         ∴ Number = 1.1101101 (Implicit normalization).
∴ Decimal value of this floating point number = 1.1101101?2-3
                 = 0.0011101101
                 = 0.227 = 2.27 *10-1

Therefore option (C) is the right answer


13) A Circular queue has been implemented using singly linked list where each node consists of a value and a pointer to next node. We maintain exactly two pointers FRONT and REAR pointing to the front node and rear node of queue. Which of the following statements is/are correct for circular queue so that insertion and deletion operations can be performed in O(1) i.e. constant time.

I. Next pointer of front node points to the rear node.
II. Next pointer of rear node points to the front node.

  1. I only
  2. II only
  3. Both I and II
  4. Neither I nor II

Answer: B

Explanation:

Gate 2017 CS set 2

Here circular queue deletes an item from the front pointer and inserts an element by using the rear pointer. So to insert an element, we need to increment the rear pointer to next node then insert element. After an update, the next pointer of the rear node points to the front node.

Therefore option (B) will be the right answer.


14) Consider the following function implemented in C:

The output of the printxy(1,1) is

  1. 0,0
  2. 0,1
  3. 1,0
  4. 1,1

Answer: C

Explanation:

In the loop first, it assigned x=0 then ptr is pointing to x.

So, ∗ ptr = 0

Then, it will copy the value of ptr to y, so the value of y = 0

Now ∗ ptr = 1 -> value of ptr is changed to 1. So the location of x modified itself. As it is pointing to x thus x will also be changed to 1.

Thus, 1,0 will be the output.

Therefore option (C) is the right answer.


15) Breath First Search(BFS) has been implemented using queue data structure.

Gate 2017 CS set 2

Which one of the following is a possible order of visiting the nodes in the graph above.

  1. MNOPQR
  2. NQMPOR
  3. QMNROP
  4. POQNMR

Answer: D

Explanation:

When we start BFS from vertex Q, we get three nodes {M, N, P} to insert next in queue. These nodes can be inserted in any order because representation is not defined that why the order POQNMR might be correct. Therefore option (B) is the right answer.


16) Identity the language generated by following grammar where S is the start variable.

S --> XY
X --> aX | a
Y --> aYb | ∈

  1. {am bn| m>=n, n>0 }
  2. {am bn| m>=n, n>=0 }
  3. {am bn| m>n, n>=0 }
  4. {am bn| m>n, n>0 }

Answer: C

Explanation:

The given grammar is:

   S --> XY
   X --> aX | a
   Y --> aYb | ∈

From terminal X we can generate any number of a's including a single 'a'. From terminal Y we can generate equal number of a's and b's.

Thus the language generated by above grammar is: {am bn| m>n, n>=0 }

Therefore option (C) is the right answer.


GATE 2017 CS Set 2-1
GATE 2017 CS Set 2-3
GATE 2017 CS Set 2-4
GATE 2017 CS Set 2-5
GATE 2017 CS Set 2-6
GATE 2017 CS Set 2-7
GATE 2017 CS Set 2-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