Questão 1
Questão
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Responda
-
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.
Questão 2
Questão
Suppose we attempt to compile and link the following two C modules. Linker will generate an error?
Questão 3
Questão
Suppose we attempt to compile and link the following two C modules. Linker will generate an error?
Questão 4
Questão
A branch instruction
Responda
-
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
Questão 5
Questão
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
Questão 6
Questão
A callee-saved register should be saved before it is written to in a procedure
Questão 7
Questão
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)).
Questão 8
Questão
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?
Questão 9
Questão
A CPU register file is a small storage device that
Responda
-
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
Questão 10
Questão
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?
Questão 11
Questão
Using a base address [Eb] %edx= 0x1000, and index register [Ei] %ecx=0x02, compute the effective address for:
Responda
-
0x1064
-
0x1032
-
0x1016
-
0x1010
Questão 12
Questão
A memory leak is caused by a
Responda
-
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
Questão 13
Questão
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.
Questão 14
Questão
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
Questão 15
Questão
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
Questão 16
Questão
In x86 assembly, the eax register can be used to hold integers but not addresses.
Questão 17
Questão
A program written directly in machine language (binary) would run faster than the same program written in assembly code and then assembled.
Questão 18
Questão
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?
Responda
-
none of the above
-
3
-
0x25
-
0x23
Questão 19
Questão
Adding local variables is usually used to reduce what source of inefficiency?
Questão 20
Questão
Asserting a word line and asserting (to "high" voltage) a bit line writes a 1 to a DRAM cell)
Questão 21
Questão
Inline substitution (also called inlining) is usually used to reduce what source of inefficiency?
Questão 22
Questão
Using a base address [Eb] %edx=0x1000, and index register [Ei] %ecx=0x03, compute the effective address for:
Responda
-
0x1032
-
0x1014
-
0x1064
-
0x1016
Questão 23
Questão
Jump in the following Y86-64 program. How many times does the addq instruction execute?
Questão 24
Questão
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?
Questão 25
Questão
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?
Responda
-
f32 < u32−1
-
f32 > u32 +1
-
f32 = u32
-
f32 = u32+1
Questão 26
Questão
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?
Responda
-
s8 = u8
-
s8 > u8+1
-
s8 = u8 - 1
-
s8 < u8-1
Questão 27
Questão
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
Questão 28
Questão
Assume x is the most positive signed integer. What is x + 1?
Responda
-
none of the above
-
+∞
-
-1
-
-x
Questão 29
Questão
Logical address is calculated by: segment.base + eff_addr
Responda
-
Selector: eff_addr
-
Segment base + lin_addr
-
Selector: offset
-
Segment base + eff_addr
Questão 30
Questão
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?
Questão 31
Questão
Buses are typically designed to transfer fixed-sized chunks of bytes known as
Responda
-
words
-
frames
-
records
-
pages
Questão 32
Questão
Capacity misses are typically discussed in connection with?
Responda
-
fully-associative cache
-
direct-mapped caches
-
set-associative caches
-
all of the above
Questão 33
Questão
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
Questão 34
Questão
Compare the size of int and int*
Questão 35
Questão
Loop blocking is usually used to reduce what source of inefficiency?
Responda
-
poor cache locality
-
data dependencies
-
poor branch prediction
-
procedure call overhead
Questão 36
Questão
Loop unrolling is usually used to remove what source of inefficiency?
Responda
-
poor cache locality
-
data dependencies
-
poor branch prediction
-
procedure call overhead
Questão 37
Questão
Programs with good ______ ______, tend to access a referenced memory location multiple times in the near future.
Responda
-
Temporal locality
-
Spatial locality
-
Repetitive locality
-
Associative locality
Questão 38
Questão
Putting \#include "foo.h" in your C file is the equivalent of typing the contents of foo.h into your file
Questão 39
Questão
Consider the following code fragment
Responda
-
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
Questão 40
Questão
Compared to dynamic RAM (SRAM), dynamic RAM (DRAM) is
Responda
-
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
Questão 41
Questão
Compiling C into x86 assembly comprises translating each C statement into a single assembly instruction.
Questão 42
Questão
Conflict misses are typically discussed in connection with?
Responda
-
direct-mapped caches
-
set-associative caches
-
fully-associative caches
-
all of the above
Questão 43
Questão
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.
Questão 44
Questão
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
Responda
-
50-220 cycles
-
0-50 cycles
-
220-1100 cycles
-
1100-2200 cycles
Questão 45
Questão
Reassociation of operators is usually used to reduce what source of inefficiency?
Questão 46
Questão
Register %edx is one of the "callee-save" registers. This means that if procedure baz calls procedure xyxxy
Responda
-
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
Questão 47
Questão
Register %esi is one of the "caller-save" registers. This means that if procedure baz calls procedure xyxxy
Responda
-
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
Questão 48
Questão
Dirty bits are associated with (pick the best answer)
Responda
-
write-back caches
-
write-through caches
-
set-associative caches
-
direct-mapped caches
Questão 49
Questão
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?
Responda
-
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
Questão 50
Questão
Every procedure in an x86 assembly program must be declared using .globl
Questão 51
Questão
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
Responda
-
III only
-
II and III only
-
I, II, and III
-
II only
Questão 52
Questão
Given 6-bit numbers where 010001 + 001010 = 010110, which of the following describes the number representation used?
Responda
-
floating-point with 2 exponent bits
-
floating-point with 3 exponent bits
-
integer
-
floating-point with 4 exponent bits
Questão 53
Questão
Given 6-bit numbers where 010101 + 000001 = 010110, which of the following describes the number representation used?
Responda
-
integer
-
floating-point with 3 exponent bits
-
floating-point with 1 exponent bits
-
floating-point with 2 exponent bits
Questão 54
Questão
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?
Responda
-
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
Questão 55
Questão
Return from function issues a bubble in pipeline.
Questão 56
Questão
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?
Responda
-
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
Questão 57
Questão
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).
Questão 58
Questão
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?
Questão 59
Questão
How does knowing you have a pipelined processor change the code you write?
Responda
-
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
Questão 60
Questão
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
Questão 61
Questão
How is "-1" (decimal) represented in an 8-bit 2's complement binary format?
Questão 62
Questão
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?
Questão 63
Questão
How is 46 (decimal) represented in an 8-bit 2's complement binary format?
Responda
-
00101100
-
00101110
-
00011110
-
01000110
Questão 64
Questão
How is -10 (decimal) represented in an 8-bit 2's complement binary format?
Responda
-
11110110
-
10001010
-
11110101
-
11111010
Questão 65
Questão
Which of the following move operations is the following instruction an example of movl (%edx), (%eax)?
Questão 66
Questão
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?
Responda
-
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
Questão 67
Questão
How many hex digits are needed to represent the decimal number 67?
Questão 68
Questão
How many ints fit inside x if x is declared as int *x = malloc(8); ? Word size is 4.
Questão 69
Questão
Which of the following move operations is the following instruction an example of movl (%edx), %eax?
Questão 70
Questão
How many rules do Unix linkers use for dealing with multiply defined symbol
Questão 71
Questão
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?
Questão 72
Questão
If a computer has 8GB memory, a single 1MB cache, and 4KB of registers, the total amount of data it can store is?
Responda
-
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
Questão 73
Questão
Suppose the 32-bit value 0x12345678 is stored at address 0x24 of a big-endian computer. What byte is stored at address 0x23?
Questão 74
Questão
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
Responda
-
At most 96
-
Exactly 17
-
Exactly 32
-
At most 80
Questão 75
Questão
If a wire carries a logical value of 0, its voltage level will be 0 Volts.
Questão 76
Questão
If we fail to find data in a cache because we have never accessed the data before, we call that a
Responda
-
cold miss
-
capacity miss
-
conflict miss
-
forced miss
Questão 77
Questão
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
Responda
-
capacity miss
-
cold miss
-
conflict miss
-
forced miss
Questão 78
Questão
Suppose the 32-bit value 0x12345678 is stored at address 0x24 of a big-endian computer. What byte is stored at address 0x25?
Questão 79
Questão
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?
Questão 80
Questão
The .data section of an x86 assembly program is used to specify the parameters for each procedure.
Questão 81
Questão
In C, a pointer variable is used for storing an address
Questão 82
Questão
If x is the most negative signed integer, what is -x?
Questão 83
Questão
In a DRAM, all cells have to be periodically refreshed, not just the ones that have been read.
Questão 84
Questão
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
Responda
-
Spatial locality
-
Temporal locality
-
Repetitive locality
-
Associative locality
Questão 85
Questão
The ASCII code for the character 'B' is 0x42. What is the ASCII hex code for the character 'D'?
Questão 86
Questão
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?
Questão 87
Questão
In C, local variables allocated inside functions are allocated:
Responda
-
On the stack
-
In static storage
-
In virtual memory
-
In the heap
Questão 88
Questão
In C, using default floating point settings, a special value of "infinity" is computed when
Responda
-
A floating-point computation results in an overflow
-
Program execution is halted
-
An erroneous value is computed and execution continues
-
An exception is raised
Questão 89
Questão
The ASCII code for the character 'B' is 0x42. What is the ASCII hex code for the character ‘E’?
Questão 90
Questão
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Responda
-
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
Questão 91
Questão
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?
Responda
-
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
Questão 92
Questão
The contents of how many program registers are modified by an assembly push operation?
Questão 93
Questão
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.
Questão 94
Questão
The EBP is a callee-saved register.
Questão 95
Questão
The EFLAGS register contains the zero flag and the sign flag?
Questão 96
Questão
What is the value of the following C expression? x=0x1234 and y=0x3 ((x >> y) << y)
Responda
-
0x1230
-
0x1234
-
0x0246
-
0x1200
Questão 97
Questão
The hardware is aware of the program stack
Questão 98
Questão
The instruction addq %rax, %rbx changes what?
Responda
-
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
Questão 99
Questão
What is the value of the following C expression? x=0x00 and y=0xA5 x && ~y
Responda
-
0xFF50
-
0x0000
-
0x0001
-
0x11A5
Questão 100
Questão
The instruction cmp eax,ebx (or cmp %ebx,%eax in AT&T syntax) computes the value of EAX - EBX.
Questão 101
Questão
_______ - program transformation that reduces the number of iterations for a loop by increasing the number of elements computed on each iteration
Responda
-
Loop unrolling
-
Memory aliasing
-
Side effect
-
Code motion
Questão 102
Questão
The valid bit is associated with
Responda
-
fully-associative caches
-
write-through caches
-
set-associative caches
-
direct-mapped caches
Questão 103
Questão
It is possible to explicitly specify the number of threads to be created in the team, using the _____ attribute:
Responda
-
pragma omp
-
parallel
-
private
-
Num_threads
Questão 104
Questão
CPU optimized for throughput
Questão 105
Questão
The working set of a program is formed by
Responda
-
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
Questão 106
Questão
This problem occurs when a larger type is converted into a smaller type or with the signed-unsigned operations?
Questão 107
Questão
Using multiple accumulators is usually used to reduce what source of inefficiency?
Questão 108
Questão
169. In C a single statement that performs the equivalent of y=x*100; but without using the multiply operator (*);
Responda
-
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)
Questão 109
Questão
We can encode the C command a ? b : c, where all three variables are of type int,
Responda
-
((-!!a) & b) | ((-!a) & c)
-
((!!a) & b) | ((!a) & c)
-
Any of the above
-
(a & b) | ((!a) & c)
Questão 110
Questão
We say that pipelining generally increases latency. That statement means (select all that are part of the definition of "increases latency")
Responda
-
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
Questão 111
Questão
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?
Responda
-
1 & 2 only
-
2 & 3 only
-
1 only
-
2
Questão 112
Questão
At which of the following times is a stack frame created?
Responda
-
II and III only
-
II only
-
III only
-
I and II only
Questão 113
Questão
The bitwise and operation (& in C) can be used to flip the bits of a word
Questão 114
Questão
Linking can be performed at
Responda
-
run time
-
compile time
-
all of the above
-
load time
Questão 115
Questão
Parallel processing mechanisms to achieve parallelism in uniprocessor system are:
Questão 116
Questão
This is an example of?
Questão 117
Questão
This is an example of?
Responda
-
None
-
Loop unrolling
-
Loop fusion
-
Loop fission
Questão 118
Questão
This is an example of?
Questão 119
Questão
This is an example of?
Questão 120
Questão
This is an example of?
Questão 121
Questão
This is an example of?
Questão 122
Questão
The _______ directive causes threads encountering the barrier to wait until all the other threads in the same team have encountered the barrier.
Responda
-
single
-
barrier
-
nowait
-
private
Questão 123
Questão
How is 148 (decimal) represented in a 16-bit 2’s complement binary format?
Responda
-
0000 0000 1101 0111
-
0000 0000 0010 1001
-
1111 1111 0010 1000
-
1111 1111 0110 1100
Questão 124
Questão
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.
Questão 125
Questão
What is the difference between 15 and $15?
Responda
-
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
Questão 126
Questão
What is the result of the following assembly code instruction?
Responda
-
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
Questão 127
Questão
What is the value of the following C expression? x=0xA0 and y=0x0F ~x||~y
Responda
-
0х0001
-
0х6000
-
0xFF50
-
0xFFFF
Questão 128
Questão
What value ends up in EAX afer the following code is executed?
Responda
-
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)
Questão 129
Questão
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.
Questão 130
Questão
Which of the five phases determines how many bytes long an instruction is?
Responda
-
Fetch
-
Decode
-
Writeback
-
Execute
Questão 131
Questão
Which of the five phases determines what the next PC is?
Responda
-
Fetch
-
Memory
-
Execute
-
Decode
Questão 132
Questão
Which of the five phases determines the destination register for instructions that write to registers?
Responda
-
Decode
-
Writeback
-
Fetch
-
Execute
Questão 133
Questão
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++]);
Responda
-
I, II, and III
-
II only
-
I and II only
-
I only
Questão 134
Questão
Which of the following is true?
Responda
-
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
Questão 135
Questão
Which of the following manages the transfer of data between the cache and main memory
Responda
-
Operating system
-
Compiler
-
Hardware
-
Registry
Questão 136
Questão
Which of the following manages the transfer of data between the CPU registers and the cache
Responda
-
Operating system
-
Compiler
-
Hardware
-
Registry
Questão 137
Questão
Which of the following registers is the lower order 16 bit register of register %ecx?
Questão 138
Questão
Which of the following statements about alignment within C struct's is true?
Responda
-
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
Questão 139
Questão
Which of the following statements about floating-point numbers in C is true?
Responda
-
II only
-
III only
-
I
-
I and II
Questão 140
Questão
Which one of the following IA32 registers is typically used for stack management?
Questão 141
Questão
Which one of the following optimizations does not provide any speed benefit for a non-pipelined processor, such as SEQ?
Questão 142
Questão
Which of the following levels of a typical memory hierarchy transfers data in chunks of smallest size?
Questão 143
Questão
In C, a pointer variable is used for storing an address
Questão 144
Questão
If we cut power for one millisecond, which of the following is true?
Responda
-
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
Questão 145
Questão
If we cut power for one minute, which of the following is true?
Responda
-
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
Questão 146
Questão
Select the most correct statement from the following as applied over the last two decades:
Responda
-
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
Questão 147
Questão
Which one of the following optimizations does not provide any speed benefit for a
non-pipelined processor, such as SEQ?
Responda
-
Using more efficient algorithms
-
Invocation inlining
-
Reassociation
-
Storing reused, computed values in variables instead of recomputing them
Questão 148
Questão
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?
Responda
-
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
Questão 149
Questão
Consider the following code. This code would most likely benefit from which of the following optimization strategies
Questão 150
Questão
What does the following C code print?
Responda
-
P = 103, c = 101
-
P = 104, c = 101
-
P = 105, c = 103
-
P = 104, c = 102
Questão 151
Questão
The bitwise and operation (& in C) can be used to flip the bits of a word
Questão 152
Questão
The bitwise xor operation (^ in C) can be used to flip the bits of a word
Questão 153
Questão
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?
Responda
-
0x02345
-
0x22244
-
0x12040
-
0x12354
Questão 154
Questão
In C, on a 34-bit x86 machine, the expression (1 << 31) results in a negative integer
Questão 155
Questão
Consider the following code. Which of the following changes would make the largest positive impact on its cache locality?
Responda
-
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*
Questão 156
Questão
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?
Responda
-
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 &&
Questão 157
Questão
Consider the following two versions of a C function: (Assume len is larger than 10)
Responda
-
sum1
-
None of them
-
sum2
-
Both of them
Questão 158
Questão
Which of the following is necessary true regarding the following code fragment?
Responda
-
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
Questão 159
Questão
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?
Responda
-
~(a = b)
-
a = b
-
~ (a ^ b)
-
a ^ b
Questão 160
Questão
The unary & operator returns (in C language)
Responda
-
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
Questão 161
Questão
In C a single statement that performs the equivalent of y = x *100, but without using the multiply operator (*)
Responda
-
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)
Questão 162
Questão
Adding local variable is usually used to reduce what source inefficiency?
Questão 163
Questão
If, in C, an array is declared by “int a[10];”, then accessing a[11] during execution will generate an error message.
Questão 164
Questão
In C, if x is an integer variable, the expression “x << 3” computes x * 8 but does not change the value of x.
Questão 165
Questão
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Responda
-
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
Questão 166
Questão
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Responda
-
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
Questão 167
Questão
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
Questão 168
Questão
How is 148 (decimal) represented in a 16-bit 2’s complement binary format?
Responda
-
0000 0000 1101 0111
-
0000 0000 0010 1001
-
1111 1111 0010 1000
-
1111 1111 0110 1100
Questão 169
Questão
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Questão 170
Questão
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.
Questão 171
Questão
The program counter contains:
Responda
-
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
Questão 172
Questão
A memory leak is caused by a:
Responda
-
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
Questão 173
Questão
Registers and cache memory are the same thing
Questão 174
Questão
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?
Questão 175
Questão
In C, local variables allocated inside functions are allocated:
Responda
-
On the stack
-
In the heap
-
In virtual memory
-
In static storage
Questão 176
Questão
What is the value of the following C expression? x=0xA0 and y=0x0F ~x || ~y
Responda
-
0x0000
-
0xFF50
-
0xFFFF
-
0x0001
Questão 177
Questão
What is an example of?
Responda
-
Loop unrolling
-
Loop fission
-
none
-
Loop fusion
Questão 178
Questão
How is 215 (decimal) represented in a 16-bit 2's complement binary format?
Responda
-
1111 1111 0010 1001
-
0000 0000 1101 0111
-
0000 0000 0010 1001
-
1111 1111 0010 1000
Questão 179
Questão
This code indicates that Work2 and Work3 must be run in _______ :
Responda
-
none
-
parallel
-
sequence
-
both
Questão 180
Questão
____ 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.
Responda
-
Code motion
-
Side effect
-
Loop unrolling
-
Memory aliasing
Questão 181
Questão
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.
Questão 182
Questão
What is the value of the following C expression? x = 0x128 and y = 0x2 ~x << y (in hex)
Responda
-
0x000004A0
-
0x000FFB5C
-
0xFFFFFB5C
-
0x00FF04A0
Questão 183
Questão
In C, using default floating point settings, a special value of "infinity" is computed when:
Responda
-
A floating-point computation results in an overflow
-
Program execution is halted
-
An exception is raised
-
An erroneous value is computed and execution continues
Questão 184
Questão
GPU optimized for latency.
Questão 185
Questão
If you don’t explicitly specify the number of threads (OpenMP) how many thread will be executed?
Questão 186
Questão
CPU optimized for latency
Questão 187
Questão
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:
Responda
-
Static linker
-
Dynamic linker
-
Both
-
none
Questão 188
Questão
If we find the data we want in a cache, we call that a
Responda
-
Cache find
-
Cache hit
-
Cache miss
-
Cache success
Questão 189
Questão
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?
Responda
-
parallel
-
master
-
section
-
schedule
Questão 190
Questão
Pick a value for A and for B which will cause the two procedures below to return different results.
Responda
-
a=7; b=1;
-
a=1; b=2;
-
a=1; b=5;
-
a=1; b=1;
Questão 191
Questão
Pick a value for A and for B which will cause the two procedures below to return the same results.
Questão 192
Questão
A is the 4-bit value 0011 and B is the 4-bit value 0110. What is A^B?
Questão 193
Questão
Consider the following code. This code would most likely benefit from which of the following optimization strategies.
Responda
-
improving locality
-
loop unrolling
-
using multiple
-
adding local variables
Questão 194
Questão
Conflict misses are typically discussed in connection with?
Responda
-
all of the above
-
fully-associative caches
-
set-associative caches
-
direct-mapped caches
Questão 195
Questão
What is -5 as a six bit two’s complement number? Answer in binary
Responda
-
101111
-
111011
-
000001
-
011011
Questão 196
Questão
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?
Responda
-
static
-
runtime
-
dynamic
-
auto
Questão 197
Questão
In general, which of the following is slowest?
Questão 198
Questão
How is 28 (decimal) represented in an 8-bit 2’s complement binary format?
Responda
-
0001 1100
-
1110 0100
-
1100 1011
-
1110 0011
Questão 199
Questão
The ASCII code for the character ‘b’ is 98. How can the character ‘b’ be represented in binary using ASCII codes?
Responda
-
1011 1111
-
1010 1111
-
0110 0010
-
1000 0001
Questão 200
Questão
This code indicates that any of the tasks Work1, Work2 + Work3 and Work4 may run in _____________:
Responda
-
parallel
-
sequence
-
both
-
none