• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 1996

Question 61

A complete, undirected, weighted graph G is given on the vertex {0, 1,...., n−1} for any fixed ‘n’. Draw the minimum spanning tree of G if a) the weight of the edge (u,v) is ∣ u−v ∣ b) the weight of the edge (u,v) is u + v

    Question 62

    Consider the following program that attempts to locate an element x in a sorted array a[ ] using binary search. Assume N>1. The program is erroneous. Under what conditions does the program fail?

    var i,j,k: integer;  x: integer;
        a: array; [1....N] of integer;
    begin	i:= 1; j:= N;
    repeat	
        k:(i+j) div 2;
        if a[k] < x then i:= k 
        else j:= k 
    until (a[k] = x) or (i >= j);
        
    if (a[k] = x) then
        writeln (\'x is in the array\')
    else
        writeln (\'x is not in the array\')
    end;
    
    • x is the last element of the array a[]

    • x is greater than all elements of the array a[]

    • Both of the Above

    • x is less than the last element of the array a[]

    Question 63

    Consider the following program in pseudo-pascal syntax. What is printed by the program if parameter in procedure test1 is passed as i) call-by-reference parameter ii) call-by-value-result parameter
    program Example (input, output)
    var b: integer;
    procedure test2:
    begin b:=10; end
    procedure test1 (a:integer):
    begin 	a:=5;
            writeln (\'point 1: \', a, b);
            test2;
            writeln (\'point 2: \', a, b);
    end
    begin (*Example*)
    b:=3; test1(b);
    writeln(\'point3: \', b);
    end
    
    

      Question 64

      Consider the syntax-directed translation schema (SDTS) shown below:
      E → E + E         {print “+”}
      E → E ∗ E         {print “.”}
      E → id            {print id.name}
      E → ( E )
      
      An LR-parser executes the actions associated with the productions immediately after a reduction by the corresponding production. Draw the parse tree and write the translation for the sentence (a+b)(c+d), using the SDTS given above.

        Question 65

        The concurrent programming constructs fork and join are as below: fork <label>         which creates a new process executing from the specified label join <variable>    which decrements the specified synchronization variable (by 1) and terminates the process if the new value is not 0. Show the precedence graph for S1, S2, S3, S4, and S5 of the concurrent program below.
           N = 2
           M = 2
           fork L3
           fork L4
           S1
        L1:join N
           S3
        L2:join M
           S5
        L3:S2
           goto L1
        L4:S4
           goto L2
        next:
        
        

          Question 66

          A computer system uses the Banker’s Algorithm to deal with deadlocks. Its current state is shown in the table below, where P0, P1, P2 are processes, and R0, R1, R2 are resources types. 

          [caption width="800"] [/caption]

             a) Show that the system can be in this state. b) What will the system do on a request by process P0 for one unit of resource type R1?

          •  The current state of the system is possible because this can be part of one of the safe sequence. For example, following this state the system can follow P1->P2->P0 this sequence and will not lead to Deadlock, So, yes the system can be in this state

          • The system can allocate one unit of resource R1 to P0 and still will not lead to Deadlock, again it can still follow P1->P2->P0 sequence.

          Question 67

          A file system with a one-level directory structure is implemented on a disk with disk block size of 4K bytes. The disk is used as follows: disk_block             a) What is the maximum possible number of files? b) What is the maximum possible file size in blocks?

            Question 68

            Consider the synchronous sequential circuit in the below figure cloc         a) Draw a state diagram, which is implemented by the circuit. Use the following names for the states corresponding to the values of flip-flops as given below. flip           b) Given that the initial state of the circuit is S4, identify the set of states, which are not reachable.

              Question 69

              A hard disk is connected to a 50 MHz processor through a DMA controller. Assume that the initial set-up of a DMA transfer takes 1000 clock cycles for the processor, and assume that the handling of the interrupt at DMA completion requires 500 clock cycles for the processor. The hard disk has a transfer rate of 2000 Kbytes/sec and average block transferred is 4 K bytes. What fraction of the processor time is consumed by the disk, if the disk is actively transferring 100% of the time?  

              [caption width="800"] [/caption]

                         .

              • 1.5%

              • 1%

              • 2.5%

              • 10%

              Question 70

              A computer system has a three level memory hierarchy, with access time and hit ratios as shown below: cache_mem1         a) What should be the minimum sizes of level 1 and 2 memories to achieve an average access time of less than 100 nsec? b) What is the average access time achieved using the chosen sizes of level 1 and level 2 memories?

                There are 75 questions to complete.

                Last Updated :
                Take a part in the ongoing discussion