GATE CS 2011 (original) (raw)

A thread is usually defined as a "light weight process" because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the following is TRUE?

The time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE?

Let the page fault service time be 10ms in a computer with average memory access time being 20ns. If one page fault is generated for every 10^6 memory accesses, what is the effective access time for the memory?

An application loads 100 libraries at start-up. Loading each library requires exactly one disk access. The seek time of the disk to a random location is given as 10 ms. Rotational speed of disk is 6000 rpm. If all 100 libraries are loaded from random locations on the disk, how long does it take to load all libraries? (The time to transfer data from the disk block once the head has been positioned at the start of the block may be neglected)

A computer handles several interrupt sources of which the following are relevant for this question.

. Interrupt from CPU temperature sensor (raises interrupt if
CPU temperature is too high)
. Interrupt from Mouse(raises interrupt if the mouse is moved
or a button is pressed)
. Interrupt from Keyboard(raises interrupt when a key is
pressed or released)
. Interrupt from Hard Disk(raises interrupt when a disk
read is completed)

Which one of these will be handled at the HIGHEST priority?

Consider the same recursive function that takes two arguments

C++ `

unsigned int foo(unsigned int n, unsigned int r) { if (n > 0) return (n % r + foo(n / r, r)); else return 0; }

C

unsigned int foo(unsigned int n, unsigned int r) { if (n > 0) return (n % r + foo(n / r, r)); else return 0; }

Java

public class Main { public static int foo(int n, int r) { if (n > 0) return (n % r + foo(n / r, r)); else return 0; } }

Python

def foo(n, r): if n > 0: return (n % r + foo(n // r, r)) else: return 0

JavaScript

function foo(n, r) { if (n > 0) return (n % r + foo(Math.floor(n / r), r)); else return 0; }

`

What is the return value of the function foo when it is called as foo(513, 2)?

Consider the following recursive C++ function that takes two arguments

C++ `

unsigned int foo(unsigned int n, unsigned int r) { if (n > 0) return (n%r + foo (n/r, r )); else return 0; }

C

unsigned int foo(unsigned int n, unsigned int r) { if (n > 0) return (n % r + foo(n / r, r)); else return 0; }

Java

public class Main { public static int foo(int n, int r) { if (n > 0) return (n % r + foo(n / r, r)); else return 0; } }

Python

def foo(n, r): if n > 0: return (n % r + foo(n // r, r)) else: return 0

JavaScript

function foo(n, r) { if (n > 0) return (n % r + foo(Math.floor(n / r), r)); else return 0; }

`

What is the return value of the function foo when it is called foo(345, 10)?

The following is the comment written for a C function.

    /* This function computes the roots of a quadratic equation  
       a.x^2 + b.x + c = . The function stores two real roots  
       in *root1 and *root2 and returns the status of validity  
       of roots. It handles four different kinds of cases.  
       (i) When coefficient a is zero irrespective of discriminant  
       (ii) When discriminant is positive  
       (iii) When discriminant is zero  
       (iv) When discriminant is negative.  
       Only in case (ii) and (iii) the stored roots are valid.  
       Otherwise 0 is stored in roots. The function returns  
       0 when the roots are valid and -1 otherwise.  
       The function also ensures root1 >= root2  
          int get_QuadRoots( float a, float b, float c,  
             float *root1, float *root2);  
    */

A software test engineer is assigned the job of doing black box testing. He comes up with the following test cases, many of which are redundant.

Which one of the following option provide the set of non-redundant tests using equivalence class partitioning approach from input perspective for black box testing?

An undirected graph G(V, E) contains n ( n > 2 ) nodes named v1 , v2 ,….vn. Two nodes vi , vj are connected if and only if 0 < |i – j| <= 2. Each edge (vi, vj ) is assigned a weight i + j. A sample graph with n = 4 is shown below.

What will be the cost of the minimum spanning tree (MST) of such a graph with n nodes?

Consider the same data as given in previous question. After the update in the previous question, the link N1-N2 goes down. N2 will reflect this change immediately in its distance vector as cost, infinite. After the NEXT ROUND of update, what will be cost to N1 in the distance vector of N3?

There are 65 questions to complete.

Take a part in the ongoing discussion