• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE-CS-2014-(Set-3)

Question 41

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

Here, wr is the reverse of the string w. Which of these languages are deterministic Context-free languages?

  • None of the languages

  • Only L1

  • Only L1 and L2

  • All the three languages

Question 42

Suppose you want to move from 0 to 100 on the number line. In each step, you either move right by a unit distance or you take a shortcut. A shortcut is simply a pre-specified pair of integers i, j with i < j. Given a shortcut i, j if you are at position i on the number line, you may directly move to j. Suppose T(k) denotes the smallest number of steps needed to move from k to 100. Suppose further that there is at most 1 shortcut involving any number, and in particular from 9 there is a shortcut to 15. Let y and z be such that T(9) = 1 + min(T(y), T(z)). Then the value of the product yz is _____.
  • 50
  • 100
  • 150
  • 200

Question 43

Consider the decision problem 2CNFSAT defined as follows: GATECS2014Q55
  • NP-Complete.
  • solvable in polynomial time by reduction to directed graph reachability.
  • solvable in constant time since any input instance is satisfiable.
  • NP-hard, but not NP-complete.

Question 44

Suppose we have a balanced binary search tree T holding n numbers. We are given two numbers L and H and wish to sum up all the numbers in T that lie between L and H. Suppose there are m such numbers in T. If the tightest upper bound on the time to compute the sum is O(nalogb n + mc logd n), the value of a + 10b + 100c + 1000d is ____.
  • 60
  • 110
  • 210
  • 50

Question 45

Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?

  • (97 × 97 × 97)/1003

  • (99 × 98 × 97)/1003

  • (97 × 96 × 95)/1003

  • (97 × 96 × 95)/(3! × 1003)

Question 46

Consider the pseudocode given below. The function DoSomething() takes as argument a pointer to the root of an arbitrary tree represented by the leftMostChild-rightSibling representation. Each node of the tree is of type treeNode. C
typedef struct treeNode* treeptr;
struct treeNode
{
    treeptr leftMostChild, rightSibling;
};
int DoSomething (treeptr tree)
{
    int value=0;
    if (tree != NULL)
    {
        if (tree->leftMostChild == NULL)
            value = 1;
        else
            value = DoSomething(tree->leftMostChild);
        value = value + DoSomething(tree->rightSibling);
    }
    return(value);
}
When the pointer to the root of a tree is passed as the argument to DoSomething, the value returned by the function corresponds to the
  • number of internal nodes in the tree.
  • height of the tree.
  • number of nodes without a right sibling in the tree.
  • number of leaf nodes in the tree.

Question 47

Consider the C function given below. Assume that the array listA contains n (> 0) elements, sorted in ascending order. 

C
int ProcessArray(int *listA, int x, int n)
{
    int i, j, k;
    i = 0;
    j = n-1;
    do
    {
        k = (i+j)/2;
        if (x <= listA[k])
            j = k-1;
        if (listA[k] <= x)
            i = k+1;
    }
    while (i <= j);
    if (listA[k] == x)
        return(k);
    else
        return -1;
}

Which one of the following statements about the function ProcessArray is CORRECT?

  • It will run into an infinite loop when x is not in listA.

  • It is an implementation of binary search.

  • It will always find the maximum element in listA.

  • It will return −1 even when x is present in listA.

Question 48

An instruction pipeline has five stages, namely, instruction fetch (IF), instruction decode and register fetch (ID/RF), instruction execution (EX), memory access (MEM), and register writeback (WB) with stage latencies 1 ns, 2.2 ns, 2 ns, 1 ns, and 0.75 ns, respectively (ns stands for nanoseconds). To gain in terms of frequency, the designers have decided to split the ID/RF stage into three stages (ID, RF1, RF2) each of latency 2.2/3 ns. Also, the EX stage is split into two stages (EX1, EX2) each of latency 1 ns. The new design has a total of eight pipeline stages. A program has 20% branch instructions which execute in the EX stage and produce the next instruction pointer at the end of the EX stage in the old design and at the end of the EX2 stage in the new design. The IF stage stalls after fetching a branch instruction until the next instruction pointer is computed. All instructions other than the branch instruction have an average CPI of one in both the designs. The execution times of this program on the old and the new design are P and Q nanoseconds, respectively. The value of P/Q is __________.
  • 1.5
  • 1.4
  • 1.8
  • 2.5

Question 49

The memory access time is 1 nanosecond for a read operation with a hit in cache, 5 nanoseconds for a read operation with a miss in cache, 2 nanoseconds for a write operation with a hit in cache and 10 nanoseconds for a write operation with a miss in cache. Execution of a sequence of instructions involves 100 instruction fetch operations, 60 memory operand read operations and 40 memory operand write operations. The cache hit-ratio is 0.9. The average memory access time (in nanoseconds) in executing the sequence of instructions is __________.

  • 1.26

  • 1.68

  • 2.46

  • 4.52

Question 50

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

The above sequential circuit is built using JK flip-flops is initialized with Q2Q1Q0 = 000. The state sequence for this circuit for the next 3 clock cycle is

  • 001, 010, 011

  • 111, 110, 101

  • 100, 110, 111

  • 100, 011, 001

There are 65 questions to complete.

Last Updated :
Take a part in the ongoing discussion