Computer Science Engineering - Online Test

Q1. Which of the following transport layer protocols is used to support electronic mail?
Answer : Option C
Explaination / Solution:

E-mail uses SMTP, application layer protocol which intern uses TCP transport layer protocol.

Q2. In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state:

Now consider the following statements: 
I. If a process makes a transition D, it would result in another process making transition A immediately 
II. A process P2 in blocked state can take transition E while another process P1 is in running state 
III. The OS uses preemptive scheduling 
IV. The OS uses non-preemptive scheduling 
Which of the above statements are TRUE?
Answer : Option C
Explaination / Solution:
No Explaination.


Q3. A subsequence of a given sequence is just the given sequence with some elements (possibly none or all) left out. We are given two sequences X[m] and Y[n] of lengths m and n, respectively, with indexes of X and Y starting from 0.
We wish to find the length of the longest common subsequence (LCS) of X[m] and Y[n] as l(m, n), where an incomplete recursive definition for the function l(i, j) to compute the length of the LCS of X[m] and Y[n] is given below:
l(i, j) = 0, if either i = 0 or j = 0
= expr1, if i, j>0 and x[i - 1] = Y[j - 1]
= expr2, if i, j>0 and x[i - 1] ≠ Y[j - 1]
Which one of the following option is correct?
Answer : Option C
Explaination / Solution:
No Explaination.


Q4. The minimum number of D flip-flops needed to design a mod-258 counter is
Answer : Option A
Explaination / Solution:

2≥ 258 ⇒ n = 9 

Q5. The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
Answer : Option A
Explaination / Solution:

Lexical Analysis is implemented by finite automata

Q6. Consider a relational table with a single record for each registered student with the following attributes. 1. Registration_Number: Unique registration number for each registered student 2. UID: Unique Identity number, unique at the national level for each citizen 3. BankAccount_Number: Unique account number at the bank. A student can have multiple accounts or joint accounts. This attributes stores the primary account number 4. Name: Name of the Student 5. Hostel_Room: Room number of the hostel Which of the following options is INCORRECT?
Answer : Option A
Explaination / Solution:

In case two students hold joint account then BankAccount_Num will not uniquely determine other attributes.

Q7. Consider an instruction pipeline with four stages (S1, S2, S3 and S4) each with combinational circuit only. The pipeline registers are required between each stage and at the end of the last stage. Delays for the stages and for the pipeline registers are as given in the figure.

What is the approximate speed up of the pipeline in steady state under ideal conditions when compared to the corresponding non-pipeline implementation? 
Answer : Option B
Explaination / Solution:

(5 + 6 + 11 + 8) / (11 + 1) = 30 / 12 = 2.5

Q8. Consider the following recursive C function that takes two arguments 
unsigned int foo unsigned int n, unsigned int r {
if (n > 0) return (n%r) + foo (n / r, r ));
else return 0;
}
What is the return value of the function foo when it is called as foo (513, 2)? 
Answer : Option D
Explaination / Solution:



Q9. The protocol data unit (PDU) for the application layer in the Internet stack is
Answer : Option C
Explaination / Solution:

The PDU for Datalink layer, Network layer , Transport layer and Application layer are frame, datagram, segment and message respectively.

Q10. The enter_CS( ) and leave_CS( ) functions to implement critical section of a process are realized using test-and-set instruction as follows:
void enter_CS ( X)
{
while (test-and-set (X))
}
void leave_CS (X)
{
X = 0;
}
In the above solution, X is a memory location associated with the CS and is initialized to 0. Now consider the following statements 
I. The above solution to CS problem is deadlock-free 
II. The solution is starvation free 
III. The processes enter CS in FIFO order 
IV. More than one process can enter CS at the same time 
Which of the above statements are TRUE?
Answer : Option A
Explaination / Solution:
No Explaination.