Javatpoint Logo
Javatpoint Logo

GATE 2017 CS Set 2

49) In a B+ tree, if the search-key value is 8 bytes long, the block size is 512 bytes and the block pointer is 2 bytes, then the maximum order of the B+ tree is ____.

  1. 50
  2. 51
  3. 52
  4. 53

Answer: C

Explanation:

Let order of B+ tree is k then the maximum number of child pointers = k, and
The maximum number of keys = k-1.
Given, Search key value = 8 bytes
Block Size = 512 bytes
Block Pointer = 2 bytes

Now, to accommodate all child pointers and search key, the total size of these together should not exceed 512 bytes.

Thus, (k-1)*(search key) + k * block pointer <= block size
2K + 8(K-1) <= 512
2K + 8k - 8 <= 512
10K <= 520
K <= 520 /10
K <= 52

Therefore option (C) is the right answer.


50) A message is made up entirely of characters from the set X = {P, Q, R, S, T}. The table of probabilities of each character is shown below:

Character Probability
P 0.22
Q 0.34
R 0.17
S 0.19
T 0.08
Total 1.00

A message of 100 characters over X is encoded using Huffman coding, then the excepted length of the encoded message in bits is _____.

  1. 225
  2. 226
  3. 227
  4. 228

Answer: A

Explanation:

In Huffman coding, we pick the two smallest frequent character value, then combine them and create a new node.

Gate 2017 CS set 2

From the above tree structure, Number of bits required by each:

   P = 2
   Q = 2
   R = 3
   S = 2
   T = 3

Therefore, excepted length of the encoded message,
   = no. of bit * frequency of occurance of each alphabet
   = 3*0.8 + 3*0.17 + 2*0.19 + 2 *0.22 + 2*0.34 = 2.25
So for 100 characters, 2.25*100 = 225
Therefore, option (A) is the correct answer.


51) Consider the set of processes with arrival time (in milliseconds), CPU burst time (in milliseconds), and priority(0 is the highest priority) shown below. None of the processes have I/O burst time.

Process Arrival Time Burst Time Priority
P1 0 11 2
P2 5 28 0
P3 12 2 3
P4 2 10 1
P5 9 16 4

The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is ____.

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

Answer: A

Explanation:

Gantt Chart is given below,

Gate 2017 CS set 2

Waiting Time = 0 + 0 + (33-5) + (40 -2) + (49-12) + (51-9)
       = 0 + 0 + 28 + 38 + 37 + 42 = 145
Average waiting Time = 145 / 5 = 29

Therefore option (A) is the right answer.


52) If the characteristic polynomial of a 3 3 matrix M over R (the set of real numbers) is λ3 - 4λ2 + aλ + 30, where a ∈ R, and one eigen value of M is 2, then the largest among the absolute values of the eigenvalues of M is _______.

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

Answer: D

Explanation:

Given,
    Eigen Value ( λ ) = 2. So, it must be satisfy the follwing characterstic polynomial equation:
    23 - 4 ? 22 + 2a + 30 = 0
    ∴ a = -11
Now, Characterstic equation would be:
    => λ3 - 4λ2 - 11λ + 30
    => (λ-2) (λ-5) (λ+3) = 0
    => λ = 2, 5, -3
Longest absolute value value of λ = 5
Therefore option (D) is the right answer.


53) Consider a machine with byte addressable memory of 232 bytes divided into blocks of size 32 bytes. Assume a direct mapped cache having 512 cache lines is used with this machine. The size of tag field in bits is _____.

  1. 12
  2. 20
  3. 18
  4. 16

Answer: C

Explanation:

Given,
Block Size = 32 bytes = 25 bytes
Total Address Space = 232 bytes
Number of lines in Cache Memory = 512 = 29
We know, Tag bits + no. of Lines in cache + Block size = 32
∴ Tag bits + 9 + 5 = 32
So, Tag bits = 18
Therefore option (C) is the correct answer.


54) Consider the following C program:

The output of the program is ______.

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

Answer: A

Explanation:

int m = 10;
   int n, n1;
   n = ++m;   //n=11 m=11
   n1 = m++;   //n1=11 m=12
   n--;   //n=10
   --n1;   //n1=10
   n -= n1;   //n=n-n1 <==> 10-10=0
   printf("%d",n);   //print 0

Therefore option (A) will be the right answer.


55) Consider the following program

The Output of the following program is____.

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

Answer: B

Explanation:

Given Statement:
   char ∗ c = "GATECSIT2017";
   printf("%d", (int)strlen(c+2[p]-6[p]-1));
=> c + 2[p] ? 6[p] - 1
2[p] = ∗(2+p) = p[2] = T
6[p] = ∗(6+p) = p[6] = I
c = c[0] = G
? G + T ? I -1 = 7 + 20 ? 9 ? 1 = 17
Hence, length = 2
Therefore option (B) is the right answer.


56) Chose the option with words that are not synonyms.

  1. aversion, dislike
  2. luminous, radiant
  3. plunder, loot
  4. yielding, resistant

Answer: D

Explanation:

In option (D), the meaning of yield is: to give in, and meaning of resistance is: to not give in, so it is not synonyms. All other options are synonyms. Therefore option (D) will be the right answer.


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