Está en la página 1de 5

Rev 4.

1 1
ECEn 324
Practice Exam: Midterm #2

1. In which of the following ways does the Y86 ISA differ from the x86 ISA?
a. The Y86 has no condition codes.
b. The Y86 has no stack-based instructions.
c. No Y86 instruction accesses data memory twice.
d. The Y86 has an increased number of registers.

2. The HCL code below is a correct implementation of which of the following?
int Unknown = [
A <= B && B <= C : B;
B <= A && A <= C : A;
1 : C;
] ;
a. a 3-way word-level MUX
b. a circuit to find the minimum value among a set of 3 words
c. a circuit to find the median value among a set of 3 words
d. a circuit to find the maximum value among a set of 3 words
e. none of the above

3. Which of the Y86 instructions below matches this sequence of operations in its sequential
implementation?

Fetch icode:ifun ! M
1
[PC]
rA:rB ! M
1
[PC+1]
valC ! M
4
[PC+2]
valP ! PC + 6
Decode
Execute valE ! 0 + valC
Memory
Writeback R[rB] ! valE
PC update PC ! valP

a. irmovl
b. addl
c. rmmovl
d. mrmovl
e. rrmovl

4. Increasing the number of stages in the pipeline (say, from 5 to 6) tends to
a. increase the latency and increase the throughput.
b. decrease the latency and increase the throughput.
c. increase the latency and decrease the throughput.
d. decrease the latency and decrease the throughput.






Rev 4.1 2
5. How many data dependences on register values exist in the code below? (Remember, not all
dependencies in the Y86 ISA are explicit.)
irmovl $50,%eax
irmovl $2,%ebx
pushl %eax
call sub1
a. 0
b. 1
c. 2
d. 3

6. In which stage of the Y86 pipeline is the branch outcome determined?
a. fetch
b. decode
c. execute
d. memory
e. write-back

7. If the function below were to execute on PIPE, the pipelined Y86 processor with forwarding,
how many instructions will obtain at least one register value through forwarding?

fun: pushl %ebp
rrmovl %esp,%ebp
mrmovl 8(%ebp),%ecx
mrmovl 12(%ebp),%eax
addl %ecx,%eax
popl %ebp
ret
a. 0
b. 1
c. 2
d. 3
e. 4
f. 5 or more

8. In optimizing a loop that includes a call to strlen with a constant return value, a typical
compiler will
a. leave the function call intact without analyzing the function.
b. recognize the function as a library routine and thus be able to move it outside the loop.
c. attempt a simplistic analysis of possible side-effects of the function.
d. detect that the function return value is constant in the loop and move the call outside the loop.

9. Which of the following is true?
a. Loop unrolling can be applied by the compiler only if the number of iterations is known at
compile time.
b. Register renaming allows values to be passed directly from one operation to another without
going through the register file.
c. A processor with register renaming allows assembly language programs to use more registers
than the architecture provides.
d. The performance of a loop unrolled k+1 times is always better than the same loop unrolled k
times.

Rev 4.1 3

10. Which of the following is NOT true of modern processors?
a. A superscalar processor can achieve a CPI less than 1.0.
b. A CPU with out-of-order execution retires instructions in program order.
c. The machine state is not modified irrevocably by any instruction until that instruction retires.
d. Register renaming eliminates register shortages that result in register spilling.

11. If we use the books data-flow graphs to represent data dependencies between consecutive
iterations of the loop below, what lower bound on cycles per iteration can we establish based on
an analysis of the critical path? Assume the load unit latency is 4 cycles, and the latency for
integer multiplication is 5 cycles.

.L09:
imull 4(%ebx),%eax
movl (%ebx),%ebx
test %ebx,%ebx
jne .L09

a. 1
b. 2
c. 3
d. 4
e. 5
f. 6
g. 7

12. Suppose we are comparing two different versions of a computer program. Version B is
identical to version A except that one portion of the code has been optimized in B. If the
optimized portion was speeded up by a factor of 2 and accounted for 2/3 of As execution time,
what is the overall speedup of version B relative to version A?
a. less than 1.0
b. between 1.0 and 1.4
c. between 1.4 and 1.8
d. between 1.8 and 2.2
e. between 2.2 and 2.6
f. greater than 2.6

13. Which of the following is a nonvolatile memory that can be modified without removing it
from the system and using special programming hardware?
a. SRAM
b. PROM
c. EPROM
d. Flash

14. Which of the following decreased by the greatest factor during the period from 1980 to 2010?
a. SRAM access time
b. DRAM access time
c. Rotating disk seek time
d. CPU cycle time
Rev 4.1 4

15. Suppose we have a 128 KB cache with 32-byte blocks. Assuming 12 bits are used to select
the set, what is the associativity of the cache?
a. The cache is direct mapped.
b. The cache is two-way set-associative.
c. The cache is four-way set-associative.
d. The cache is eight-way set-associative
e. None of the above

16. Which of the following is true of modern disks?
a. The read/write head flies on a thin cushion of air about 0.1 microns above the disk surface.
b. The rotational latency is typically the largest component in the average access time.
c. The size of sectors (in data bits) varies from innermost to outermost cylinders.
d. Operating systems typically request disk blocks in terms of (surface, track, sector) triples.

17. Of the 512 total data accesses to array elements in each call to the function below, what
number result in cache misses? Assume that the system has a 16KB first-level data cache that is
direct mapped and initially empty and that the block size is 32 bytes. Assume that the dst and
src arrays are stored adjacent to each other in the virtual address space.

typedef int array[16][16];
void transpose(array dst, array src)
{
int i, j;
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
dst[j][i] = src[i][j];
}
}
}

a. 0 (all are hits)
b. 32
c. 64
d. 128
e. 256
f. 512 (all are misses)
g. none of the above answers is correct

18. Which of the following cannot be accurately approximated from software means alone?
a. the L1 block size
b. the L1 cache size
c. the L2 cache size
d. the branch misprediction penalty
e. none of the above (all can be determined with appropriate software)

19. Which of the following is NOT true of ELF files?
a. The .symtab section contains entries for local variables.
b. The .bss section occupies no actual space in the object file.
c. The .rel.data section holds relocation information for initialized global pointer variables.
d. The .data section contains initialized global variables.


Rev 4.1 5
20. Which of the following is true of Linux/Unix linkers?
a. An error is always reported if multiple definitions exist for the same symbol.
b. An error is always reported if multiple weak definitions exist for the same symbol.
c. An error is always reported if multiple definitions exist for a global variable.
d. An error is always reported if multiple functions of the same name are defined.

21. Which of the following is NOT true of dynamic linking?
a. It saves disk space relative to static linking.
b. It saves runtime memory relative to static linking.
c. It makes the distribution of software updates easier than with static linking.
d. It is always completed (by the loader) by the time a program begins to execute.

22. Which of the following is NOT true?
a. The kernel runs only when control is transferred via the hardware exception mechanism.
b. Control is passed from the kernel to user code through a special return instruction.
c. Exceptions that are classified as faults always result in process termination.
d. The only class of exceptions classified as asynchronous are interrupts.

23. Which of the following functions can return 3 or more times despite being called only once?
a. setjmp
b. longjmp
c. waitpid
d. fork
e. execve

24. The class of exception used to implement a system call is classified by our text as
a. an interrupt.
b. a trap.
c. a fault.
d. an abort.

25. Which of the following is true?
a. User code can change the default action for all but two Linux signals.
b. When a SIGCHLD signal is sent to a parent, the child process is considered reaped.
c. A zombie is a stopped process that is waiting for a specific signal to resume execution.
d. A Linux user process cannot block or ignore a ctrl-c typed at the keyboard.
e. Typing kill -9 1039 will send a SIGKILL signal to all processes with group PID 1039.

Correct answers:
1. c
2. e
3. a
4. a
5. c
6. c
7. f
8. a
9. b
10. d
11. e
12. c
13. d
14. d
15. a
16. a
17. c
18. e
19. a
20. d
21. d
22. c
23. a
24. b
25. a