Frage 1
Frage
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Antworten
-
Multiple strong symbols are not allowed
-
None of these
-
Given multiple weak symbols, chose any of the weak symbols
-
Given a strong symbol and multiple weak symbols, choose the strong symbol.
Frage 2
Frage
Suppose we attempt to compile and link the following two C modules. Linker will generate an error?
Frage 3
Frage
Suppose we attempt to compile and link the following two C modules. Linker will generate an error?
Frage 4
Frage
A branch instruction
Antworten
-
Sets the program counter to one of two possible values
-
Increases the program counter by a fixed amount
-
Sets the program counter to one of many possible values
-
Unconditionally sets the program counter to its operand
Frage 5
Frage
In binary, the number 1/3 is 0.01010101 . . .. In the following, assume that x is an int and y is a short. (short)((0x5555 * (int)y)>>16) and y/3 could differ even when neither computation overflows
Frage 6
Frage
A callee-saved register should be saved before it is written to in a procedure
Frage 7
Frage
In binary, the number 1/3 is 0.01010101 . . .. In the following, assume that x is an int and y is a short. For each x there exists some integer w (which may be different for different xs) such that abs(x/3 - q) < 10, where q = (((0x55555555>>w)*x)>>(32-w)).
Frage 8
Frage
In the FDEMW five-stage pipeline we analyzed in class, if we want to stall memory how many pipeline registers should be given the "stall" signal?
Frage 9
Frage
A CPU register file is a small storage device that
Antworten
-
Consists of a collection of word size registers
-
Houses a critical variable for the duration of the execution of a program
-
Records the results of periodic CPU diagnostics
-
Is automatically loaded when CPU instruction refers to a word of normal memory
Frage 10
Frage
In the FDEMW five-stage pipeline we analyzed in class, if we want to stall decode how many pipeline registers should be given the “normal operation” signal?
Frage 11
Frage
Using a base address [Eb] %edx= 0x1000, and index register [Ei] %ecx=0x02, compute the effective address for:
Antworten
-
0x1064
-
0x1032
-
0x1016
-
0x1010
Frage 12
Frage
A memory leak is caused by a
Antworten
-
Failure to free allocated memory
-
Function that allocates a large amount of memory from the heap
-
None of these
-
Bug in the memory allocator that fails to free memory
Frage 13
Frage
In the two's complement number representation, a negative number with more leading ones is larger (i.e. less negative) than a negative number with fewer leading ones.
Frage 14
Frage
When shifting a two’s complement number to the left, an overflow can only occur if the number is negative, since positive numbers have a zero in the leftmost bit
Frage 15
Frage
A program cannot accidentally use another program's memory space and "crash" a computer that uses (see the img)
1- virtual memory address
2- program relocation
3- separate instruction and data caches
Frage 16
Frage
In x86 assembly, the eax register can be used to hold integers but not addresses.
Frage 17
Frage
A program written directly in machine language (binary) would run faster than the same program written in assembly code and then assembled.
Frage 18
Frage
Initially byte i of memory is i + 0x20 (mod 256), %eax contains the number 3, and %ebx contains the number 5. What is in %ebx after running x86 movl (%eax), %ebx?
Antworten
-
none of the above
-
3
-
0x25
-
0x23
Frage 19
Frage
Adding local variables is usually used to reduce what source of inefficiency?
Frage 20
Frage
Asserting a word line and asserting (to "high" voltage) a bit line writes a 1 to a DRAM cell)
Frage 21
Frage
Inline substitution (also called inlining) is usually used to reduce what source of inefficiency?
Frage 22
Frage
Using a base address [Eb] %edx=0x1000, and index register [Ei] %ecx=0x03, compute the effective address for:
Antworten
-
0x1032
-
0x1014
-
0x1064
-
0x1016
Frage 23
Frage
Jump in the following Y86-64 program. How many times does the addq instruction execute?
Frage 24
Frage
Jump tables, such as are used for switch statements, require that the new PC be determined by a memory read. Suppose we added an assembly instruction memjump accepting a single memory address as its parameter, like memjump (%eax). In the five-stage example pipeline (F D E M W), for how many cycles will we need to bubble and/or stall stage F after executing a memjump?
Frage 25
Frage
Let f32 be the number of distinct numbers that can be represented in 4-byte IEEE-style floating point and u32 be the number of distinct numbers that can be represented as unsigned 4-byte integers. Which of the following is true?
Antworten
-
f32 < u32−1
-
f32 > u32 +1
-
f32 = u32
-
f32 = u32+1
Frage 26
Frage
Let s8 be the number of distinct numbers that can be represented as signed (two's complement) 1-byte integers and u8 be the number of distinct numbers that can be represented as unsigned 1-byte integers. Which of the following is true?
Antworten
-
s8 = u8
-
s8 > u8+1
-
s8 = u8 - 1
-
s8 < u8-1
Frage 27
Frage
Assume a set-associative and a direct-mapped cache both have the same address size, same data capacity, and same number of index bits. This means
Frage 28
Frage
Assume x is the most positive signed integer. What is x + 1?
Antworten
-
none of the above
-
+∞
-
-1
-
-x
Frage 29
Frage
Logical address is calculated by: segment.base + eff_addr
Antworten
-
Selector: eff_addr
-
Segment base + lin_addr
-
Selector: offset
-
Segment base + eff_addr
Frage 30
Frage
Assuming the standard IEEE-style bias, what is the smallest number of bits a float point number could have and represent the number −29/4 exactly?
Frage 31
Frage
Buses are typically designed to transfer fixed-sized chunks of bytes known as
Antworten
-
words
-
frames
-
records
-
pages
Frage 32
Frage
Capacity misses are typically discussed in connection with?
Antworten
-
fully-associative cache
-
direct-mapped caches
-
set-associative caches
-
all of the above
Frage 33
Frage
Check the following (listed in alphabetical order) in order of importance when optimizing code that operates on very large arrays: B = Body of loop optimization (function inlining, efficient math), C = Cache locality, O = big-O of algorithm used
Frage 34
Frage
Compare the size of int and int*
Frage 35
Frage
Loop blocking is usually used to reduce what source of inefficiency?
Antworten
-
poor cache locality
-
data dependencies
-
poor branch prediction
-
procedure call overhead
Frage 36
Frage
Loop unrolling is usually used to remove what source of inefficiency?
Antworten
-
poor cache locality
-
data dependencies
-
poor branch prediction
-
procedure call overhead
Frage 37
Frage
Programs with good ______ ______, tend to access a referenced memory location multiple times in the near future.
Antworten
-
Temporal locality
-
Spatial locality
-
Repetitive locality
-
Associative locality
Frage 38
Frage
Putting \#include "foo.h" in your C file is the equivalent of typing the contents of foo.h into your file
Frage 39
Frage
Consider the following code fragment
Antworten
-
The value of &y is closer to the value of &x than to the value &a
-
The value of *y is closer to the value of *x than to the value *a
-
The value of *a and *b are closer to each other than the values of *x and *y
-
The value of &a and &b are closer to each other than the values of &x and &y
Frage 40
Frage
Compared to dynamic RAM (SRAM), dynamic RAM (DRAM) is
Antworten
-
a) DRAM is cheaper than SRAM
-
b) DRAM is faster than SRAM
-
c) DRAM is more likely to be used for main memory than for on-chip caches
-
d) SRAM is more likely to be used for main memory than for on-chip cache
-
a) DRAM uses more transistors per bit than SRAM
-
b) DRAM uses a capacitor to store a value
-
c) Typically a computer has more DRAM than SRA
Frage 41
Frage
Compiling C into x86 assembly comprises translating each C statement into a single assembly instruction.
Frage 42
Frage
Conflict misses are typically discussed in connection with?
Antworten
-
direct-mapped caches
-
set-associative caches
-
fully-associative caches
-
all of the above
Frage 43
Frage
Rank the following in order of significance when writing code that deals with large arrays:
- Algorithmic efficiency (i.e., big-O),
- Computational efficiency (e.g., loop unrolling, inlining, etc),
- L cache Locality.
Frage 44
Frage
CPE (cycles per element, also called cycles per execution or cycles per instruction in other sources). If we have code with 20 CPE and run it on a problem where my algorithm executes on 100 elements; I should expect the runtime to be
Antworten
-
50-220 cycles
-
0-50 cycles
-
220-1100 cycles
-
1100-2200 cycles
Frage 45
Frage
Reassociation of operators is usually used to reduce what source of inefficiency?
Frage 46
Frage
Register %edx is one of the "callee-save" registers. This means that if procedure baz calls procedure xyxxy
Antworten
-
baz may assume xyxxy did not change %edx
-
xyxxy may communicate with baz through register %edx
-
baz must assume xyxxy could have changed %edx
-
baz may communicate with xyxxy through register %edx
Frage 47
Frage
Register %esi is one of the "caller-save" registers. This means that if procedure baz calls procedure xyxxy
Antworten
-
baz must assume xyxxy could have changed %esi
-
xyxxy may communicate with baz through register %esi
-
baz may assume xyxxy did not change %esi
-
baz may communicate with xyxxy through register %esi
Frage 48
Frage
Dirty bits are associated with (pick the best answer)
Antworten
-
write-back caches
-
write-through caches
-
set-associative caches
-
direct-mapped caches
Frage 49
Frage
Edsger Dijkstra wrote "Go To Statement Considered Harmful" in 1968 in which he argued (translated into current language) that code that uses goto becomes needlessly hard to read and maintain compared to only using if and while. In assembly, we use the goto-like jump instructions extensively; the main reason for this is?
Antworten
-
goto is only bad when mixed with higher-level constructs
-
Dijkstra was wrong
-
no one is reading assembly anyway
-
there is no other alternative in assembly
Frage 50
Frage
Every procedure in an x86 assembly program must be declared using .globl
Frage 51
Frage
Which of the following is a good reason (are good reasons) to equip the CPU with small amounts of fast memory?
I. To make the design of the compiler simpler
II. To make some CPU instructions smaller
III. To make some CPU instructions faster
Antworten
-
III only
-
II and III only
-
I, II, and III
-
II only
Frage 52
Frage
Given 6-bit numbers where 010001 + 001010 = 010110, which of the following describes the number representation used?
Antworten
-
floating-point with 2 exponent bits
-
floating-point with 3 exponent bits
-
integer
-
floating-point with 4 exponent bits
Frage 53
Frage
Given 6-bit numbers where 010101 + 000001 = 010110, which of the following describes the number representation used?
Antworten
-
integer
-
floating-point with 3 exponent bits
-
floating-point with 1 exponent bits
-
floating-point with 2 exponent bits
Frage 54
Frage
Good software design includes writing procedures for code you might otherwise repeat in-line. Pulling code into procedures can help some branch predictors; how else can it improve your program’s performance and/or your compiler’s ability to optimize your code?
Antworten
-
more opportunities for loop unrolling
-
less chance of compiler having to worry about aliasing and side effects
-
more opportunities for pipeline-level parallelism
-
better instruction cache hit rate
Frage 55
Frage
Return from function issues a bubble in pipeline.
Frage 56
Frage
Good software design includes writing procedures for code you might otherwise repeat in-line. Pulling code into procedures involves call/return overhead; how else can it hurt your program's performance and/or your compiler's ability to optimize your code?
Antworten
-
more chance of compiler having to worry about aliasing and side effects
-
fewer opportunities for pipeline-level parallelism
-
worse instruction cache hit rate
-
fewer opportunities for loop unrolling
Frage 57
Frage
SRAM is "static" in the sense that if the power is turned off, SRAM will continue to store data (e.g. as in flash memory in MP3 players or USB thumb drives).
Frage 58
Frage
Suppose addresses A and B have different tags but the same index (for those caches that have tags and indexes, that is). Assume the cache is empty prior to the accesses listed in the questions. In the access pattern "read A, then read B, then read A, then read B" the second read of A will be a miss for?
Frage 59
Frage
How does knowing you have a pipelined processor change the code you write?
Antworten
-
it suggests optimizations like multiple accumulators
-
it suggests optimizations like adding local variables
-
it suggests optimizations like loop unrolling
-
it suggests optimizations like loop reordering
Frage 60
Frage
Suppose addresses A and B have different tags but the same index (for those caches that have tags and indexes, that is). Assume the cache is empty prior to the accesses listed in the questions. In the access pattern "read A, then read B" the read of B will be a miss for
Frage 61
Frage
How is "-1" (decimal) represented in an 8-bit 2's complement binary format?
Frage 62
Frage
Suppose page table entries are 8 bytes long and virtual addresses are 32 bytes long. If each page table is to fit on a single page, what is the smallest pages can be if we have a 2-level page table hierarchy?
Frage 63
Frage
How is 46 (decimal) represented in an 8-bit 2's complement binary format?
Antworten
-
00101100
-
00101110
-
00011110
-
01000110
Frage 64
Frage
How is -10 (decimal) represented in an 8-bit 2's complement binary format?
Antworten
-
11110110
-
10001010
-
11110101
-
11111010
Frage 65
Frage
Which of the following move operations is the following instruction an example of movl (%edx), (%eax)?
Frage 66
Frage
In the access pattern “write A, then write B, then write A”, to minimize
writes to the higher-level cache we should pick which of the following?
Antworten
-
a write-through fully-associative cache
-
a write-back fully-associative cache
-
a write-through direct-mapped cache
-
a write-back direct-mapped cache
-
two or more of the above are equivalently the best option
Frage 67
Frage
How many hex digits are needed to represent the decimal number 67?
Frage 68
Frage
How many ints fit inside x if x is declared as int *x = malloc(8); ? Word size is 4.
Frage 69
Frage
Which of the following move operations is the following instruction an example of movl (%edx), %eax?
Frage 70
Frage
How many rules do Unix linkers use for dealing with multiply defined symbol
Frage 71
Frage
Suppose an array of char (8-bit values) {0x12, 0x34, 0x56, 0x78} is stored at address 0x24 of a little-endian computer. What byte is stored at address 0x26?
Frage 72
Frage
If a computer has 8GB memory, a single 1MB cache, and 4KB of registers, the total amount of data it can store is?
Antworten
-
more than 8GB but less than 8GB + 1MB
-
more than 8GB + 1MB but less than 8GB + 1MB + 1KB
-
more than 8GB + 1MB + 4KB
-
8GB + 1MB + 4KB
Frage 73
Frage
Suppose the 32-bit value 0x12345678 is stored at address 0x24 of a big-endian computer. What byte is stored at address 0x23?
Frage 74
Frage
When the following code fragment is executed on a computer with 32-bit integers and a fully-associative cache with 16-byte cache lines, how many bytes of the array A[] will be fetched into the cache from main memory
Antworten
-
At most 96
-
Exactly 17
-
Exactly 32
-
At most 80
Frage 75
Frage
If a wire carries a logical value of 0, its voltage level will be 0 Volts.
Frage 76
Frage
If we fail to find data in a cache because we have never accessed the data before, we call that a
Antworten
-
cold miss
-
capacity miss
-
conflict miss
-
forced miss
Frage 77
Frage
If we fail to find data in a cache because we've read too much data since we last accessed that same data, we call that a
Antworten
-
capacity miss
-
cold miss
-
conflict miss
-
forced miss
Frage 78
Frage
Suppose the 32-bit value 0x12345678 is stored at address 0x24 of a big-endian computer. What byte is stored at address 0x25?
Frage 79
Frage
If we were running a non-pipelined processor (like SEQ) with a real memory system, which of the following optimization strategies would no longer provide a speed benefit?
Frage 80
Frage
The .data section of an x86 assembly program is used to specify the parameters for each procedure.
Frage 81
Frage
In C, a pointer variable is used for storing an address
Frage 82
Frage
If x is the most negative signed integer, what is -x?
Frage 83
Frage
In a DRAM, all cells have to be periodically refreshed, not just the ones that have been read.
Frage 84
Frage
In a program with good ____________, if a memory location is referenced once, then the program is likely to access nearby memory locations in the near future
Antworten
-
Spatial locality
-
Temporal locality
-
Repetitive locality
-
Associative locality
Frage 85
Frage
The ASCII code for the character 'B' is 0x42. What is the ASCII hex code for the character 'D'?
Frage 86
Frage
If we were running a non-pipelined processor (like SEQ) with a real memory system, which of the following optimization strategies would not longer provide a speed benefit?
Frage 87
Frage
In C, local variables allocated inside functions are allocated:
Antworten
-
On the stack
-
In static storage
-
In virtual memory
-
In the heap
Frage 88
Frage
In C, using default floating point settings, a special value of "infinity" is computed when
Antworten
-
A floating-point computation results in an overflow
-
Program execution is halted
-
An erroneous value is computed and execution continues
-
An exception is raised
Frage 89
Frage
The ASCII code for the character 'B' is 0x42. What is the ASCII hex code for the character ‘E’?
Frage 90
Frage
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Antworten
-
Given a strong symbol and multiple weak symbols, choose the strong symbol.
-
Given multiple weak symbols, chose any of the weak symbols
-
Multiple strong symbols are not allowed.
-
None of these
Frage 91
Frage
The assembly instruction int x used to make system calls only accepts a 1-byte (256-value) argument x, but Linux uses it to support over 300 system calls. How does it do that?
Antworten
-
SRAM would lose its data, DRAM would keep its data
-
SRAM would keep its data, DRAM would keep its data
-
SRAM would keep its data, DRAM would lose its data
-
SRAM would lose its data, DRAM would lose its data
Frage 92
Frage
The contents of how many program registers are modified by an assembly push operation?
Frage 93
Frage
The difference between the SAR (arithmetic shift right) and SHR (logical shift right) operations is that SAR puts a one into the leftmost bit after a shift and SHR puts a zero.
Frage 94
Frage
The EBP is a callee-saved register.
Frage 95
Frage
The EFLAGS register contains the zero flag and the sign flag?
Frage 96
Frage
What is the value of the following C expression? x=0x1234 and y=0x3 ((x >> y) << y)
Antworten
-
0x1230
-
0x1234
-
0x0246
-
0x1200
Frage 97
Frage
The hardware is aware of the program stack
Frage 98
Frage
The instruction addq %rax, %rbx changes what?
Antworten
-
The contents of the rbx register
-
The contents of memory at an address found in the rax register
-
The contents of memory at an address found in the rbx register
-
The contents of the rax register
Frage 99
Frage
What is the value of the following C expression? x=0x00 and y=0xA5 x && ~y
Antworten
-
0xFF50
-
0x0000
-
0x0001
-
0x11A5
Frage 100
Frage
The instruction cmp eax,ebx (or cmp %ebx,%eax in AT&T syntax) computes the value of EAX - EBX.
Frage 101
Frage
_______ - program transformation that reduces the number of iterations for a loop by increasing the number of elements computed on each iteration
Antworten
-
Loop unrolling
-
Memory aliasing
-
Side effect
-
Code motion
Frage 102
Frage
The valid bit is associated with
Antworten
-
fully-associative caches
-
write-through caches
-
set-associative caches
-
direct-mapped caches
Frage 103
Frage
It is possible to explicitly specify the number of threads to be created in the team, using the _____ attribute:
Antworten
-
pragma omp
-
parallel
-
private
-
Num_threads
Frage 104
Frage
CPU optimized for throughput
Frage 105
Frage
The working set of a program is formed by
Antworten
-
The pages that the program is actively using
-
The libraries required by the program
-
The memory of the program that is currently in physical memory
-
All the files the program needs to execute
Frage 106
Frage
This problem occurs when a larger type is converted into a smaller type or with the signed-unsigned operations?
Frage 107
Frage
Using multiple accumulators is usually used to reduce what source of inefficiency?
Frage 108
Frage
169. In C a single statement that performs the equivalent of y=x*100; but without using the multiply operator (*);
Antworten
-
y = (x>>6)+(x<<5)+(x<<2)
-
y = (x<<6)+(x<<3)+(x>>2)
-
y = (x<<5)+(x<<5)+(x<<7)
-
y = (x<<6)+(x<<5)+(x<<2)
Frage 109
Frage
We can encode the C command a ? b : c, where all three variables are of type int,
Antworten
-
((-!!a) & b) | ((-!a) & c)
-
((!!a) & b) | ((!a) & c)
-
Any of the above
-
(a & b) | ((!a) & c)
Frage 110
Frage
We say that pipelining generally increases latency. That statement means (select all that are part of the definition of "increases latency")
Antworten
-
each instruction takes more time to complete
-
each instruction takes less time to complete
-
entire programs take more time to complete
-
entire programs take less time to complete
Frage 111
Frage
Two computers A and B with a cache in the CPU chip differ only in that A has an L2 cache and B does not. Which of the following are possible?
Antworten
-
1 & 2 only
-
2 & 3 only
-
1 only
-
2
Frage 112
Frage
At which of the following times is a stack frame created?
Antworten
-
II and III only
-
II only
-
III only
-
I and II only
Frage 113
Frage
The bitwise and operation (& in C) can be used to flip the bits of a word
Frage 114
Frage
Linking can be performed at
Antworten
-
run time
-
compile time
-
all of the above
-
load time
Frage 115
Frage
Parallel processing mechanisms to achieve parallelism in uniprocessor system are:
Frage 116
Frage
This is an example of?
Frage 117
Frage
This is an example of?
Antworten
-
None
-
Loop unrolling
-
Loop fusion
-
Loop fission
Frage 118
Frage
This is an example of?
Frage 119
Frage
This is an example of?
Frage 120
Frage
This is an example of?
Frage 121
Frage
This is an example of?
Frage 122
Frage
The _______ directive causes threads encountering the barrier to wait until all the other threads in the same team have encountered the barrier.
Antworten
-
single
-
barrier
-
nowait
-
private
Frage 123
Frage
How is 148 (decimal) represented in a 16-bit 2’s complement binary format?
Antworten
-
0000 0000 1101 0111
-
0000 0000 0010 1001
-
1111 1111 0010 1000
-
1111 1111 0110 1100
Frage 124
Frage
In a Compare the runtime of y = x * 5 and y = (x<<2) + x, measured by the time it takes for the resulting value of y to be available somewhere in the pipeline.
Frage 125
Frage
What is the difference between 15 and $15?
Antworten
-
15 is an address, $15 is a value
-
15 is a value, $15 is an address
-
15 is legal in assembly, $15 is not
-
$15 is legal in assembly, 15 is not
Frage 126
Frage
What is the result of the following assembly code instruction?
Antworten
-
Fetch the data from register %ecx and store in register %eax
-
Fetch the data from the register %ecx and store in the memory address indicated by (%eax)
-
Fetch the data from the register %eax and store in register %ecx
-
Fetch the data from the memory address indicated by (%eax) and store in the register %ecx
Frage 127
Frage
What is the value of the following C expression? x=0xA0 and y=0x0F ~x||~y
Antworten
-
0х0001
-
0х6000
-
0xFF50
-
0xFFFF
Frage 128
Frage
What value ends up in EAX afer the following code is executed?
Antworten
-
48 (decimal) or 00110000 (binary) or 0x30 (hex)
-
50 (decimal) or 00110010 (binary) or 0x32 (hex)
-
46 (decimal) or 00101110 (binary) or 0x2E (hex)
-
52 (decimal) or 00110100 (binary) or 0x34 (hex)
Frage 129
Frage
When shifting a two's complement number to the left, an overflow can only occur if the number is negative, since positive numbers have a zero in the leftmost bit.
Frage 130
Frage
Which of the five phases determines how many bytes long an instruction is?
Antworten
-
Fetch
-
Decode
-
Writeback
-
Execute
Frage 131
Frage
Which of the five phases determines what the next PC is?
Antworten
-
Fetch
-
Memory
-
Execute
-
Decode
Frage 132
Frage
Which of the five phases determines the destination register for instructions that write to registers?
Antworten
-
Decode
-
Writeback
-
Fetch
-
Execute
Frage 133
Frage
Which of the following computations may be performed by exactly one CPU instruction? (img)
a = 5;
a = b + c * 5;
for (i = 0; i < 10; i += a[i++]);
Antworten
-
I, II, and III
-
II only
-
I and II only
-
I only
Frage 134
Frage
Which of the following is true?
Antworten
-
A direct-mapped cache is a set-associative cache with set size 1
-
A direct-mapped cache is a fully-associative cache with only one set
-
A direct-mapped cache is a fully-associative cache with set size 1
-
A direct-mapped cache is a set-associative cache with only one set
Frage 135
Frage
Which of the following manages the transfer of data between the cache and main memory
Antworten
-
Operating system
-
Compiler
-
Hardware
-
Registry
Frage 136
Frage
Which of the following manages the transfer of data between the CPU registers and the cache
Antworten
-
Operating system
-
Compiler
-
Hardware
-
Registry
Frage 137
Frage
Which of the following registers is the lower order 16 bit register of register %ecx?
Frage 138
Frage
Which of the following statements about alignment within C struct's is true?
Antworten
-
A constant offset associated with the member is added to the address
-
The struct consists of an array of pointers to the elements of the struct
-
The element name is looked up in a symbol table
-
A linear search is made from the base address of the struct
Frage 139
Frage
Which of the following statements about floating-point numbers in C is true?
Antworten
-
II only
-
III only
-
I
-
I and II
Frage 140
Frage
Which one of the following IA32 registers is typically used for stack management?
Frage 141
Frage
Which one of the following optimizations does not provide any speed benefit for a non-pipelined processor, such as SEQ?
Frage 142
Frage
Which of the following levels of a typical memory hierarchy transfers data in chunks of smallest size?
Frage 143
Frage
In C, a pointer variable is used for storing an address
Frage 144
Frage
If we cut power for one millisecond, which of the following is true?
Antworten
-
SRAM would keep its data, DRAM would lose its data
-
SRAM would lose its data, DRAM would keep its data
-
SRAM would lose its data, DRAM would lose its data
-
SRAM would keep its data, DRAM would keep its data
Frage 145
Frage
If we cut power for one minute, which of the following is true?
Antworten
-
SRAM would lose its data, DRAM would lose its data
-
SRAM would lose its data, DRAM would keep its data
-
SRAM would keep its data, DRAM would keep its data
-
SRAM would keep its data, DRAM would lose its data
Frage 146
Frage
Select the most correct statement from the following as applied over the last two decades:
Antworten
-
Processors get faster but memory does not
-
Processors and memory both get faster, but memory gets faster faster that processors do
-
Processors and memory both get faster, but processors get faster than memory does
-
Memory gets faster but processor does not
Frage 147
Frage
Which one of the following optimizations does not provide any speed benefit for a
non-pipelined processor, such as SEQ?
Antworten
-
Using more efficient algorithms
-
Invocation inlining
-
Reassociation
-
Storing reused, computed values in variables instead of recomputing them
Frage 148
Frage
Consider the following code. Assume the compiler is performing no optimization. Which of the following strategies would improve the speed of this code the most in the case where it returns true?
Antworten
-
Unroll the loop
-
Pull the (x % i)==0 into a function isDivisibleBy
-
Declare int sx = (int)sqrt(x) and change i < sqrt(x) to i < sx
-
Move the check for (x % 2) != 0 to before the loop
Frage 149
Frage
Consider the following code. This code would most likely benefit from which of the following optimization strategies
Frage 150
Frage
What does the following C code print?
Antworten
-
P = 103, c = 101
-
P = 104, c = 101
-
P = 105, c = 103
-
P = 104, c = 102
Frage 151
Frage
The bitwise and operation (& in C) can be used to flip the bits of a word
Frage 152
Frage
The bitwise xor operation (^ in C) can be used to flip the bits of a word
Frage 153
Frage
Consider a direct-mapped cache with 256 sets and 16 byte blocks. In this cache the address 0x12345 maps to the same set as which of the following addresses?
Antworten
-
0x02345
-
0x22244
-
0x12040
-
0x12354
Frage 154
Frage
In C, on a 34-bit x86 machine, the expression (1 << 31) results in a negative integer
Frage 155
Frage
Consider the following code. Which of the following changes would make the largest positive impact on its cache locality?
Antworten
-
Put the for-i loop inside of the for-j loop instead of the other way around
-
Store the result of (i*101)%n outside the inner loop
-
Block the accesses by nesting three or four for loops instead of just two
-
Change int** to int*
Frage 156
Frage
Consider the following code. Assume the compiler is performing no optimizations and that isPrime is the exact code presented in another question on this exam. Which of the following strategies would improve the speed of this code the most?
Antworten
-
Inline the isPrime call
-
Add a second ans accumulator
-
Swap the order of the if statements
-
Change the nested if statements to a single if with a &&
Frage 157
Frage
Consider the following two versions of a C function: (Assume len is larger than 10)
Antworten
-
sum1
-
None of them
-
sum2
-
Both of them
Frage 158
Frage
Which of the following is necessary true regarding the following code fragment?
Antworten
-
It exhibits locality of reference but only when a == b
-
It exhibits locality of reference because the variables are allocated near each other
-
It exhibit no locality of reference
-
It exhibits locality of reference no matter where the variables are allocated
Frage 159
Frage
A & B is the bitwise version of A && B; A | B is the bitwise version of A || B; which of the following is the bitwise version of A == B?
Antworten
-
~(a = b)
-
a = b
-
~ (a ^ b)
-
a ^ b
Frage 160
Frage
The unary & operator returns (in C language)
Antworten
-
The logical “and” of two integer operands
-
The logical “or” of two integer operands
-
The value of a data object
-
The address of a data object
Frage 161
Frage
In C a single statement that performs the equivalent of y = x *100, but without using the multiply operator (*)
Antworten
-
y = (x<<6) + (x<<5) + (x<<2)
-
y = (x>>6) + (x<<5) + (x<<2)
-
y = (x<<6) + (x<<3) + (x>>2)
-
y = (x<<5) + (x<<5) + (x<<7)
Frage 162
Frage
Adding local variable is usually used to reduce what source inefficiency?
Frage 163
Frage
If, in C, an array is declared by “int a[10];”, then accessing a[11] during execution will generate an error message.
Frage 164
Frage
In C, if x is an integer variable, the expression “x << 3” computes x * 8 but does not change the value of x.
Frage 165
Frage
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Antworten
-
for(i=0;i<n;i+=1) for(j=0;j<n;j+=1) a[i][j] = b[j][i];
-
for(j=0;j<n;j+=1) for(i=0;i<n;i+=1) a[i][j] = b[j][i];
-
-
two or more of the above are equivalently the fastest
Frage 166
Frage
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Antworten
-
a) for(k=0; k<n; k+=16) for(l=0; l<n; l+=16)
for(j=0;j<16;j+=1) for(i=0;i<16;i+=1)
a[i+l][j+k] = b[i+l][j+k];
-
for(i=0;i<n;i+=1) for(j=0;j<n;j+=1) a[i][j] = b[i][j];
-
for(j=0;j<n;j+=1) for(i=0;i<n;i+=1) a[i][j] = b[i][j];
-
two or more of the above are equivalently the fastest
Frage 167
Frage
In binary, the number 1/3 is 0.01010101 . . .. In the following, assume that x is an int and y is a short. (short)((0x5555 * (int)y)>>16) and y/3 could differ because of overflow
Frage 168
Frage
How is 148 (decimal) represented in a 16-bit 2’s complement binary format?
Antworten
-
0000 0000 1101 0111
-
0000 0000 0010 1001
-
1111 1111 0010 1000
-
1111 1111 0110 1100
Frage 169
Frage
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Frage 170
Frage
In a Compare the runtime of y = x * 5 and y = (x<<2) + x, measured by the time it takes for the resulting value of y to be available somewhere in the pipeline.
Frage 171
Frage
The program counter contains:
Antworten
-
The address of the CPU instruction that is about to be executed
-
The number of programs currently running
-
The number of CPU instructions a program has executed so far
-
The number of processes currently running
Frage 172
Frage
A memory leak is caused by a:
Antworten
-
Bug in the memory allocator that fails to free memory
-
Failure to free allocated memory
-
None of these
-
Function that allocates a large amount of memory from the heap
Frage 173
Frage
Registers and cache memory are the same thing
Frage 174
Frage
In a computer in which both addresses and integers are 32 bits wide, how many bytes of memory will the compiler allocate for the following code fragment?
Frage 175
Frage
In C, local variables allocated inside functions are allocated:
Antworten
-
On the stack
-
In the heap
-
In virtual memory
-
In static storage
Frage 176
Frage
What is the value of the following C expression? x=0xA0 and y=0x0F ~x || ~y
Antworten
-
0x0000
-
0xFF50
-
0xFFFF
-
0x0001
Frage 177
Frage
What is an example of?
Antworten
-
Loop unrolling
-
Loop fission
-
none
-
Loop fusion
Frage 178
Frage
How is 215 (decimal) represented in a 16-bit 2's complement binary format?
Antworten
-
1111 1111 0010 1001
-
0000 0000 1101 0111
-
0000 0000 0010 1001
-
1111 1111 0010 1000
Frage 179
Frage
This code indicates that Work2 and Work3 must be run in _______ :
Antworten
-
none
-
parallel
-
sequence
-
both
Frage 180
Frage
____ involve identifying a computation that is performed multiple times (e.g., within a loop), but such that the result of the computation will not change.
Antworten
-
Code motion
-
Side effect
-
Loop unrolling
-
Memory aliasing
Frage 181
Frage
In C, for the expression (x | THE_MASK), where THE_MASK has at least one bit that is not zero, the result will be zero if all the bits of x are zero.
Frage 182
Frage
What is the value of the following C expression? x = 0x128 and y = 0x2 ~x << y (in hex)
Antworten
-
0x000004A0
-
0x000FFB5C
-
0xFFFFFB5C
-
0x00FF04A0
Frage 183
Frage
In C, using default floating point settings, a special value of "infinity" is computed when:
Antworten
-
A floating-point computation results in an overflow
-
Program execution is halted
-
An exception is raised
-
An erroneous value is computed and execution continues
Frage 184
Frage
GPU optimized for latency.
Frage 185
Frage
If you don’t explicitly specify the number of threads (OpenMP) how many thread will be executed?
Frage 186
Frage
CPU optimized for latency
Frage 187
Frage
Program take as input a collection of relocatable object files and command-line arguments and generate as output a fully linked executable object file that can be loaded and run:
Antworten
-
Static linker
-
Dynamic linker
-
Both
-
none
Frage 188
Frage
If we find the data we want in a cache, we call that a
Antworten
-
Cache find
-
Cache hit
-
Cache miss
-
Cache success
Frage 189
Frage
The___construct forms a region that contains one or more structured blocks. Each block of a_____ directive executed once by one of the threads (any one) in the team?
Antworten
-
parallel
-
master
-
section
-
schedule
Frage 190
Frage
Pick a value for A and for B which will cause the two procedures below to return different results.
Antworten
-
a=7; b=1;
-
a=1; b=2;
-
a=1; b=5;
-
a=1; b=1;
Frage 191
Frage
Pick a value for A and for B which will cause the two procedures below to return the same results.
Frage 192
Frage
A is the 4-bit value 0011 and B is the 4-bit value 0110. What is A^B?
Frage 193
Frage
Consider the following code. This code would most likely benefit from which of the following optimization strategies.
Antworten
-
improving locality
-
loop unrolling
-
using multiple
-
adding local variables
Frage 194
Frage
Conflict misses are typically discussed in connection with?
Antworten
-
all of the above
-
fully-associative caches
-
set-associative caches
-
direct-mapped caches
Frage 195
Frage
What is -5 as a six bit two’s complement number? Answer in binary
Antworten
-
101111
-
111011
-
000001
-
011011
Frage 196
Frage
By default, OpenMp _____ assigns loop iterations to threads. When the parallel for block is entered, it assigns each thread the set of loop iterations it is to execute?
Antworten
-
static
-
runtime
-
dynamic
-
auto
Frage 197
Frage
In general, which of the following is slowest?
Frage 198
Frage
How is 28 (decimal) represented in an 8-bit 2’s complement binary format?
Antworten
-
0001 1100
-
1110 0100
-
1100 1011
-
1110 0011
Frage 199
Frage
The ASCII code for the character ‘b’ is 98. How can the character ‘b’ be represented in binary using ASCII codes?
Antworten
-
1011 1111
-
1010 1111
-
0110 0010
-
1000 0001
Frage 200
Frage
This code indicates that any of the tasks Work1, Work2 + Work3 and Work4 may run in _____________:
Antworten
-
parallel
-
sequence
-
both
-
none