• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 2011

Question 21

What does the following fragment of C-program print? C
char c[] = \"GATE2011\";
char *p =c;
printf(\"%s\", p + p[3] - p[1]) ;
  • GATE2011
  • E2011
  • 2011
  • 011

Question 22

A max-heap is a heap where the value of each parent is greater than or equal to the values of its children. Which of the following is a max-heap?
  • A
  • B
  • C
  • D

Question 23

Let P be a regular language and Q be context-free language such that Q P. (For example, let P be the language represented by the regular expression p*q* and Q be {pn qn  | n N}). Then which of the following is ALWAYS regular? 

(A) P 

(B) P - Q 

(C) * - P 

(D) * - Q

  • A

  • B

  • C

  • D

Question 24

An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array A[0 :n-1] is given below. Let Li denote the length of the longest monotonically increasing sequence starting at index i in the array Which of the following statements is TRUE?
  • The algorithm uses dynamic programming paradigm
  • The algorithm has a linear complexity and uses branch and bound paradigm
  • The algorithm has a non-linear polynomial complexity and uses branch and bound paradigm
  • The algorithm uses divide and conquer paradigm.

Question 25

Consider the language L1,L2,L3 as given below. L1={[Tex]0^{p}1^{q}[/Tex] | p,q [Tex]\\in[/Tex] N} L2={[Tex]0^{p}1^{q}[/Tex] | p,q [Tex]\\in[/Tex] N and p=q} L3={[Tex]0^{p}1^{q}0^{r}[/Tex] | p,q,r [Tex]\\in[/Tex] N and p=q=r} Which of the following statements is NOT TRUE?
  • Push Down Automata (PDA) can be used to recognize L1 and L2
  • L1 is a regular language
  • All the three languages are context free
  • Turing machine can be used to recognize all the three languages

Question 26

Consider two binary operators \'[Tex]\\uparrow[/Tex] \' and \'[Tex]\\downarrow[/Tex]\' with the precedence of operator [Tex]\\downarrow[/Tex] being lower than that of the [Tex]\\uparrow[/Tex] operator. Operator [Tex]\\uparrow[/Tex] is right associative while operator [Tex]\\downarrow[/Tex] is left associative. Which one of the following represents the parse tree for expression (7 [Tex]\\downarrow[/Tex] 3 ­[Tex]\\uparrow[/Tex] 4 ­[Tex]\\uparrow[/Tex] 3 [Tex]\\downarrow[/Tex] 2)?
  • A
  • B
  • C
  • D

Question 27

On a non-pipelined sequential processor, a program segment, which is a part of the interrupt service routine, is given to transfer 500 bytes from an I/O device to memory.

              Initialize the address register
              Initialize the count to 500
        LOOP: Load a byte from device
              Store in memory at address given by address register
              Increment the address register
              Decrement the count
              If count != 0 go to LOOP 

Assume that each statement in this program is equivalent to machine instruction which takes one clock cycle to execute if it is a non-load/store instruction. The load-store instructions take two clock cycles to execute. The designer of the system also has an alternate approach of using DMA controller to implement the same transfer. The DMA controller requires 20 clock cycles for initialization and other overheads. Each DMA transfer cycle takes two clock cycles to transfer one byte of data from the device to the memory. What is the approximate speedup when the DMA controller based design is used in place of the interrupt driven program based input-output?

  • 3.4

  • 4.4

  • 5.1

  • 6.7

Question 28

We are given a set of n distinct elements and an unlabeled binary tree with n nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree?
  • 0
  • 1
  • n!
  • (1/(n+1)).2nCn

Question 29

Which one of the following options is CORRECT given three positive integers x, y and z, and a predicate? 
 

        
      P(x) = ¬(x=1)∧∀y(∃z(x=y*z)⇒(y=x)∨(y=1))


 

  • P(x) being true means that x is a number other than 1
     

  • P(x) is always true irrespective of the value of x
     

  • P(x) being true means that x has exactly two factors other than 1 and x 
     

  • P(x) being true means that x is a prime number
     

Question 30

Given i=√-1, what will be the evaluation of the integral [Tex]\\int_{0}^{\\pi/2} \\frac{\\cos x + i\\sin x}{\\cos x - i\\sin x} dx [/Tex]?
 

  • -i
     

  • 2
     

  • 0
     

  • i
     

There are 64 questions to complete.

Last Updated :
Take a part in the ongoing discussion