• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 2021 | Set 2

Question 51

Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string ϵ is divisible by three.
  • (0+1(01*0)*1)*
  • (0+11+10(1+00)*01)*
  • (0*(1(01*0)*1)*)*
  • (0+11+11(1+00)*00)*

Question 52

Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below: The page size is 4 KB = (1KB = 210 bytes) and page table entry size at every level is 8 bytes. A process P is currently using 2 GB (1 GB = 230 bytes) virtual memory which OS mapped to 2 GB of physical memory. The minimum amount of memory required for the page table of P across all levels is _________ KB
  • 4108
  • 1027
  • 3081
  • 4698

Question 53

Consider the following ANSI C program
#include 
int foo(int x, int y, int q) 
    {
        if ((x<=0) && (y<=0))
        return q;
        if (x<=0)
        return foo(x, y-q, q);
        if (y<=0)
        return foo(x-q, y, q);
        return foo(x, y-q, q) + foo(x-q, y, q);
    }
int main( )
{
    int r = foo(15, 15, 10);
    printf(“%d”, r);
    return 0;
} 
The output of the program upon execution is _________ .
  • 60
  • 10
  • 15
  • 50

Question 54

Let S be a set of consisting of 10 elements. The number of tuples of the form (A,B) such that A and B are subsets of S, and A⊆B is ___________ .
  • 59049
  • 1024
  • 50049
  • 59000

Question 55

Consider the following augmented grammar with {#,@,<,>,a,b,c} as the set of terminals.
S′ → S
S → S#cS
S → SS
S → S@
S → <S>
S → a
S → b
S → c 
Let I0=CLOSURE({S′→∙S}). The number of items in the set GOTO(GOTO(I0 <), <) is ___________ .
  • 8
  • 7
  • 5
  • 9

Question 56

Consider a Boolean function f(w,x,y,z) such that
f(w,0,0,z) = 1
f(1,x,1,z) = x+z
f(w,1,y,z) = wz+y
The number of literals in the minimal sum-of-products expression of f is _________ .
  • 6
  • 3
  • 8
  • 1

Question 57

Consider a pipelined processor with 5 stages, Instruction Fetch(IF), Instruction Decode(ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and the register read is performed in the EX stage, The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies. Consider the following sequence of 8 instructions:
ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL 
Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The speedup defined as follows.
Speedup = (Execution time without operand forwarding) / (Execution time with operand forwarding)
The Speedup achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is _____________ .
  • 1.875
  • 1.5625
  • 2
  • 1.667

Question 58

In a directed acyclic graph with a source vertex s, the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a vertex v other than s, the quality-score of v is defined to be the maximum among the quality-scores of all the paths from s to v. The quality-score of s is assumed to be 1. The sum of the quality-scores of all vertices on the graph shown above is _______ .
  • 929
  • 81
  • 729
  • 1023

Question 59

Consider the following ANSI C code segment: 

z=x + 3 + y->f1 + y->f2; 
for (i = 0; i < 200; i = i + 2) 

if (z > i) 

p = p + x + 3; 
q = q + y->f1; 
} else 

p = p + y->f2; 
q = q + x + 3; 


Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and the dereference operations (of the form y ->f1 or y ->f2) in the optimized code, respectively, are:
 

  • 403 and 102
     

  • 203 and 2
     

  • 303 and 102
     

  • 303 and 2
     

Question 60

What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?
  • Θ(√n)
  • Θ(log2(n))
  • Θ(n2)
  • Θ(n)

There are 65 questions to complete.

Last Updated :
Take a part in the ongoing discussion