• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Gate IT 2005

Question 51

A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the tree is traversed in pre-order and the values in each node printed out, the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is traversed in post-order, the sequence obtained would be  
  • 8, 7, 6, 5, 4, 3, 2, 1
  • 1, 2, 3, 4, 8, 7, 6, 5
  • 2, 1, 4, 3, 6, 7, 8, 5
  • 2, 1, 4, 3, 7, 8, 6, 5

Question 52

Let G be a directed graph whose vertex set is the set of numbers from 1 to 100. There is an edge from a vertex i to a vertex j if either j = i + 1 or j = 3i. The minimum number of edges in a path in G from vertex 1 to vertex 100 is    

  • 4

  • 7

  • 23

  • 99

Question 53

What is the output printed by the following program? C
#include<stdio.h>
int f(int n, int k)
{
    if (n == 0)
        return 0;
    else if (n % 2)
        return f(n/2, 2*k) + k;
    else return f(n/2, 2*k) - k;
}
int main ()
{
    printf(\"%d\", f(20, 1));
    return 0;
}
  • 5
  • 8
  • 9
  • 20

Question 54

Let a be an array containing n integers in increasing order. The following algorithm determines whether there are two distinct numbers in the array whose difference is a specified number S > 0. C
i = 0;
j = 1;
while (j < n )
{
    if (E) j++;
    else if (a[j] - a[i] == S) break;
    else i++;
}
if (j < n)
    printf(\"yes\")
else
   printf (\"no\");

Choose the correct expression for E.

   
  • a[j] - a[i] > S
  • a[j] - a[i] < S
  • a[i] - a[j] < S
  • a[i] - a[j] > S

Question 55

Let a and b be two sorted arrays containing n integers each, in non-decreasing order. Let c be a sorted array containing 2n integers obtained by merging the two arrays a and b. Assuming the arrays are indexed starting from 0, consider the following four statements
  1. a[i] ≥ b [i] => c[2i] ≥ a [i]
  2. a[i] ≥ b [i] => c[2i] ≥ b [i]
  3. a[i] ≥ b [i] => c[2i] ≤ a [i]
  4. a[i] ≥ b [i] => c[2i] ≤ b [i]
Which of the following is TRUE?
  • only I and II
  • only I and IV
  • only II and III
  • only III and IV

Question 56

We wish to schedule three processes P1, P2 and P3 on a uniprocessor system. The priorities, CPU time requirements and arrival times of the processes are as shown below.
 
 Process   Priority          CPU time required     Arrival time (hh:mm:ss)  
 P1 10(highest) 20 sec 00:00:05
 P2 9 10 sec 00:00:03
 P3 8 (lowest) 15 sec 00:00:00

We have a choice of preemptive or non-preemptive scheduling. In preemptive scheduling, a late-arriving higher priority process can preempt a currently running process with lower priority. In non-preemptive scheduling, a late-arriving higher priority process must wait for the currently executing process to complete before it can be scheduled on the processor.

 What are the turnaround times (time from arrival till completion) of P2 using preemptive and non-preemptive scheduling respectively.

  • 30 sec, 30 sec

  • 30 sec, 10 sec

  • 42 sec, 42 sec

  • 30 sec, 42 sec

Question 57

Consider a 2-way set associative cache memory with 4 sets and total 8 cache blocks (0-7) and a main memory with 128 blocks (0-127). What memory blocks will be present in the cache after the following sequence of memory block references if LRU policy is used for cache block replacement. Assuming that initially the cache did not have any memory block from the current job? 0 5 3 9 7 0 16 55  

  • 0 3 5 7 16 55

  • 0 3 5 7 9 16 55

  • 0 5 7 9 16 55

  • 3 5 7 9 16 55

Question 58

In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can\'t mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the book keeping information for the blocks allocated for storing the file. A disk block can store either bookkeeping information for a file or data from a file, but not both. What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?

  • 35400 and 35800 bytes

  • 35800 and 35400 bytes

  • 35600 and 35400 bytes

  • 35400 and 35600 bytes

Question 59

The availability of a complex software is 90%. Its Mean Time Between Failure (MTBF) is 200 days. Because of the critical nature of the usage, the organization deploying the software further enhanced it to obtain an availability of 95%. In the process, the Mean Time To Repair (MTTR) increased by 5 days. What is the MTBF of the enhanced software  
  • 205 days
  • 300 days
  • 500 days
  • 700 days

Question 60

To carry out white box testing of a program, its flow chart representation is obtained as shown in the figure below:cc   For basis path based testing of this program, its cyclomatic complexity is
  • 5
  • 4
  • 3
  • 2

There are 90 questions to complete.

Last Updated :
Take a part in the ongoing discussion