Computer Science Engineering - Online Test

Q1. Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. 
F = {CH → G, A → BC, B → CFH, E → A, F → EG} is a 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?
Answer : Option B
Explaination / Solution:

Candidate keys are AD, BD, ED and FD

Q2. Consider the basic COCOMO model where E is the effort applied in person-months, D is the development time in chronological months, KLOC is the estimated number of delivered lines of code (in thousands) and ab ,bb , cb ,db have their usual meanings. The basic COCOMO equations are of the form
Answer : Option A
Explaination / Solution:
No Explaination.


Q3. Assume that the bandwidth for a TCP connection is 1048560 bits/sec. Let α be the value of RTT in milliseconds. (rounded off to the nearest integer) after which the TCP window scale option is needed. Let β be the maximum possible window size the window scale option. Then the values of α and β are
Answer : Option C
Explaination / Solution:
No Explaination.


Q4. Consider the two cascaded 2-to-1 multiplexers as shown in the figure.

The minimal sum of products form of the output X is  
Answer : Option D
Explaination / Solution:



Q5. What will be the output of the following C program?
void count(int n){
static int d=1;
printf("%d ", n); printf("%d ", d); d++;
if(n>1) count(n-1);
printf("%d ", d);
}
void main(){
count(3);

Answer : Option A
Explaination / Solution:



Q6. Let G be a simple undirected planar graph on 10 vertices with 15edges. If G is a connected graph, then the number of bounded faces in any embedding of G on the plane is equal to
Answer : Option D
Explaination / Solution:

We have the relation V-E+F=2, by this we will get the total number of faces, F = 7. Out of 7 faces one is an unbounded face, so total 6 bounded faces.

Q7. What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A → ∈ and A → a) to parse a string with n tokens?
Answer : Option B
Explaination / Solution:

To have maximum number of reduce moves, all the productions will be of the typeA→αβ (where α and β could be terminals or non-terminals). Consider the following illustration then: 


Q8. The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have almost two source operands and one destination operand. 
Assume that all variables are dead after this code segment
c = a + b;
d = c * a;
e = c + a;
x = c *c;
if (x > a) {
y = a * a;
}
else {
d = d * d;
e = e * e;
}
 Suppose the instruction set architecture of the processor has only two registers. The only allowed compiler optimization is code motion, which moves statements from one place to another while preserving correctness. What is the minimum number of spills to memory in the compiled code?
Answer : Option B
Explaination / Solution:

After applying the code motion optimization the statement d=c*a; and e=c+a; can be moved down to else block as d and e are not used anywhere before that and also value of a and c is not changing.

In the above code total number of spills to memory is 1 

Q9. Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. 
F = {CH → G, A → BC, B → CFH, E → A, F → EG} is a set of functional dependencies (FDs) so that F+ is exactly the set of FDs that hold for R
The relation R is
Answer : Option A
Explaination / Solution:

A → BC,B → CFH and F → EG are partial dependencies. Hence it is in 1NF but not in 2NF

Q10. The Gross Domestic Product (GDP) in Rupees grew at 7% during 2012-2013. For international comparison, the GDP is compared in US Dollars (USD) after conversion based on the market exchange rate. During the period 2012-2013 the exchange rate for the USD increased from Rs. 50/ USD to Rs. 60/ USD. India’s GDP in USD during the period 2012- 2013
Answer : Option D
Explaination / Solution:

Per 100 Rs final value 107 Rs 
⇒ Per 100/50 Dollars final value 107/60
for 100 dollars____? 
= ((100 × 50)/100) × (107/60) = 89.16
Decreased by 11%.