CS GATE 2012 - Online Test

Q1. The decimal value 0.5 in IEEE single precision floating point representation has
Answer : Option B
Explaination / Solution:

(0.5)10 =  (1.0)2 × 2-1
So, exponent = -1 and fraction is 000 - - - 000

Q2. Wanted Temporary, Part-time persons for the post of Field Interviewer to conduct personal interviews to collect and collate economic data. Requirements: High School-pass, must be available for Day, Evening and Saturday work. Transportation paid, expenses reimbursed. Which one of the following is the best inference from the above advertisement?
Answer : Option C
Explaination / Solution:

Gender is not mentioned in the advertisement and (B) clearly eliminated

Q3. Which of the following statements are TRUE about an SQL query? P : An SQL query can contain a HAVING clause even if it does not have a GROUP BY clause Q : An SQL query can contain a HAVING clause only if it has GROUP BY clause R : All attributes used in the GROUP BY clause must appear in the SELECT clause S : Not all attributes used in the GROUP BY clause need to appear in the SELECT clause
Answer : Option B
Explaination / Solution:

If we use a HAVING clause without a GROUP BY clause, the HAVING condition applies to all rows that satisfy the search condition. In other words, all rows that satisfy the search condition make up a single group. So, option P is true and Q is false. 
S is also true as an example consider the following table and query. 


Q4.  The truth table

represents the Boolean function
Answer : Option A
Explaination / Solution:

XY'+ XY = X(Y'+ Y) = X

Q5.
What will be the output of the following C program segment?
Char inChar = ‘A’ ;
switch (inChar ) {
case ‘A’ : printf (“Choice A\ n”);
case ‘B’ :
case ‘C’ : print f(“Choice B”);
case ‘D’ :
case ‘E’ :
default : printf (“No Choice”) ; }
Answer : Option C
Explaination / Solution:

Since there is no ‘break’ statement , the program executes all the subsequent case statements after printing “choice A”

Q6. A computer has a 256 KByte, 4-way set associative, write back data cache with block size of 32 Bytes. The processor sends 32 bit addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 2 valid bits, 1 modified bit and 1 replacement bit. The number of bits in the tag field of an address is
Answer : Option C
Explaination / Solution:



Q7. Given the basic ER and relational models, which of the following is INCORRECT?
Answer : Option C
Explaination / Solution:

The term ‘entity’ belongs to ER model and the term ‘relational table’ belongs to relational model. Options A and B both are true since ER model supports both multivalued and composite attributes. As multivalued attributes are not allowed in relational databases, in a row of a relational (table), an attribute cannot have more than one value.

Q8. Consider the set of strings on {0,1} in which, every substring of 3 symbols has at most two zeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings of length less than 3 are also in the language. A partially completed DFA that accepts this language is shown below.

The missing arcs in the DFA are
Answer : Option D
Explaination / Solution:

The complete DFA is


Q9. 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 if: 
Line 1 is replaced by auto int a = 1; 
Line 2 is replaced by register int a = 2;
Answer : Option D
Explaination / Solution:

Static local variables: Scope is limited to function/block but life time is entire program. 
Automatic local variables: Storage allocated on function entry and automatically deleted or freed when the function is exited. Register variables: Same as automatic variables except that the register variables will not have addresses Hence may not take the address of a register variable.
 

Q10. A computer has a 256 KByte, 4-way set associative, write back data cache with block size of 32 Bytes. The processor sends 32 bit addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 2 valid bits, 1 modified bit and 1 replacement bit. The size of the cache tag directory is
Answer : Option A
Explaination / Solution:

TAG controller maintains 16 + 4 = 20 bits for every block 
Hence, size of cache tag directory = 20 × 213 bits =160 K bits