Computer Science CS SAIL MTT Exam

5
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 C 0 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

Transcript of Computer Science CS SAIL MTT Exam

Page 1: Computer Science CS SAIL MTT Exam

Computer Science CS SAIL MTT ExamComputer Science CS SAIL MTT ExamSail Exam objective questions Computer ScienceCS MCQ Engineering jobs Solved questionsSolved paper CS for Graduate engineers

1. For a pipelined CPU with a single ALU, consider the following situations1. The j + 1 — st instruction uses the result of the j-th instruction as an operand2. The execution of a conditional jump instruction3. The j -th and j + 1 — St instructions require the ALU at the same timeWhich 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← 0MOV C,#8    ;    C←8Z:    CMP C, #0    ;    compare C with 0JZX    ;    jump to X if zero flag is setSUBC,#l    ;    C←C-1RRCA, # 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 thisinstruction will    be c0a7 ….a1and a0 respectively.JC Y    ;    jump to Y if carry flag is setJMPZ    ;    jump to Z

Page 2: Computer Science CS SAIL MTT Exam

Y:    ADDB,#l    ;    B ← B+1JMPZ    ;    jump to ZX:4.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) 85. 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, # 1(b) NOP ; no operation(e) LRC A, # 1 ; left rotate A through carry flag by one bit(d) ADDA,#l

6. Which of the following addressing modes are suitable for program relocation at run time?1. Absolute addressing2. Based addressing3. Relative addressing4. Indirect addressing(a) l and 4(c) 2 and 3(b) l and2(d) l, 2and 4

7. Consider a multiplexer with X and Y as data inputs and Z as control input.Z = 0 selects input X, and Z =1 selects input Y.What are the connections required to realize the 2-variable Boolean function f= T + R, without using any additional hardware?(a)R to X,l to Y,T to Z(b)T to X,R to Y,T to Z(c)T to X,R to Y,O to Z(d)R to X, O to Y,T to Z

8. Consider a small two-way set-associative cache memory, consisting of four blocks. For choosing the block to be replaced, use the least recently used (LRU) scheme. The number of cache misses for the following sequence of block addresses is 8, 12,0, 12, 8(a)2(b)3(c)4(d)5

9. 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. Consider the following C functionvoid swap (int a, int b){ int temp;temp =a;a=bb=temp;}In order to exchange the values of two variables x and y.(a) call swap(x,y)(b) call swap (&x, &y)(c) swap (x, y) cannot be used as it does not return any value(d) swap (x, y) cannot be used as the parameters are passed by value

Page 3: Computer Science CS SAIL MTT Exam

11. A single array A [ 1....MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. 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. The following numbers are inserted into an empty binary search tree in the given order: 10, 1,3,5, 15, 12, 16. 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. The best data structure to check whether an arithmetic expression has balanced parentheses is a(a) queue(b) stack(c) tree(d) list

14. Consider the following C function

The value returned by f( 1) is(a) 5(b) 6(c) 7(d) 8

Page 4: Computer Science CS SAIL MTT Exam

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:

1 d2 c3 d

Page 5: Computer Science CS SAIL MTT Exam

4 a5 a6 c7 a8 c9 c10 d11 d12 b13 b14 c15 a16 d