Computer Science Engineering - Online Test

Q1.  Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted
Program main;
 Var . . .
 Procedure A1;
 Var …. 
 Call A2;
 End A1
 Procedure A2;
 Var . . .
 Procedure A21;
 Var . . .
 Call A1;
 End A21
 Call A21;
End A2
 Call A1;
End main.
Consider the calling chain: Main → A1 → A2 → A21 → A1
The correct set of activation records along with their access links is given by
Answer : Option D
Explaination / Solution:

Access link is defined as link to activation record of closest lexically enclosing block in program text, so the closest enclosing blocks respectively for A1 ,A2 and A21 are main , main and A2

Q2. One of the header fields in an IP datagram is the Time to Live (TTL) field. Which of the following statements best explains the need for this field?
Answer : Option B
Explaination / Solution:
No Explaination.


Q3. Match the following:

Answer : Option C
Explaination / Solution:

Lemical Analyzer uses DFA to recognize the longest possible input sequence that makes up a token. Parser takes input in the form of tokens and usually builds a data structure in the form of parse tree. Here parse tree can be termed as a Production tree as parser uses production of the grammar to check whether generated tokens form a meaningful compression). Register allocation can be reduced to K-colouring problem where K is the number of registers available on the target architecture. Post order traversal of expression tree gives postfix notation for a given expression & this post fix notation can be evaluated using stack.

Q4. Which one of the following well formed formulae is tautology?
Answer : Option C
Explaination / Solution:



Q5. Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are
Answer : Option A
Explaination / Solution:

The counter example for the condition full : REAR = FRONT is
Initially when the Queue is empty REAR=FRONT=0 by which the above full condition is satisfied which is false
The counter example for the condition full : (FRONT+1)mod n =REAR is
Initially when the Queue is empty REAR=FRONT=0 and let n=3, so after inserting one element REAR=1 and FRONT=0, at this point the condition full above is satisfied, but still there is place for one more element in Queue, so this condition is also false
The counter example for the condition empty : (REAR+1)mod n = FRONT is
Initially when the Queue is empty REAR=FRONT=0 and let n=2, so after inserting one element REAR=1 and FRONT=0, at this point the condition empty above is satisfied, but the queue of capacity n-1 is full here
The counter example for the condition empty : (FRONT+1)mod n =REAR is
Initially when the Queue is empty REAR=FRONT=0 and let n=2, so after inserting one element REAR=1 and FRONT=0, at this point the condition empty above is satisfied, but the queue of capacity n-1 is full here 

Q6. Which one of the following is not a client server application?
Answer : Option A
Explaination / Solution:
No Explaination.


Q7. Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.
Which one of the following statements describes the properties achieved? 

Answer : Option B
Explaination / Solution:
No Explaination.


Q8. Consider the following statements 
I. The complement of every Turing decidable language is Turing decidable 
II. There exists some language which is in NP but is not turing decidable 
III. If L is a language in NP, L is turing decidable 
Which of the above statements is/are true? 
Answer : Option D
Explaination / Solution:

Turing decidable  Recursive language 
Turing recognizable  Recursive enumerable language 
I) Complement of turning decidable language is decidable which is true. 
III) True ( Theorem ) Which violates (II) hence key is D

Q9. Which of the following is NOT a super key in a relational schema with attributes V , W , X , Y , Z and primary key V Y ?
Answer : Option B
Explaination / Solution:

Any superset of VY is a super key.

Q10. Let G be a weighted graph with edge weights greater than one and G’ be the graph constructed by squaring the weights of edges in G. Let T and T’ be the minimum spanning trees of G and G’ respectively, with total weights t and t’. Which of the following statements is TRUE?
Answer : Option D
Explaination / Solution:


Graph G is counter example for options (B) and (C) and Graph G1 is counter example for option (A)