Computer Science Engineering - Online Test

Q1. A software requirements specification (SRS) document should avoid discussing which one of the following?
Answer : Option D
Explaination / Solution:

SRS is a description of a software system to be developed, laying out functional & nonfunctional requirements and may include a set of use cases that describe interactions the user will have with the software.

Q2. Which one of the following protocols is NOT used to resolve one form of address to another one?
Answer : Option C
Explaination / Solution:

Except DHCP, remaining all the protocols are used to resolve one form of address to another one.

Q3. Consider the following table:

Match the algorithms to the design paradigms they are based on.
Answer : Option C
Explaination / Solution:

Kruskal’s algorithm follows greedy approach in order to find MST of a connected graph. Quick sort follows divide and conquer strategy. Floyd Warshal algorithm is used to find the shortest path between every pair of vertices and it follows dynamic programming strategy.

Q4. Consider a combination of T and D flip-flops connected as shown below. The output of the D flip-flops is connected to the input of the T flip-flop and the output of the T Flip-flop connected to the input of the D Flip-flop. 
Initially, both Qand Q1 are set to 1 ( before the 1st clock cycle). The outputs

Answer : Option B
Explaination / Solution:



Q5. The worst case running time to search for an element in a balanced binary search tree with n2n elements is
Answer : Option C
Explaination / Solution:

The worst case search time in a balanced BST on ‘x’ nodes is logx. So, if x = n2n , then log(n2n) = logn + log(2n) = logn + n = θ(n)

Q6. Consider the languages L= Φ and L= {a} . Which one of the following represents L1 L2* UL1* ? 
Answer : Option A
Explaination / Solution:
No Explaination.


Q7. 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;
}
 What is the minimum number of registers needed in the instruction set architecture of the processor to compile this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation
Answer : Option B
Explaination / Solution:


In the above code minimum number of registers needed are = 4 

Q8.  Which of the following statements are CORRECT?
1) Static allocation of all data areas by a compiler makes it impossible to implement recursion.
2) Automatic garbage collection is essential to implement recursion.
3) Dynamic allocation of activation records is essential to implement recursion. 
4) Both heap and stack are essential to implement recursion.
Answer : Option D
Explaination / Solution:

To implement recursion, activation record should be implemented by providing dynamic memory allocation. This dynamic allocation is done from runtime stack. Heap is essential to allocate memory for data structures at run-time, not for recursion. So statement 1 and 3 are correction.

Q9. What is the optimized version of the relation algebra expression  where A1, A2 are sets of attributes in with A⊂ Aand F1, F2 are Boolean expressions based on
Answer : Option A
Explaination / Solution:
No Explaination.


Q10. Consider a processor with byte-addressable memory. Assume that all registers, including Program Counter (PC) and Program Status Word (PSW), are of size 2 bytes. A stack in the main memory is implemented from memory location (0100)16 and it grows upward. The stack pointer (SP) points to the top element of the stack. The current value of SP is (016E)16. The CALL instruction is of two words, the first word is the op-code and the second word is the starting address of the subroutine. (oneword = 2bytes). The CALL instruction is implemented as follows:
 Store the current Vale of PC in the Stack
 Store the value of PSW register in the stack 
 Load the starting address of the subroutine in PC
The content of PC just before the fetch of a CALL instruction is (5FA0)16. After execution of the CALL instruction, the value of the stack pointer is 
Answer : Option D
Explaination / Solution:
No Explaination.