Computer Science and Information Technology
2017 · Paper 1
Take it one question at a time. Try an answer, then check your understanding.
Complete GATE CSE 2017 Paper 1 overview, original pages and practice · Timed previous-paper practice
Questions 34–36 of 65. Imported answers require review unless explicitly marked reviewed.
Question 34
Open questionCSMCQ2 marksNeeds review
If
is a grammar with productions
where
is the start variable, then which one of the following strings is not generated by
?Your answerChoose one option.
Log in to check the answer
You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answerQuestion 35
Open questionCSMCQ2 marksNeeds review
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
Your answerChoose one option.
Log in to check the answer
You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answerQuestion 36
Open questionCSMCQ2 marksNeeds review
Consider the C functions foo and bar given below:
int foo(int val) {
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:
Your answerChoose one option.
Log in to check the answer
You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer