Javatpoint Logo
Javatpoint Logo

GATE 2017 CS Set 1

17) Consider the following grammar

p → xQRS
Q → yz|z
R → w|∈
S → y

Which is FOLLOW(Q)?

  1. {R}
  2. {w}
  3. {w, y}
  4. {w, ∉}

Answer: C

Explanation:

Given,

   p → xQRS
   Q → yz|z
   R → w|∈
   S → y

Now,

FOLLOW(Q) = FIRST(RS)
       = { w, ∈ } υ FIRST(S)
       = {w, y}

Therefore option (C) is the correct answer.


18) Threads of a process share

  1. global variables but not heap
  2. heap but not global variables
  3. neither global variables nor heap
  4. both heap and global variables

Answer: D

Explanation:

According to the definition, a thread shares all other resources a process's to which it belongs to, i.e. Code section, Data section (static + heap), Address Space, Permissions, Other resources (e.g., files). It does not share register and stack.

Therefore, option (D) is the correct answer.


19) Let X be a Gaussian random variable with mean 0 and variance σ2. Let Y = max(X,0) where max(a,b) is the maximum of a and b. The median of Y is _____.

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

Answer: A

Explanation:

The median of Y defines as the least value m such that P(Y⩽m)>1/2.

Given, Y = max{0,X},

then: P(Y⩽0) = P(Y=0) = P(X⩽0) = 1/2 because X is symmetrically distributed to 0.

Therefore, median of Y is 0.

Hence, option (A) is the correct answer.


20) Let T be a tree with 10 vertices. The sum of the degrees of all the vertices in T is _____.

  1. 18
  2. 19
  3. 20
  4. 21

Answer: A

Explanation:

Given,
   Total vertices (v) = 10
   We know, Tree with n vertices have n-1 edges.
   ∴ Edge (e) = v - 1 = 9
   Therefore, sum of the degrees of all the vertices = 2 * e = 18

Hence option (A) is the correct answer.


21) Consider the Karnaugh map given below, where X represents "don't care" and blank represents 0.

Gate 2017 CS set 1

Assume for all inputs (a, b, c, d) the respective complements (a', b', c', d') are also available. The above logic is implemented 2-input NOR gates only. The minimum number of gates required is ____________.

  1. 1
  2. 2
  3. 3
  4. 4

Answer: A

Explanation:

Solving the above k- map we get the following min-term,
     F(a,b,c,d) = ca' = ((ca')')' = (c' + a)'

Here, we can see that the min-term also contains the complement of variables. Therefore, the above k-map can be implemented by using one NOR gate.

Hence option (A) is the correct answer.


22) Consider the language L given by the regular expression (a + b) *b(a + b) over the alphabet {a, b}. The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting L is ______.

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

Answer: B

Explanation:

Gate 2017 CS set 1

Minimizing NFA to DFA:

Gate 2017 CS set 1
Delta a b
A A AB
AB *AC *ABC
*AC A AB
*ABC *AC *ABC

From the above table we get,

Gate 2017 CS set 1

So, final state will be the state which containing C. Hence no. of state will be 4.

Therefore option(B) is the correct answer.


23) Consider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given below:

EMP
EmpId EmpName DeptName
1 XYA AA
2 XYB AA
3 XYC AA
4 XYD AA
5 XYE AB
6 XYF AB
7 XYG AB
8 XYH AC
9 XYI AC
10 XYJ AC
11 XYK AD
12 XYL AD
13 XYM AE

SELECT AVG(EC.Num)
FROM EC
WHERE (DeptName, Num) IN
   (SELECT DeptName, COUNT(EmpId) AS
             EC(DeptName, Num)
   FROM EMP
   GROUP BY DeptName)

The output of executing the SQL query is _______.

  1. 1.2
  2. 2.3
  3. 2.6
  4. 3.1

Answer: C

Explanation:

Executing the inner SQL Query, the output will be:

DeptName Number
AA 4
AB 3
AC 3
AD 2
AE 1

Then the AVG(EC.Num) will find average of Number values in above returned query,
= 4 + 3 + 3 + 2 + 1 = 13 / 5 = 2.6

Therefore option (C) is the correct answer.


24) Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below:

Process Arrival Time Burst Time
P1 0 7
P2 3 3
P3 5 5
P4 6 2

If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _______ milliseconds.

  1. 1
  2. 2
  3. 3
  4. 4

Answer: C

Explanation:

P1 P2 P4 P1 P3
0  3  6  8  12  17

   Turn around time:
   P1 = 12-0 = 12
   P2 = 6 - 3 = 3
   P3 = 17 - 5 = 12
   P4 = 8 - 6 = 2

Waiting time:
   P1 = 12 - 7 = 5
   P2 = 3 - 3 = 0
   P3 = 12 - 5 = 7
   P4 = 2 - 2 = 0
Now, Average waiting time = (5 + 0 + 7 + 0) / 4 = 3

Therefore option (C) is the correct answer.


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