Vous êtes sur la page 1sur 19

1 (L10)

Question

The following are registers are reserved:

A. ebx
B. eip
C. esp
D. B & C
E. All of the above.

2 (L11)

Question

The ebp register contains the address of the [blank] element of the current
stack frame. The esp register contains the address of the [blank] element of
the current stack frame.

NaN

3 (L10)

Question

In assembly, memory-memory transfer can be performed in a single


instruction.

A. True
B. False
4 (L12)

Question

When a process is forked, it gets a copy of the parent's virtual address


space, with

A. heap.
B. stack.
C. heap and stack.
D. it depends.

5 (L13)

Question

Which of the following statements about process is false?

A. The environment for a process is stored on the stack.


B. The operating system kernel runs as its own separate process.
C. Each process shares the CPU with other processes.
D. Each process has its own private address space.

6 (L12)

Question

Killing a parent process will also kill all its child process (if has).

True. False
7 (L10)

Question

The Arithmetic Logic Unit (ALU) is part of which component of the von
Neumann architecture.

A. I/O Unit
B. Control Unit
C. Execution Unit
D. Decode Unit

8 (L11)

Question

Where on the stack that callee frame used to save caller's old %ebp value?

A. The heap
B. At a negative offset from the %ebp register
C. In the %edx register
D. At a negative offset from the %esp register

12 (L14)

Question

Which of the following are at the top of the memory hierarchy?

A. memory
B. registers
C. Cache
D. disk
E. The network
13 (L13)

Question

How do we communicate to processes?

NaN

14 (L13)

Question

The shell catches the signal from Ctrl-C and then sends a SIGINT to the
process
in the [Blank]process group.

NaN

15 (L13)

Question

The pipe system call will open two “files”:


pipefd[0] for [Blank a.]
pipefd[1] for [Black b.]

NaN

16 (L10)

Question

The GCC compiler translates your C programs into "human readable


format" known as
(a) source files
(b) object files
(c) assembly
(d) processes
(e) None of these

17 (L10)

Question

A C [blank] translates C programs into instructions that are understood by


the machine

(a) Linker
(b) Compiler
(c) Decoder
(d) ALU
(e) None of these

18 (L10)

Question

CPU supports a number of different registers. The %eax register is one of


these registers, which of the following categories does this register belong
to?

A. callee-save registers
B. special purpose registers
C. flags registers
D. general purpose registers
E. argument passing registers

19 (L11)

Question

For the IA32 32-bit Linux environment, which of the following registers
points to the start of the frame for the currently executing function?

A. %ebx B. %ebp C. %eip D. %edx E. %esp

20 (L11)

Question

Variables that are local to a function are allocated in a corresponding frame.


For the IA32 32-bit Linux environment, which of the following registers is
used for allocating local variables in such a stack frame?

A. %ebx B. %ebp C. %eip D. %edx E. %esp

21 (L11)

Question

For the IA32 32-bit Linux environment Which of the following registers is
used by the compiler to return a value from a function?

A. %ebx B. %ebp C. %eax D. %edx E. %esp

22 (L10)

Question

Consider the following IA32 assembly code for the main function:
1 pushl %ebp
2 movl %esp, %ebp
3 subl $16, %esp
4 movl $2, -4(%ebp)
5 movl $3, -8(%ebp)
6 movl -4(%ebp), %edx
7 movl -8(%ebp), %eax
8 addl %edx, %eax
9 movl %eax, -12(%ebp)
10 movl $0, %eax
11 leave
12 ret

which line is moving value 3 into a register?

A. line 8
B. line 7
C. line 6
D. line 5
E. line 4

23 (L12)

Question

A process is in one of the three states:

a)Running
b)Stopped
c)Terminated
d)All of the Above
e)None of the Above

28 (L12)

Question

Consider this fragment of C code:


1 t main() {
2 if (fork() || fork()) fork();
3 printf("hello\n");
4 exit(0);
5 return 0;}
How many "hello"s will be printed?

A. 8
B. 3
C. 5
D. 6
E. 7

29 (L14)

Question

which of the following assembly code represents frame pointer?

A. %ebp
B. %esp
C. %efp
D. %edp

32 (L13)

Question

1 void foo() {
2 char bar[16];
3 bar[9] = 'm';
4}

In assembly, the code represents:


pushl %ebp // Setting up stack frame
movl %esp %ebp
subl $32, %ebp // Allocating space on stack for array
......

What does line 3 represent in assembly?

A) movb $109, 9(%ebp)


B) movb $77, -7(%ebp)
C) movb, -9(%ebp), %esp
D) movb $109, -7(%ebp)
E) None of the above

34 (L12)

Question

How does the stack grow?

A. Downwards, with %esp pointing to the highest address in the stack


B. Downwards, with %esp pointing to the lowest address in the stack
C. Upwards, with %esp pointing to the highest address in the stack
D. Upwards, with %esp pointing to the lowest address in the stack

35 (L12)

Question

True or False: Processes always print things in the order that they appear in
code (or in the order that they are created).

True
False

36 (L12)

Question

Which case may create a zombie process

A. Child process is terminated before parent process


B. Child process is terminated after parent process
C. Parent process is terminated before child process
D. Parent process is terminated after child process

37 (L12)

Question

Which is not a state of a process?

A. Terminated
B. Waiting
C. Stopped
D. Running

38 (L13)

Question

What does a shell program do?

NaN

39 (L9)

Question

How does the machine execute a program ? (What cycle?)

a. fetch, store , execute


b. fetch, decode, execute
c. run, store, execute
d. execute, store, decode
e. none of the above

40 (L9)

Question

In a pipeline execution using branch prediction, what happens to the


performance of the program if the prediction is incorrect?

a. stays the same


b. massive speedup
c. big performance difference (slow down)
d. none of the above

41 (L10)

Question

Which is NOT a valid movl operand combination?

a. $0x8, $edx
b. $eax, $edx
c. $(eax), %edx
d. $(eax), %(edx)

42 (L11)

Question

write c source code for this simple assembly code:

0x0804841d <+0>: push %ebp


0x0804841e <+1>: mov %esp,%ebp
0x08048420 <+3>: and $0xfffffff0,%esp
0x08048423 <+6>: sub $0x20,%esp
0x08048426 <+9>: movl $0x5,0x1c(%esp)
0x0804842e <+17>: mov 0x1c(%esp),%eax
0x08048432 <+21>: imul 0x1c(%esp),%eax
0x08048437 <+26>: mov %eax,0x8(%esp)
0x0804843b <+30>: mov 0x1c(%esp),%eax
0x0804843f <+34>: mov %eax,0x4(%esp)
0x08048443 <+38>: movl $0x80484f0,(%esp)
0x0804844a <+45>: call 0x80482f0 printf@plt
0x0804844f <+50>: leave
0x08048450 <+51>: ret

NaN
43 (L12)

Question

If a process contains if(!fork()) execve(...), what aspects of virtual memory


do the child and parent share after execve()?

(a) stack space


(b) heap space
(c) read only space
(d) nothing

44 (L9)

Question

Which part of the Control Unit of the von Neumann architecture "stores the
current instruction"?

a. instruction register
b. instruction counter
c. status register
d. decoder
e. signal generator

45 (L9)

Question

Which part of the Control Unit of the von Neumann architecture "stores the
address of the next instruction" ?

a. instruction register
b. instruction counter
c. status register
d. decoder
e. signal generator

46 (L9)

Question

Which part of the Control Unit of the von Neumann architecture "stores
information about the result of the last operation" ?

a. instruction register
b. instruction counter
c. status register
d. decoder
e. signal generator

47 (L9)

Question

Which part of the Control Unit of the von Neumann architecture " interprets
the instruction and figures out what signals to generate" ?

a. instruction counter
b. decoder
c. instruction register
d. signal generator
e. status register

48 (L9)

Question

Which part of the Control Unit of the von Neumann architecture


"communicates with the rest of the processor" ?
a. decoder
b. instruction counter
c. instruction register
d. signal generator
e. status register

49 (L12)

Question

Which is NOT a state that a process can be in

a. Terminated
b. Running
c. Stopped
d. Crawling

50 (L12)

Question

Which would you use to get the process id?

a. getpid
b. getppid
c. getidp
d. getprocessid

51 (L11)

Question

Which of the following is NOT a caller-save register?

(a) %eax, (b) %ebx, (c) %ecx, (d) %edx


53 (L16)

Question

Given the code below, and a cache of size 4, managed with the least
frequently used algorithm, what are the contents of the cache after
executing this code?
1 #include
2
3 int main () {
4 int a[] = {1, 2, 3, 4, 2, 5};
5 for (int j = 0; j < 6; j++)
6 for (int i = j; i < 6; i++)
7 printf("%d\n", a[i]);
8 return 0;
9}

NaN

54 (L16)

Question

Given the code below, and a cache of size 4, managed with the least
recently used algorithm, what are the contents of the cache after executing
this code?
1 #include
2
3 int main () {
4 int a[] = {1, 2, 3, 4, 2, 5};
5 for (int j = 0; j < 6; j++)
6 for (int i = j; i < 6; i++)
7 printf("%d\n", a[i]);
8 return 0;
9}

NaN
55 (L11)

Question

Which of the following registers is responsible for keeping track of the top of
the stack?

eax, ecx, edx, ebx, esi, edi, esp, ebp

56 (L11)

Question

Which of the following registers is responsible for keeping track of


beginning of the current frame?

eax, ecx, edx, ebx, esi, edi, esp, ebp

57 (L11)

Question

Circle the registers that are managed by the calling function.

eax, ecx, edx, ebx, esi, edi, esp, ebp

58 (L11)

Question

Circle the registers that are managed by the called function:

eax, ecx, edx, ebx, esi, edi, esp, ebp


59 (L11)

Question

What can you do with stack frame storage?

"Pass procedural arguments", "save registers for later restoration", "local


storage", "all of these", "none of these"

60 (L9)

Question

What is the term for the ability of a processor to guess whether or not a
jump instruction will be followed?

"branch prediction logic", "temporal locality", "spatial locality", "conditional


move", "none of these"

62 (L10)

Question

Which of the following is a type of processor operands?

Immediate, register, memory, all of these, none of these

64 (L10)

Question

In what form does the life of a C program begin?

A. assembly code file


B. executable object file
C. source program
D. relocatable object file

68 (L9)

Question

Where are register files located on a PC?

A. Graphics card
B. Main Memory
C. Hard Disk
D. CPU

69 (L14)

Question

Memory components such as registers and caches are __ than other


memory components, while for example main memory (DRAM) and
local disks tend to be _____.

A. smaller faster and costlier, larger slower and cheaper


B. larger slower and cheaper, smaller faster and costlier
C. more reliable, less reliable
D. less used, more used

Vous aimerez peut-être aussi