# Computer Science CS SAIL MTT Exam

Computer Science CS SAIL MTT Exam Sail Exam objective questions Computer Science CS MCQ Engineering jobs Solved questions Solved paper CS for Graduate engineers 1. For a pipelined CPU with a single ALU, consider the following situations 1. The j + 1 — st instruction uses the result of the j-th instruction as an operand 2. The execution of a conditional jump instruction 3. The j -th and j + 1 — St instructions require the ALU at the same time Which of the above can cause a hazard? (a) l and 2only (b) 2 and 3 only (c) 3 only (d) All the three 2. Consider an array multiplier for multiplying two n bit numbers. If each gate in the circuit has a unit delay, the total delay of the multiplier is (a) Θ(1) (b) Θ(log n) (c) Θ(n) (d)Θ(n2) 3. Consider the ALU shown below

If the operands are in 2’s complement representation, which of the following operations can be performed by suitably setting the control lines K and C0 only (+ and — denote addition and subtraction respectively)? (a) A + B, and A — B, but not A + I (b) A + B, and A + 1, but not A— B (c) A+B, but not A—B,or A+l (d) A + B, and A — B, and A + 1 Data for Q.4 & Q.5 are given below. choose the correct answers. Consider the following assembly language program for a hypothetical processor. A, B and C are 8 bit registers. The meanings of various instructions are shown as comments. MOV B,#O ; B← 0 MOV C,#8 ; C←8 Z: CMP C, #0 ; compare C with 0 JZX ; jump to X if zero flag is set SUBC,#l ; C←C-1 RRCA, # 1 ; right rotate A through carry by one bit. Thus: ;if the initial values of A and the carry flag are a7 … a0 and ;c 0 respectively, their values after the execution of this instruction will be c0a7 ….a1and a0 respectively. JC Y ; jump to Y if carry flag is set JMPZ ; jump to Z

If the initial value of register A is A 0 the value of register B after the program execution will be (a) the number of 0 bits in A0 (b) the number of 1 bits in A0 (c) A 0 (d) 8 5. # 1 (b) NOP . Relative addressing 4.#l .O to Z (d)R to X. jump to Z X: 4. (a) call swap(x. without using any additional hardware? (a)R to X.R to Y. no operation (e) LRC A. and Z =1 selects input Y. O to Y. use the least recently used (LRU) scheme. Consider the following C function void swap (int a. The goal of structured programming is to (a) have well indented programs (b) be able to infer the flow of control from the compiled code (c) be able to infer the flow of control from the program text (d) avoid the use of GOTO statements 10. Based addressing 3. B ← B+1 JMPZ . Absolute addressing 2.0. y) cannot be used as the parameters are passed by value
. } In order to exchange the values of two variables x and y.Y: ADDB. Consider a multiplexer with X and Y as data inputs and Z as control input. What are the connections required to realize the 2-variable Boolean function f= T + R. temp =a.y) (b) call swap (&x.R to Y. Which of the following addressing modes are suitable for program relocation at run time? 1. a=b b=temp. 12. y) cannot be used as it does not return any value (d) swap (x. Which of the following instructions when inserted at location X will ensure that the value of register A after program execution is the same as its initial value? (a) RRC A.l to Y.T to Z (c)T to X.T to Z (b)T to X. 8 (a)2 (b)3 (c)4 (d)5 9. consisting of four blocks. 12. The number of cache misses for the following sequence of block addresses is 8. # 1 .#l 6. int b) { int temp. 2and 4 7. &y) (c) swap (x. For choosing the block to be replaced. left rotate A through carry flag by one bit (d) ADDA.T to Z 8. Consider a small two-way set-associative cache memory. Indirect addressing (a) l and 4 (c) 2 and 3 (b) l and2 (d) l. Z = 0 selects input X.

The best data structure to check whether an arithmetic expression has balanced parentheses is a (a) queue (b) stack (c) tree (d) list 14. 15...MAXSIZE] is used to implement two stacks. Consider the following C function
The value returned by f( 1) is (a) 5 (b) 6 (c) 7 (d) 8
. 12. 1. The two stacks grow from opposite ends of the array.11. A single array A [ 1. The following numbers are inserted into an empty binary search tree in the given order: 10.. Variables top 1 and top 2 (top 1 (a) (top 1 = MAXSIZE/2) and (top 2= MAXSTZE/2 + 1) (b) top 1 + top 2= MAXSIZE (c) (top 1 = MAXSIZE/2) or (top 2= MAXSIZE) (d) top 1 = top 2 — 1 12. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)? (a) 2 (b)3 (c) 4 (d) 6 13.5. 16.3.

15. Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n = d1 d2… dm
16. Consider the following C program segment:
Answers: 1d 2c 3d
.

4a 5a 6c 7a 8c 9c 10 d 11 d 12 b 13 b 14 c 15 a 16 d
.