CS/IT Gate Yearwise
CS/IT Gate 2025 (Set 2)
CS/IT Gate 2024 (Set 1)
CS/IT Gate 2024 (Set 2)
CS/IT Gate 2023
CS/IT Gate 2022
CS/IT Gate 2021 (Set 1)
CS/IT Gate 2021 (Set 2)
CS/IT Gate 2020
CS/IT Gate 2019
CS/IT Gate 2018
CS/IT Gate 2017 (Set 1)
CS/IT Gate 2017 (Set 2)
CS/IT Gate 2016 (Set 1)
CS/IT Gate 2016 (Set 2)
CS/IT Gate 2015 (Set 1)
CS/IT Gate 2015 (Set 2)
CS/IT Gate 2015 (Set 3)
CS/IT Gate 2014 (Set 1)
CS/IT Gate 2014 (Set 2)
CS/IT Gate 2014 (Set 3)
CS and IT GATE 2017 Set-1 Questions with Answer
Ques 14 Automata
If G is grammar with productions
where S is the start variable, then which one of the following is not generated by G?
Ques 15 Automata
Consider the following grammar over the alphabet {a,b,c} given below, S and T are non-terminals.
T--> cT|∈
G2: S-->bSa|T
T--> cT|∈
The language L1(G1) ∩ L2(G2).
Ques 16 Automata
Consider the following context-free grammar over the alphabet ∑ = {a, b, c} with S as the start symbol:
T → bT | b
Which of the following represents the language generated by the above grammar?
Ques 17 Automata
Consider the following grammar
Q→yz|z
R→ w|∈
S→y
Ques 18 C Programming
The output of executing the following C program is ________.
int total(int v)
{
static int count = 0;
while (v) {
count += v & 1;
v >>= 1;
}
return count;
}
void main()
{
static int x = 0;
int i = 5;
for (; i> 0; i--) {
x = x + total(i);
}
printf (“%dn”, x) ;
}
a is the correct answer.
Ques 19 C Programming
Consider the following C program.
#include<string.h>
void printlength (char *s, char *t)
{
unsigned int c = 0;
int len = ((strlen (s) - strlen (t)) > c) ? strlen (s) : strlen (t);
printf("%dn", len);
}
void main()
{
char *x = "abc";
char *y = "defgh";
printlength(x, y);
}
Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned int . The output of the program is _________.
3 is the correct answer.
Ques 20 C Programming
Consider the following two functions
void fun1(int n){
if(n == 0) return;
printf(“%d”, n);
fun2(n-2);
printf(“%d”, n);
}
void fun2(int n){
if(n == 0) return;
printf(“%d”, n);
fun1(++n);
printf(“%d”, n);
}
The output printed when fun1 (5) is called is
Ques 21 C Programming
Consider the C functions foo and bar given below:
{
int x = 0;
while (val > 0)
{
x = x + foo(val--);
}
return val;
}
int bar(int val)
{
int x = 0;
while (val > 0)
{
x = x + bar(val-1);
return val;
}
}
Invocations of foo(3) and bar(3) will result in:
Ques 22 C Programming
Consider the C code fragment given below.
{
int data;
node* next ;
} node;
void join(node* m, node* n)
{
node* p = n;
while (p->next != NULL)
{
p = p->next;
}
p–>next = m;
}
Assuming that m and n point to valid NULL- terminated linked lists, invocation of join will
Ques 23 C Programming
Consider the C code fragment given below.
{
int data;
node* next ;
} node;
void join(node* m, node* n)
{
node* p = n;
while (p->next != NULL)
{
p = p->next;
}
p–>next = m;
}
Assuming that m and n point to valid NULL- terminated linked lists, invocation of join will
Ques 24 C Programming
Consider the following C code:
int * assignval (int *x, int val)
{
*x = val;
return x;
}
int main()
{
int *x = malloc(sizeof(int));
if (NULL == x) return;
x = assignval(x, 0);
if(x)
{
x = (int*) malloc(sizeof (int));
if (NULL == x) return;
x = assignval (x, 10);
}
printf("%dn", *x);
free(x);
}
The code suffers from which one of the following problems:
Ques 25 C Programming
Consider the C struct defines below:
int marks [100] ;
char grade;
int cnumber;
};
struct data student;
The base address of student is available in register R1. The field student grade can be accessed efficiently using
Ques 26 COA
Instruction execution in a processor is divided into 5 stages.
Instruction Fetch(IF), Instruction Decode (ID), Operand Fetch(OF), Execute(EX), and Write Back(WB),
These stages take 5,4,20, 10 and 3 nanoseconds (ns) respectively. A pipelined implementation of the processor requires buffering between each pair of consecutive stages with a delay of 2 ns. Two pipelined implementations of the processor are contemplated:
(i) a naïve pipeline implementation (NP) with 5 stages and
(ii) an efficient pipeline (EP) where the OF stage id divided into stages OF1 and OF2 with execution times of 12 ns and 8 ns respectively.
The speedup (correct to two decimals places) achieved by EP over NP in executing 20 independent instructions with no hazards is ________________.
1.50-1.51 is the correct answer.

Total Unique Visitors