CS GATE 2012 - Online Test

Q1. Which of the following is TRUE?
Answer : Option C
Explaination / Solution:

Option A is false since BCNF is stricter than 3NF (it needs LHS of all FDs should be candidate key for 3NF condition) Option B is false since the definition given here is of 2NF Option C is true, since for a relation to be in BCNF it needs to be in 3NF, every relation in BCNF satisfies all the properties of 3NF. Option D is false, since if a relation is in BCNF it will always be in 3NF.

Q2. What is the minimal form of the Karnaugh map shown below? Assume that X denotes a don’t care term.


Answer : Option B
Explaination / Solution:



Q3. Consider the following C code segment: 
int a, b, c = 0; 
void prtFun(void); 
main( )
{ static int a = 1;            /* Line 1 */
 prtFun( );
a + = 1;
 prtFun( )
printf(“\n %d %d “, a, b);
}
void prtFun(void)
{ static int a=2;               /* Line 2 */
int b=1;
a+=++b;
printf(“\n %d %d “, a, b);
What output will be generated by the given code segment?
Answer : Option C
Explaination / Solution:



Q4. Suppose R1  are two relation schemas. Let r1 and r2 be the corresponding relation instances. B is a foreign key that refers to C in R2. If data in r1 and r2 satisfy referential integrity constrains, which of the following is ALWAYS TRUE?
Answer : Option A
Explaination / Solution:
No Explaination.


Q5. Which of the following problems are decidable? 
1) Does a given program ever produce an output? 
2) If L is context-free language, then, is  also context-free? 
3) If L is regular language, then, is  also regular? 
4) If L is recursive language, then, is  also recursive?
Answer : Option D
Explaination / Solution:

CFL’s are not closed under complementation. Regular and recursive languages are closed under complementation.

Q6. The amount of ROM needed to implement a 4 bit multiplier is
Answer : Option D
Explaination / Solution:

For a 4 bit multiplier there are 24 × 24 = 28 = 256 combinations. 
Output will contain 8 bits. 
So the amount of ROM needed is 28 ×8 bits = 2Kbits

Q7. Consider the following relations A, B and C:

How many tuples does the result of the following SQL query contain? 
SELECT A.Id 
FROM A 
WHERE A.Age > ALL(SELECT B.Age FROM B WHERE B.Name = ‘Arun’)
Answer : Option B
Explaination / Solution:

As the result of subquery is an empty table, ‘>ALL’ comparison is true . Therefore, all the three row id’s of A will be selected from table A.

Q8. Given the language L-{ab, aa, baa}, which of the following strings are in L*? 1) abaabaaabaa 2) aaaabaaaa 3) baaaaabaaaab 4) baaaaabaa

Answer : Option C
Explaination / Solution:

L ={ab, aa, baa} Let S1 = ab , S2 = aa and S3 =baa abaabaaabaa can be written as S1S2S3S1S2 aaaabaaaa can be written as S1S1S3S1 baaaaabaa can be written as S3S2S1S2

Q9. A process executes the code fork (); fork (); fork (); The total number of child processes created is
Answer : Option C
Explaination / Solution:

 If fork is called n times, there will be total 2n running processes including the parent process. So, there will be 2n -1 child processes. 

Q10. Consider the following relations A, B and C:
How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A ∪ B is the same as that of A.

Answer : Option A
Explaination / Solution: