1
GATE CSE 2018
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C program:
#include< stdio.h >
void fun1(char *s1, char *s2){
  char *tmp;
  tmp = s1;
  s1 = s2;
  s2 = tmp;
}
void fun2(char **s1, char **s2){
  char *tmp;
  tmp = *s1;
  *s1 = *s2;
  *s2 = tmp;
}
int main(){
  char *str1 = "Hi", *str2 = "Bye";
  fun1(str1, str2); printf("%s %s ", str1, str2);
  fun2(&str1, &str2); printf("%s %s", str1, str2);
  return 0;
}
The output of the program above is
A
Hi Bye Bye Hi
B
Hi Bye Hi Bye
C
Bye Hi Hi Bye
D
Bye Hi Bye Hi
2
GATE CSE 2018
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C code. Assume that unsigned long int type length is 64 bits.
unsigned long int fun(unsigned long int n){
     unsigned long int i, j = 0, sum = 0;
     for (i = n; i > 1; i = i/2) j++;
     for ( ; j > 1; j = j/2) sum++;
     return(sum);
}
The value returned when we call fun with the input $${2^{40}}$$ is
A
4
B
5
C
6
D
40
3
GATE CSE 2018
MCQ (Single Correct Answer)
+2
-0.6
Consider the following languages:

$$\,\,\,\,\,\,\,\,{\rm I}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m + p = n + q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$
$$\,\,\,\,\,\,{\rm II}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m = n$$ and $$p=q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$
$$\,\,\,\,{\rm III}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m = n = p$$ and $$p \ne q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$
$$\,\,\,\,{\rm IV}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|mn = p + q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$

Which of the languages above are context-free?

A
$${\rm I}$$ and $${\rm IV}$$ only
B
$${\rm I}$$ and $${\rm II}$$ only
C
$${\rm II}$$ and $${\rm III}$$ only
D
$${\rm II}$$ and $${\rm IV}$$ only
4
GATE CSE 2018
MCQ (Single Correct Answer)
+2
-0.6
Consider the following problems. $$L(G)$$ denotes the language generated by a grammar $$G.$$ $$L(M)$$ denotes the language accepted by a machine $$M.$$

$$\,\,\,\,\,\,\,\,{\rm I}.\,\,\,\,\,\,\,$$ For an unrestricted grammar $$G$$ and a string $$W,$$ whether $$w \in L\left( G \right)$$
$$\,\,\,\,\,\,{\rm II}.\,\,\,\,\,\,\,$$ Given a Turing machine $$M,$$ whether $$L(M)$$ is regular
$$\,\,\,\,{\rm III}.\,\,\,\,\,\,\,$$ Given two grammars $${G_1}$$ and $${G_2}$$, whether $$L\left( {{G_1}} \right) = L\left( {{G_2}} \right)$$
$$\,\,\,\,{\rm IV}.\,\,\,\,\,\,\,$$ Given an $$NFA$$ $$N,$$ whether there is a deterministic $$PDA$$ $$P$$ such that $$N$$
$$\,\,\,\,\,\,\,\,\,\,\,\,\,$$ $$\,\,\,\,\,\,\,\\,\,\,$$and $$P$$ accept the same language.

Which one of the following statements is correct?

A
Only $${\rm I}$$ and $${\rm I}$$$${\rm I}$$ are undecidable
B
Only $${\rm III}$$ is undecidable
C
Only $${\rm I}$$$${\rm I}$$ and $${\rm IV}$$ are undecidable
D
Only $${\rm I}$$, $${\rm II}$$ and $${\rm III}$$ are undecidable
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12