GATE CS 2020

Last Updated :
Discuss
Comments

Question 1

Consider the following C program

C++
#include <stdio.h>
int main ()  {
    int  a[4] [5] = {{1, 2, 3, 4, 5},
                    {6, 7,8, 9, 10},
                    {11, 12, 13, 14, 15},
                    {16, 17,18, 19, 20}};
    printf(%d\n, *(*(a+**a+2)+3));
    return(0);
}

The output is

  • 19

  • 18

  • 20

  • 3

Question 2

Consider the following C functions.

C
int tob (int b, int* arr) {
    int i;
    for (i = 0; b>0; i++)  {
        if (b%2)  arr [i] = 1;
        else      arr[i] = 0;
        b = b/2;
    }
    return (i);
}
 

int pp(int a, int b)  {
    int  arr[20];
    int i, tot = 1, ex, len;
    ex = a;
    len = tob(b, arr);
    for (i=0; i<len ; i++) {
         if (arr[i] ==1)
             tot = tot * ex;
         ex= ex*ex;
    }
return (tot) ;
}

The value returned by pp(3,4) is ________ .

Note -

This question was Numerical Type.

  • 81

  • 64

  • 100

  • 49

Question 3

Consider the following statements about process state transitions for a system using preemptive scheduling.

  • I. A running process can move to ready state.
  • II. A ready process can move to running state.
  • III. A blocked process can move to running state.
  • IV. A blocked process can move to ready state.

Which of the above statements are TRUE ?

  • I, II, and III only

  • II and III only

  • I, II, and IV only

  • I, II, III and IV only

Question 4

In a balanced binary search tree with n elements, what is the worst-case time complexity of reporting all elements in the range [a,b]? Assume that the number of reported elements is k.

  • Θ(log n)

  • Θ(log(n)+k)

  • Θ(k log n)

  • Θ(n log k)

Question 5

Consider a graph G=(V, E), where V = { v1,v2,…,v100 }, E={ (vi, vj) ∣ 1≤ i < j ≤ 100} and weight of the edge (vi, vj)  is ∣i–j∣. The weight of minimum spanning tree of G is ________.
 

  • 99

  • 100

  • 98

  • 101

Question 6

The number of permutations of the characters in LILAC so that no character appears in its original position, if the two L’s are indistinguishable, is ________ .


Note - This question was Numerical Type.

  • 12

  • 10

  • 8

  • 15

Question 7

Consider a paging system that uses 1-level page table residing in main memory and a TLB for address translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume that for 20% of the total page faults, a dirty page has to be written back to disk before the required page is read from disk. TLB update time is negligible.

The average memory access time in ns (round off to 1 decimal places) is ___________ .


Note - This question was Numerical Type.

  • 154.5

  • 155

  • 755

  • 725

Question 8

Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process’s memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statement is TRUE ?

  • The hole created by first fit is always larger than the hole created by next fit.

  • The hole created by worst fit is always larger than the hole created by first fit.

  • The hole created by best fit is never larger than the hole created by first fit.

  • The hole created by next fit is never larger than the hole created by best fit.

Question 9

Consider the following five disk five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time.

(P, 155), (Q, 85), (R, 110), (S, 30), (T, 115) 

Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests. Which one of the following statements is FALSE ?

  • T is serviced before P

  • Q is serviced after S, but before T

  • The head reverses its direction of movement between servicing of Q and P

  • R is serviced before P

Question 10

Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block.

The minimum number of disk accesses required to retrieve any record in the database is ___________ .



Note - This question was Numerical Type.

  • 4

  • 6

  • 8

  • 7

Tags:

There are 65 questions to complete.

Take a part in the ongoing discussion