GATE CSE
MultiDequeue(Q){
m = k
while (Q is not empty and m > 0) {
Dequeue(Q)
m = m - 1
}
}
What is the worst case time complexity of a sequence of n operations on an initially empty queue? int unknown(int n) {
int i, j, k = 0;
for (i = n/2; i <= n; i++)
for (j = 2; j <= n; j = j * 2)
k = k + n/2;
return k;
}
The return value of the function is1. The problem of determining whether there exists a cycle in an undirected graph is in P.
2. The problem of determining whether there exists a cycle in an undirected graph is in NP.
3. If a problem A is NP−Complete, there exists a non-deterministic polynomial time algorithm to solve A.
Consider the following two sets of LR(1) items of an LR(1) grammar.
$$\eqalign{ & X \to c.X,\,c/d\,\,\,\,\,\,\,\,X \to c.X,\$ \cr & X \to .cX,c/d\,\,\,\,\,\,\,\,X \to .cX,\$ \cr & X \to .d,c/d\,\,\,\,\,\,\,\,\,\,\,X \to .d,\$ \cr} $$Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?
1. Cannot be merged since look aheads are different.
2. Can be merged but will result in S-R conflict.
3. Can be merged but will result in R-R conflict.
4. Cannot be merged since goto on c will lead to two different sets.

$$\eqalign{ & \,\,\,\,\,\,\,\,\,\,\,\,\,MBR\,\,\,\,\,\,\, \leftarrow PC \cr & \,\,\,\,\,\,\,\,\,\,\,\,\,MAR\,\,\,\,\,\,\, \leftarrow X \cr & \,\,\,\,\,\,\,\,\,\,\,\,\,PC\,\,\,\,\,\,\,\,\,\,\,\, \leftarrow Y \cr & \,\,\,\,\,\,\,\,\,\,\,\,\,Memory\, \leftarrow MBR \cr} $$
Which one of the following is a possible operation performed by this sequence?
Consider the following relational schema.
Students(rollno: integer, sname: string)
Courses(courseno: integer, cname: string)
Registration(rollno: integer, courseno: integer, percent: real)
Which of the following queries are equivalent to this query in English?"Find the distinct names of all students who score more than 90% in the course numbered 107"
(I) SELECT DISTINCT S.sname
FROM Students as S, Registration as R
WHERE R.rollno=S.rollno AND
R.courseno=107 AND R.percent >90
(II) ∏sname(σcourseno = 107 ∧ percent > 90 (Registration ⋈ Students))
(III) { T | ∃S ∈ Students, ∃R ∈ Registration ( S.rollno=R.rollno ∧ R.courseno=107 ∧ R.percent > 90 ∧ T.sname=S.sname)}
(iv) { < SN >| ∃SR∃RP ( < SR, SN > ∈ Students ∧ ∈ Registration ∧ RP > 90)}
$$F = \left\{ {CH \to G,\,\,A \to BC,\,B \to CFH,\,\,E \to A,\,\,F \to EG} \right\}$$ set of functional dependencies $$(FDs)$$ so that $${F^ + }$$ is exactly the set of $$FDs$$ that hold for $$R.$$
How many candidate keys does the relation $$R$$ have?
$$F = \left\{ {CH \to G,\,\,A \to BC,\,B \to CFH,\,\,E \to A,\,\,F \to EG} \right\}$$ set of functional dependencies $$(FDs)$$ so that $${F^ + }$$ is exactly the set of $$FDs$$ that hold for $$R.$$
The relation $$R$$ is

What function does the truth table represent?
"None of my friends are perfect."
The value of $$\int\limits_0^3 {f\left( x \right)dx} $$ computed using the trapezoidal rule is
P: Number of odd degree vertices is even.
Q: Sum of degrees of all vertices is even.
$$\,\,\,\,$$There is exactly one vertex $$v(e)$$ in $$L$$(G)$$ for each edge $$e$$ in $$G$$
$$\,\,\,\,$$ For any two edges $$e$$ and $$e'$$ in $$G$$, $$L(G)$$ has an edge between $$v(e)$$ and $$v(e')$$, if and only if $$e$$ and $$e'$$
$$\,\,\,\,$$ Which of the following statements is/are TRUE?
(P) The line graph of a cycle is a cycle.
(Q) The line graph of a clique is a clique.
(R) The line graph of a planar graph is planar.
(S) The line graph of a tree is a tree.
$$\left| {\matrix{ 1 & x & {{x^2}} \cr 1 & y & {{y^2}} \cr 1 & z & {{z^2}} \cr } } \right|?$$
Process X:
private i;
for(i = 0; i < n; i++){
a [i] = f (i);
Exit X (R, S);
}
Process Y:
private i;
for(i = 0; i < n; i++){
Entry Y (R, S);
b [i] = g (a [i] );
}
Which of the following represents the correct implementations of Exit X and Entry Y?int f (int &x, int c) {
c = c - 1;
if (c==0) return 1;
x = x + 1;
return f(x,c) * x;
}

$$\left\{ \, \right.$$ for (int $$i=0; i<5; i++$$)
for (int $$j=0; j<3; j++$$)
if ( $$A$$ [ $$i$$ ] $$==oldc$$ [ $$j$$ ] $$A$$ [ $$i$$ ]
$$=newc$$ [ $$j$$ ]; $$\left. \, \right\}$$
The procedure is tested with the following four test cases;
$$\eqalign{
& \left( 1 \right)\,\,\,oldc = ''abc'',\,\,newc\, = \,''dab'' \cr
& \left( 2 \right)\,\,\,oldc\, = \,''cdc'',\,\,newc\, = \,''bed'' \cr
& \left( 3 \right)\,\,\,oldc\, = \,''bca'',\,newc\, = \,''cda'' \cr
& \left( 4 \right)\,\,\,oldc\, = \,''abc'',\,newc\, = \,''bac'' \cr} $$
If array $$A$$ is made to hold the string $$''abcde'',$$ which of the above four test cases will be successful is exposing the flaw in this procedure?
$$\left\{ \, \right.$$ for (int $$i=0; i<5; i++$$)
for (int $$j=0; j<3; j++$$)
if ( $$A$$ [ $$i$$ ] $$==oldc$$ [ $$j$$ ] $$A$$ [ $$i$$ ]
$$=newc$$ [ $$j$$ ]; $$\left. \, \right\}$$
The procedure is tested with the following four test cases;
$$\eqalign{
& \left( 1 \right)\,\,\,oldc = ''abc'',\,\,newc\, = \,''dab'' \cr
& \left( 2 \right)\,\,\,oldc\, = \,''cdc'',\,\,newc\, = \,''bed'' \cr
& \left( 3 \right)\,\,\,oldc\, = \,''bca'',\,newc\, = \,''cda'' \cr
& \left( 4 \right)\,\,\,oldc\, = \,''abc'',\,newc\, = \,''bac'' \cr} $$
The tester now tests the program on all input strings of length five consisting of characters $$'a', 'b', 'c', 'd'$$ and $$'c'$$ with duplicates allowed. If the tester carries out this testing with four test cases given above, how many test cases will be able to capture the flaw?
$$1.$$ $$G$$ is a $$CFG.$$ Is $$L\left( G \right) = \Phi ?$$
$$2.$$ $$G$$ is a $$CFG.$$ Is $$L\left( G \right) = \sum {{}^ * } ?$$
$$3.$$ $$M$$ is a Turing Machine. Is $$L(M)$$ regular?
$$4.$$ $$A$$ is a $$DFA$$ and $$N$$ is an $$NFA.$$
Is $$L(A)=L(N)?$$
$${L_1} = \left\{ {{0^p}{1^q}{0^r}\left| {p,q,r \ge 0} \right.} \right\}$$
$${L_2} = \left\{ {{0^p}{1^q}{0^r}\left| {p,q,r \ge 0,p \ne r} \right.} \right\}$$
Which one of the following statements is FALSE?

Which of the following are FALSE?
$$1.$$ Complement of $$L(A)$$ is context - free.
$$2.$$ $$L(A)$$ $$ = \left( {{{11}^ * }0 + 0} \right)\left( {0 + 1} \right){}^ * {0^ * }\left. {{1^ * }} \right)$$
$$3.$$ For the language accepted by $$A, A$$ is the minimal $$DFA.$$
$$4.$$ $$A$$ accepts all strings over $$\left\{ {0,1} \right\}$$ of length at least $$2.$$
$$1.$$ For every non-deterministic Turing machine, there exists an equivalent deterministic Turing machine
$$2.$$ Turing recognizable languages are closed under union and complementation
$$3.$$ Turing decidable languages are closed under intersection and complementation
$$4.$$ Turing recognizable languages are closed under union and intersection