GATE 2017 (Session 1) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2017 (Session 1)

64 questions

MCQ 44 · NAT 201-mark 30 · 2-mark 34

Questions 46–50 of 64

Q46Function2 marksMCQ−0.67 if wrong
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:

Q47Context Free Language2 marksMCQ−0.67 if wrong
Consider the context-free grammars over the alphabet {a,b,c} given below. S and T are non-terminals

G1:S→aSb∣T,T→cT∣ϵG_{1}:S\rightarrow aSb|T, T\rightarrow cT|\epsilon G2:S→bSa∣T,T→cT∣ϵG_{2}:S\rightarrow bSa|T,T\rightarrow cT|\epsilon

The language L(G1)∩L(G2)L(G_{1})\cap L(G_{2}) is

Q48Context Free Language2 marksMCQ−0.67 if wrong
Consider the following languages over the alphabet Σ={a,b,c}\Sigma = \{a, b,c\}.
Let L1={anbncm∣m,n≥0}L_{1}=\{a^{n}b^{n}c^{m}|m,n\geq 0\} and L2={ambncn∣m,n≥0}L_{2}=\{a^{m}b^{n}c^{n}|m,n\geq 0\}

Which of the following are context-free languages ?
I. L1∪L2L_{1}\cup L_{2}
II. L1∩L2L_{1}\cap L_{2}

Q49Turing Machine2 marksMCQ−0.67 if wrong
Let A and B be finite alphabets and let # be a symbol outside both A and B. Let f be a total function from A* to B*. We say f is computable if there exists a Turing machine M which given an input x in A*, always halts with f(x) on its tape. Let LfL_{f} denote the language {x#f(x)|x∈\inA*}. Which of the following statements is true:

Q50Memory Management2 marksMCQ−0.67 if wrong
Recall that Belady's anomaly is that the pages-fault rate may increase as the number of allocated frames increases. Now consider the following statements:

S1: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady's anomaly
S2: LRU page replacement algorithm suffers from Belady's anomaly

Which of the following is CORRECT ?