SDP10 Final - Part I

Descripción

SDP10 Test sobre SDP10 Final - Part I, creado por Csse 1502 el 12/05/2018.
Csse 1502
Test por Csse 1502, actualizado hace más de 1 año
Csse 1502
Creado por Csse 1502 hace más de 6 años
383
3

Resumen del Recurso

Pregunta 1

Pregunta
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Respuesta
  • 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.

Pregunta 2

Pregunta
Suppose we attempt to compile and link the following two C modules. Linker will generate an error?
Respuesta
  • true
  • false

Pregunta 3

Pregunta
Suppose we attempt to compile and link the following two C modules. Linker will generate an error?
Respuesta
  • true
  • false

Pregunta 4

Pregunta
A branch instruction
Respuesta
  • 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

Pregunta 5

Pregunta
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
Respuesta
  • True
  • False

Pregunta 6

Pregunta
A callee-saved register should be saved before it is written to in a procedure
Respuesta
  • True
  • False

Pregunta 7

Pregunta
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)).
Respuesta
  • false
  • true

Pregunta 8

Pregunta
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?
Respuesta
  • 4
  • 0
  • 5
  • 3

Pregunta 9

Pregunta
A CPU register file is a small storage device that
Respuesta
  • 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

Pregunta 10

Pregunta
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?
Respuesta
  • 3
  • 0
  • 4
  • 5
  • 2
  • 1

Pregunta 11

Pregunta
Using a base address [Eb] %edx= 0x1000, and index register [Ei] %ecx=0x02, compute the effective address for:
Respuesta
  • 0x1064
  • 0x1032
  • 0x1016
  • 0x1010

Pregunta 12

Pregunta
A memory leak is caused by a
Respuesta
  • 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

Pregunta 13

Pregunta
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.
Respuesta
  • true
  • false

Pregunta 14

Pregunta
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
Respuesta
  • false
  • true

Pregunta 15

Pregunta
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
Respuesta
  • 1 only
  • 1 and 2
  • 2
  • 1,2,3

Pregunta 16

Pregunta
In x86 assembly, the eax register can be used to hold integers but not addresses.
Respuesta
  • false
  • true

Pregunta 17

Pregunta
A program written directly in machine language (binary) would run faster than the same program written in assembly code and then assembled.
Respuesta
  • False
  • True

Pregunta 18

Pregunta
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?
Respuesta
  • none of the above
  • 3
  • 0x25
  • 0x23

Pregunta 19

Pregunta
Adding local variables is usually used to reduce what source of inefficiency?
Respuesta
  • unnecessary memory references
  • condition checking overhead
  • data dependencies
  • poor branch prediction

Pregunta 20

Pregunta
Asserting a word line and asserting (to "high" voltage) a bit line writes a 1 to a DRAM cell)
Respuesta
  • False
  • True

Pregunta 21

Pregunta
Inline substitution (also called inlining) is usually used to reduce what source of inefficiency?
Respuesta
  • procedure call overhead
  • poor branch prediction
  • poor cache locality
  • unnecessary memory references

Pregunta 22

Pregunta
Using a base address [Eb] %edx=0x1000, and index register [Ei] %ecx=0x03, compute the effective address for:
Respuesta
  • 0x1032
  • 0x1014
  • 0x1064
  • 0x1016

Pregunta 23

Pregunta
Jump in the following Y86-64 program. How many times does the addq instruction execute?
Respuesta
  • 4
  • 3
  • 5
  • 10

Pregunta 24

Pregunta
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?
Respuesta
  • 3
  • 4
  • 5
  • 6

Pregunta 25

Pregunta
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?
Respuesta
  • f32 < u32−1
  • f32 > u32 +1
  • f32 = u32
  • f32 = u32+1

Pregunta 26

Pregunta
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?
Respuesta
  • s8 = u8
  • s8 > u8+1
  • s8 = u8 - 1
  • s8 < u8-1

Pregunta 27

Pregunta
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
Respuesta
  • II and III
  • .

Pregunta 28

Pregunta
Assume x is the most positive signed integer. What is x + 1?
Respuesta
  • none of the above
  • +∞
  • -1
  • -x

Pregunta 29

Pregunta
Logical address is calculated by: segment.base + eff_addr
Respuesta
  • Selector: eff_addr
  • Segment base + lin_addr
  • Selector: offset
  • Segment base + eff_addr

Pregunta 30

Pregunta
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?
Respuesta
  • 8
  • 4
  • 6
  • 12

Pregunta 31

Pregunta
Buses are typically designed to transfer fixed-sized chunks of bytes known as
Respuesta
  • words
  • frames
  • records
  • pages

Pregunta 32

Pregunta
Capacity misses are typically discussed in connection with?
Respuesta
  • fully-associative cache
  • direct-mapped caches
  • set-associative caches
  • all of the above

Pregunta 33

Pregunta
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
Respuesta
  • BCO
  • OBC
  • BOC
  • COB

Pregunta 34

Pregunta
Compare the size of int and int*
Respuesta
  • each one of the above depends on the compute
  • int has fewer bits
  • int* has fewer bits
  • they have the same number of bit

Pregunta 35

Pregunta
Loop blocking is usually used to reduce what source of inefficiency?
Respuesta
  • poor cache locality
  • data dependencies
  • poor branch prediction
  • procedure call overhead

Pregunta 36

Pregunta
Loop unrolling is usually used to remove what source of inefficiency?
Respuesta
  • poor cache locality
  • data dependencies
  • poor branch prediction
  • procedure call overhead

Pregunta 37

Pregunta
Programs with good ______ ______, tend to access a referenced memory location multiple times in the near future.
Respuesta
  • Temporal locality
  • Spatial locality
  • Repetitive locality
  • Associative locality

Pregunta 38

Pregunta
Putting \#include "foo.h" in your C file is the equivalent of typing the contents of foo.h into your file
Respuesta
  • true
  • false

Pregunta 39

Pregunta
Consider the following code fragment
Respuesta
  • 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

Pregunta 40

Pregunta
Compared to dynamic RAM (SRAM), dynamic RAM (DRAM) is
Respuesta
  • 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

Pregunta 41

Pregunta
Compiling C into x86 assembly comprises translating each C statement into a single assembly instruction.
Respuesta
  • False
  • True

Pregunta 42

Pregunta
Conflict misses are typically discussed in connection with?
Respuesta
  • direct-mapped caches
  • set-associative caches
  • fully-associative caches
  • all of the above

Pregunta 43

Pregunta
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.
Respuesta
  • ACL
  • ALC
  • LCA
  • CAL

Pregunta 44

Pregunta
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
Respuesta
  • 50-220 cycles
  • 0-50 cycles
  • 220-1100 cycles
  • 1100-2200 cycles

Pregunta 45

Pregunta
Reassociation of operators is usually used to reduce what source of inefficiency?
Respuesta
  • data dependencies
  • condition checking overhead
  • poor branch prediction
  • poor cache locality

Pregunta 46

Pregunta
Register %edx is one of the "callee-save" registers. This means that if procedure baz calls procedure xyxxy
Respuesta
  • 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

Pregunta 47

Pregunta
Register %esi is one of the "caller-save" registers. This means that if procedure baz calls procedure xyxxy
Respuesta
  • 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

Pregunta 48

Pregunta
Dirty bits are associated with (pick the best answer)
Respuesta
  • write-back caches
  • write-through caches
  • set-associative caches
  • direct-mapped caches

Pregunta 49

Pregunta
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?
Respuesta
  • 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

Pregunta 50

Pregunta
Every procedure in an x86 assembly program must be declared using .globl
Respuesta
  • False
  • True

Pregunta 51

Pregunta
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
Respuesta
  • III only
  • II and III only
  • I, II, and III
  • II only

Pregunta 52

Pregunta
Given 6-bit numbers where 010001 + 001010 = 010110, which of the following describes the number representation used?
Respuesta
  • floating-point with 2 exponent bits
  • floating-point with 3 exponent bits
  • integer
  • floating-point with 4 exponent bits

Pregunta 53

Pregunta
Given 6-bit numbers where 010101 + 000001 = 010110, which of the following describes the number representation used?
Respuesta
  • integer
  • floating-point with 3 exponent bits
  • floating-point with 1 exponent bits
  • floating-point with 2 exponent bits

Pregunta 54

Pregunta
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?
Respuesta
  • 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

Pregunta 55

Pregunta
Return from function issues a bubble in pipeline.
Respuesta
  • true
  • false

Pregunta 56

Pregunta
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?
Respuesta
  • 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

Pregunta 57

Pregunta
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).
Respuesta
  • false
  • true

Pregunta 58

Pregunta
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?
Respuesta
  • a direct-mapped cache
  • a set-associative cache
  • a fully-associative cache
  • all of the above

Pregunta 59

Pregunta
How does knowing you have a pipelined processor change the code you write?
Respuesta
  • 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

Pregunta 60

Pregunta
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
Respuesta
  • all of the above
  • a fully-associative cache
  • a direct-mapped cache
  • a set-associative cache

Pregunta 61

Pregunta
How is "-1" (decimal) represented in an 8-bit 2's complement binary format?
Respuesta
  • 11111111
  • .

Pregunta 62

Pregunta
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?
Respuesta
  • bigger than any of the above options
  • 2 KB
  • 512 B
  • smaller than any of the above options

Pregunta 63

Pregunta
How is 46 (decimal) represented in an 8-bit 2's complement binary format?
Respuesta
  • 00101100
  • 00101110
  • 00011110
  • 01000110

Pregunta 64

Pregunta
How is -10 (decimal) represented in an 8-bit 2's complement binary format?
Respuesta
  • 11110110
  • 10001010
  • 11110101
  • 11111010

Pregunta 65

Pregunta
Which of the following move operations is the following instruction an example of movl (%edx), (%eax)?
Respuesta
  • error, can’t move memory to memory
  • memory to immediate
  • register to memory
  • memory to register

Pregunta 66

Pregunta
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?
Respuesta
  • 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

Pregunta 67

Pregunta
How many hex digits are needed to represent the decimal number 67?
Respuesta
  • 2
  • 6
  • 4
  • 7

Pregunta 68

Pregunta
How many ints fit inside x if x is declared as int *x = malloc(8); ? Word size is 4.
Respuesta
  • 2
  • 1
  • 8
  • 0

Pregunta 69

Pregunta
Which of the following move operations is the following instruction an example of movl (%edx), %eax?
Respuesta
  • error, can’t move memory to memory
  • memory to register
  • register to memory
  • memory to immediate

Pregunta 70

Pregunta
How many rules do Unix linkers use for dealing with multiply defined symbol
Respuesta
  • 3
  • 4
  • 5
  • 2

Pregunta 71

Pregunta
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?
Respuesta
  • 0x56
  • 0x00
  • 0x65
  • A known value not listed here

Pregunta 72

Pregunta
If a computer has 8GB memory, a single 1MB cache, and 4KB of registers, the total amount of data it can store is?
Respuesta
  • 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

Pregunta 73

Pregunta
Suppose the 32-bit value 0x12345678 is stored at address 0x24 of a big-endian computer. What byte is stored at address 0x23?
Respuesta
  • 0x65
  • 0x34
  • 0x43
  • A known value not listed here
  • An unknown value because the number does not overlap address 0x25

Pregunta 74

Pregunta
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
Respuesta
  • At most 96
  • Exactly 17
  • Exactly 32
  • At most 80

Pregunta 75

Pregunta
If a wire carries a logical value of 0, its voltage level will be 0 Volts.
Respuesta
  • False
  • True

Pregunta 76

Pregunta
If we fail to find data in a cache because we have never accessed the data before, we call that a
Respuesta
  • cold miss
  • capacity miss
  • conflict miss
  • forced miss

Pregunta 77

Pregunta
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
Respuesta
  • capacity miss
  • cold miss
  • conflict miss
  • forced miss

Pregunta 78

Pregunta
Suppose the 32-bit value 0x12345678 is stored at address 0x24 of a big-endian computer. What byte is stored at address 0x25?
Respuesta
  • 0x56
  • A known value not listed here
  • 0x65
  • 0x43
  • An unknown value because the number does not overlap address 0x25
  • F 0x34

Pregunta 79

Pregunta
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?
Respuesta
  • using multiple accumulators
  • adding local variables
  • function call inlining
  • none of the above would provide a speed benefit

Pregunta 80

Pregunta
The .data section of an x86 assembly program is used to specify the parameters for each procedure.
Respuesta
  • false
  • true

Pregunta 81

Pregunta
In C, a pointer variable is used for storing an address
Respuesta
  • True
  • False

Pregunta 82

Pregunta
If x is the most negative signed integer, what is -x?
Respuesta
  • the most negative signed number
  • one
  • the most positive signed number
  • negative one

Pregunta 83

Pregunta
In a DRAM, all cells have to be periodically refreshed, not just the ones that have been read.
Respuesta
  • True
  • False

Pregunta 84

Pregunta
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
Respuesta
  • Spatial locality
  • Temporal locality
  • Repetitive locality
  • Associative locality

Pregunta 85

Pregunta
The ASCII code for the character 'B' is 0x42. What is the ASCII hex code for the character 'D'?
Respuesta
  • 0x4B
  • 0x5A
  • 0x48
  • 0x44

Pregunta 86

Pregunta
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?
Respuesta
  • none of the above would provide a speed benefit
  • adding local variables
  • using multiple accumulators
  • function call inlining

Pregunta 87

Pregunta
In C, local variables allocated inside functions are allocated:
Respuesta
  • On the stack
  • In static storage
  • In virtual memory
  • In the heap

Pregunta 88

Pregunta
In C, using default floating point settings, a special value of "infinity" is computed when
Respuesta
  • A floating-point computation results in an overflow
  • Program execution is halted
  • An erroneous value is computed and execution continues
  • An exception is raised

Pregunta 89

Pregunta
The ASCII code for the character 'B' is 0x42. What is the ASCII hex code for the character ‘E’?
Respuesta
  • 0x45
  • 0x48
  • 0x56

Pregunta 90

Pregunta
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Respuesta
  • 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

Pregunta 91

Pregunta
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?
Respuesta
  • 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

Pregunta 92

Pregunta
The contents of how many program registers are modified by an assembly push operation?
Respuesta
  • 1
  • 2
  • 3 or more
  • it depends on that argument of the push

Pregunta 93

Pregunta
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.
Respuesta
  • false
  • true

Pregunta 94

Pregunta
The EBP is a callee-saved register.
Respuesta
  • true
  • false

Pregunta 95

Pregunta
The EFLAGS register contains the zero flag and the sign flag?
Respuesta
  • true
  • false

Pregunta 96

Pregunta
What is the value of the following C expression? x=0x1234 and y=0x3 ((x >> y) << y)
Respuesta
  • 0x1230
  • 0x1234
  • 0x0246
  • 0x1200

Pregunta 97

Pregunta
The hardware is aware of the program stack
Respuesta
  • true
  • false

Pregunta 98

Pregunta
The instruction addq %rax, %rbx changes what?
Respuesta
  • 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

Pregunta 99

Pregunta
What is the value of the following C expression? x=0x00 and y=0xA5 x && ~y
Respuesta
  • 0xFF50
  • 0x0000
  • 0x0001
  • 0x11A5

Pregunta 100

Pregunta
The instruction cmp eax,ebx (or cmp %ebx,%eax in AT&T syntax) computes the value of EAX - EBX.
Respuesta
  • true
  • false

Pregunta 101

Pregunta
_______ - program transformation that reduces the number of iterations for a loop by increasing the number of elements computed on each iteration
Respuesta
  • Loop unrolling
  • Memory aliasing
  • Side effect
  • Code motion

Pregunta 102

Pregunta
The valid bit is associated with
Respuesta
  • fully-associative caches
  • write-through caches
  • set-associative caches
  • direct-mapped caches

Pregunta 103

Pregunta
It is possible to explicitly specify the number of threads to be created in the team, using the _____ attribute:
Respuesta
  • pragma omp
  • parallel
  • private
  • Num_threads

Pregunta 104

Pregunta
CPU optimized for throughput
Respuesta
  • True
  • False

Pregunta 105

Pregunta
The working set of a program is formed by
Respuesta
  • 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

Pregunta 106

Pregunta
This problem occurs when a larger type is converted into a smaller type or with the signed-unsigned operations?
Respuesta
  • truncation
  • overflow

Pregunta 107

Pregunta
Using multiple accumulators is usually used to reduce what source of inefficiency?
Respuesta
  • unnecessary memory references
  • condition checking overhead
  • data dependencies
  • poor branch prediction

Pregunta 108

Pregunta
169. In C a single statement that performs the equivalent of y=x*100; but without using the multiply operator (*);
Respuesta
  • 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)

Pregunta 109

Pregunta
We can encode the C command a ? b : c, where all three variables are of type int,
Respuesta
  • ((-!!a) & b) | ((-!a) & c)
  • ((!!a) &amp; b) | ((!a) &amp; c)
  • Any of the above
  • (a &amp; b) | ((!a) &amp; c)

Pregunta 110

Pregunta
We say that pipelining generally increases latency. That statement means (select all that are part of the definition of "increases latency")
Respuesta
  • 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

Pregunta 111

Pregunta
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?
Respuesta
  • 1 & 2 only
  • 2 & 3 only
  • 1 only
  • 2

Pregunta 112

Pregunta
At which of the following times is a stack frame created?
Respuesta
  • II and III only
  • II only
  • III only
  • I and II only

Pregunta 113

Pregunta
The bitwise and operation (& in C) can be used to flip the bits of a word
Respuesta
  • true
  • false

Pregunta 114

Pregunta
Linking can be performed at
Respuesta
  • run time
  • compile time
  • all of the above
  • load time

Pregunta 115

Pregunta
Parallel processing mechanisms to achieve parallelism in uniprocessor system are:
Respuesta
  • All of the above
  • Multiple function units
  • Parallelism and pipelining within CPU
  • Multiprogramming and time sharing

Pregunta 116

Pregunta
This is an example of?
Respuesta
  • Hybrid system
  • shared memory UMA
  • Distributed memory architecture
  • Shared memory NUMA

Pregunta 117

Pregunta
This is an example of?
Respuesta
  • None
  • Loop unrolling
  • Loop fusion
  • Loop fission

Pregunta 118

Pregunta
This is an example of?
Respuesta
  • MIMD
  • MISD
  • SIMD
  • SISD

Pregunta 119

Pregunta
This is an example of?
Respuesta
  • MIMD
  • MISD
  • SIMD
  • SISD

Pregunta 120

Pregunta
This is an example of?
Respuesta
  • MIMD
  • MISD
  • SIMD
  • SISD

Pregunta 121

Pregunta
This is an example of?
Respuesta
  • MIMD
  • MISD
  • SIMD
  • SISD

Pregunta 122

Pregunta
The _______ directive causes threads encountering the barrier to wait until all the other threads in the same team have encountered the barrier.
Respuesta
  • single
  • barrier
  • nowait
  • private

Pregunta 123

Pregunta
How is 148 (decimal) represented in a 16-bit 2’s complement binary format?
Respuesta
  • 0000 0000 1101 0111
  • 0000 0000 0010 1001
  • 1111 1111 0010 1000
  • 1111 1111 0110 1100

Pregunta 124

Pregunta
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.
Respuesta
  • y = x * 5 is faster
  • y = (x<<2) + 5 is faster
  • not given
  • they take the same number of cycles

Pregunta 125

Pregunta
What is the difference between 15 and $15?
Respuesta
  • 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

Pregunta 126

Pregunta
What is the result of the following assembly code instruction?
Respuesta
  • 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

Pregunta 127

Pregunta
What is the value of the following C expression? x=0xA0 and y=0x0F ~x||~y
Respuesta
  • 0х0001
  • 0х6000
  • 0xFF50
  • 0xFFFF

Pregunta 128

Pregunta
What value ends up in EAX afer the following code is executed?
Respuesta
  • 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)

Pregunta 129

Pregunta
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.
Respuesta
  • True
  • False

Pregunta 130

Pregunta
Which of the five phases determines how many bytes long an instruction is?
Respuesta
  • Fetch
  • Decode
  • Writeback
  • Execute

Pregunta 131

Pregunta
Which of the five phases determines what the next PC is?
Respuesta
  • Fetch
  • Memory
  • Execute
  • Decode

Pregunta 132

Pregunta
Which of the five phases determines the destination register for instructions that write to registers?
Respuesta
  • Decode
  • Writeback
  • Fetch
  • Execute

Pregunta 133

Pregunta
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++]);
Respuesta
  • I, II, and III
  • II only
  • I and II only
  • I only

Pregunta 134

Pregunta
Which of the following is true?
Respuesta
  • 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

Pregunta 135

Pregunta
Which of the following manages the transfer of data between the cache and main memory
Respuesta
  • Operating system
  • Compiler
  • Hardware
  • Registry

Pregunta 136

Pregunta
Which of the following manages the transfer of data between the CPU registers and the cache
Respuesta
  • Operating system
  • Compiler
  • Hardware
  • Registry

Pregunta 137

Pregunta
Which of the following registers is the lower order 16 bit register of register %ecx?
Respuesta
  • %cx
  • %cl
  • %ch
  • %cy

Pregunta 138

Pregunta
Which of the following statements about alignment within C struct's is true?
Respuesta
  • 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

Pregunta 139

Pregunta
Which of the following statements about floating-point numbers in C is true?
Respuesta
  • II only
  • III only
  • I
  • I and II

Pregunta 140

Pregunta
Which one of the following IA32 registers is typically used for stack management?
Respuesta
  • %esp
  • %eax
  • %ebx
  • %edi

Pregunta 141

Pregunta
Which one of the following optimizations does not provide any speed benefit for a non-pipelined processor, such as SEQ?
Respuesta
  • Storing reused computed values in variables instead of recomputing them
  • Invocation inlining
  • Using more efficient algorithms
  • Reassociation

Pregunta 142

Pregunta
Which of the following levels of a typical memory hierarchy transfers data in chunks of smallest size?
Respuesta
  • Main memory < ---> disk
  • Cache < ---> main memory
  • They all transfer one byte at a time
  • CPU registers < ---> cache

Pregunta 143

Pregunta
In C, a pointer variable is used for storing an address
Respuesta
  • True
  • False

Pregunta 144

Pregunta
If we cut power for one millisecond, which of the following is true?
Respuesta
  • 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

Pregunta 145

Pregunta
If we cut power for one minute, which of the following is true?
Respuesta
  • 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

Pregunta 146

Pregunta
Select the most correct statement from the following as applied over the last two decades:
Respuesta
  • 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

Pregunta 147

Pregunta
Which one of the following optimizations does not provide any speed benefit for a non-pipelined processor, such as SEQ?
Respuesta
  • Using more efficient algorithms
  • Invocation inlining
  • Reassociation
  • Storing reused, computed values in variables instead of recomputing them

Pregunta 148

Pregunta
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?
Respuesta
  • 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

Pregunta 149

Pregunta
Consider the following code. This code would most likely benefit from which of the following optimization strategies
Respuesta
  • Using multiple accumulators
  • Improving cache locality
  • Loop unrolling
  • Adding local variables

Pregunta 150

Pregunta
What does the following C code print?
Respuesta
  • P = 103, c = 101
  • P = 104, c = 101
  • P = 105, c = 103
  • P = 104, c = 102

Pregunta 151

Pregunta
The bitwise and operation (& in C) can be used to flip the bits of a word
Respuesta
  • True
  • False

Pregunta 152

Pregunta
The bitwise xor operation (^ in C) can be used to flip the bits of a word
Respuesta
  • True
  • False

Pregunta 153

Pregunta
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?
Respuesta
  • 0x02345
  • 0x22244
  • 0x12040
  • 0x12354

Pregunta 154

Pregunta
In C, on a 34-bit x86 machine, the expression (1 << 31) results in a negative integer
Respuesta
  • True
  • False

Pregunta 155

Pregunta
Consider the following code. Which of the following changes would make the largest positive impact on its cache locality?
Respuesta
  • 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*

Pregunta 156

Pregunta
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?
Respuesta
  • 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 &&

Pregunta 157

Pregunta
Consider the following two versions of a C function: (Assume len is larger than 10)
Respuesta
  • sum1
  • None of them
  • sum2
  • Both of them

Pregunta 158

Pregunta
Which of the following is necessary true regarding the following code fragment?
Respuesta
  • 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

Pregunta 159

Pregunta
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?
Respuesta
  • ~(a = b)
  • a = b
  • ~ (a ^ b)
  • a ^ b

Pregunta 160

Pregunta
The unary & operator returns (in C language)
Respuesta
  • 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

Pregunta 161

Pregunta
In C a single statement that performs the equivalent of y = x *100, but without using the multiply operator (*)
Respuesta
  • 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)

Pregunta 162

Pregunta
Adding local variable is usually used to reduce what source inefficiency?
Respuesta
  • Condition checking overhead
  • Poor branch prediction
  • Unnecessary memory references
  • Data dependencies

Pregunta 163

Pregunta
If, in C, an array is declared by “int a[10];”, then accessing a[11] during execution will generate an error message.
Respuesta
  • True
  • False

Pregunta 164

Pregunta
In C, if x is an integer variable, the expression “x << 3” computes x * 8 but does not change the value of x.
Respuesta
  • True
  • False

Pregunta 165

Pregunta
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Respuesta
  • 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

Pregunta 166

Pregunta
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Respuesta
  • 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

Pregunta 167

Pregunta
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
Respuesta
  • True
  • False

Pregunta 168

Pregunta
How is 148 (decimal) represented in a 16-bit 2’s complement binary format?
Respuesta
  • 0000 0000 1101 0111
  • 0000 0000 0010 1001
  • 1111 1111 0010 1000
  • 1111 1111 0110 1100

Pregunta 169

Pregunta
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Respuesta
  • for(j=0;j...
  • for(i=0;i...
  • two or more of the above are equivalently the fastest
  • for(k=0;k<n;k+=16) for(l=0;l<n;l+=16)...

Pregunta 170

Pregunta
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.
Respuesta
  • y = x * 5 is faster
  • they take the same number of cycles
  • not given
  • y = (x<<2) + 5 is faster

Pregunta 171

Pregunta
The program counter contains:
Respuesta
  • 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

Pregunta 172

Pregunta
A memory leak is caused by a:
Respuesta
  • 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

Pregunta 173

Pregunta
Registers and cache memory are the same thing
Respuesta
  • False
  • True

Pregunta 174

Pregunta
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?
Respuesta
  • 32
  • 8
  • 16
  • 4

Pregunta 175

Pregunta
In C, local variables allocated inside functions are allocated:
Respuesta
  • On the stack
  • In the heap
  • In virtual memory
  • In static storage

Pregunta 176

Pregunta
What is the value of the following C expression? x=0xA0 and y=0x0F ~x || ~y
Respuesta
  • 0x0000
  • 0xFF50
  • 0xFFFF
  • 0x0001

Pregunta 177

Pregunta
What is an example of?
Respuesta
  • Loop unrolling
  • Loop fission
  • none
  • Loop fusion

Pregunta 178

Pregunta
How is 215 (decimal) represented in a 16-bit 2's complement binary format?
Respuesta
  • 1111 1111 0010 1001
  • 0000 0000 1101 0111
  • 0000 0000 0010 1001
  • 1111 1111 0010 1000

Pregunta 179

Pregunta
This code indicates that Work2 and Work3 must be run in _______ :
Respuesta
  • none
  • parallel
  • sequence
  • both

Pregunta 180

Pregunta
____ 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.
Respuesta
  • Code motion
  • Side effect
  • Loop unrolling
  • Memory aliasing

Pregunta 181

Pregunta
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.
Respuesta
  • True
  • False

Pregunta 182

Pregunta
What is the value of the following C expression? x = 0x128 and y = 0x2 ~x << y (in hex)
Respuesta
  • 0x000004A0
  • 0x000FFB5C
  • 0xFFFFFB5C
  • 0x00FF04A0

Pregunta 183

Pregunta
In C, using default floating point settings, a special value of "infinity" is computed when:
Respuesta
  • A floating-point computation results in an overflow
  • Program execution is halted
  • An exception is raised
  • An erroneous value is computed and execution continues

Pregunta 184

Pregunta
GPU optimized for latency.
Respuesta
  • true
  • false

Pregunta 185

Pregunta
If you don’t explicitly specify the number of threads (OpenMP) how many thread will be executed?
Respuesta
  • 1
  • Depends on the number of cores on computer
  • 2
  • 4

Pregunta 186

Pregunta
CPU optimized for latency
Respuesta
  • true
  • false

Pregunta 187

Pregunta
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:
Respuesta
  • Static linker
  • Dynamic linker
  • Both
  • none

Pregunta 188

Pregunta
If we find the data we want in a cache, we call that a
Respuesta
  • Cache find
  • Cache hit
  • Cache miss
  • Cache success

Pregunta 189

Pregunta
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?
Respuesta
  • parallel
  • master
  • section
  • schedule

Pregunta 190

Pregunta
Pick a value for A and for B which will cause the two procedures below to return different results.
Respuesta
  • a=7; b=1;
  • a=1; b=2;
  • a=1; b=5;
  • a=1; b=1;

Pregunta 191

Pregunta
Pick a value for A and for B which will cause the two procedures below to return the same results.
Respuesta
  • ОДИНАКОВЫЕ ВОЗВРАЩАЮТ: (7,1) (1,5) (1,1)
  • нет других вариантов

Pregunta 192

Pregunta
A is the 4-bit value 0011 and B is the 4-bit value 0110. What is A^B?
Respuesta
  • 0011
  • 1110
  • 0111
  • 0101

Pregunta 193

Pregunta
Consider the following code. This code would most likely benefit from which of the following optimization strategies.
Respuesta
  • improving locality
  • loop unrolling
  • using multiple
  • adding local variables

Pregunta 194

Pregunta
Conflict misses are typically discussed in connection with?
Respuesta
  • all of the above
  • fully-associative caches
  • set-associative caches
  • direct-mapped caches

Pregunta 195

Pregunta
What is -5 as a six bit two’s complement number? Answer in binary
Respuesta
  • 101111
  • 111011
  • 000001
  • 011011

Pregunta 196

Pregunta
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?
Respuesta
  • static
  • runtime
  • dynamic
  • auto

Pregunta 197

Pregunta
In general, which of the following is slowest?
Respuesta
  • moving from one register to another
  • doing division
  • accessing memory
  • comparing two numbers to decide where to jump

Pregunta 198

Pregunta
How is 28 (decimal) represented in an 8-bit 2’s complement binary format?
Respuesta
  • 0001 1100
  • 1110 0100
  • 1100 1011
  • 1110 0011

Pregunta 199

Pregunta
The ASCII code for the character ‘b’ is 98. How can the character ‘b’ be represented in binary using ASCII codes?
Respuesta
  • 1011 1111
  • 1010 1111
  • 0110 0010
  • 1000 0001

Pregunta 200

Pregunta
This code indicates that any of the tasks Work1, Work2 + Work3 and Work4 may run in _____________:
Respuesta
  • parallel
  • sequence
  • both
  • none
Mostrar resumen completo Ocultar resumen completo

Similar

La Escala Musical
mariajesus camino
TARJETAS ESTUDIO CUERPOS GEOMÉTRICOS
Ruth Pérez Sánchez
Romanticismo literario del S. XIX
maya velasquez
Sumas y restas MATEMATICAS (Preguntas fáciles)
RosyFlower Suchard
Fichas Verbos inglés - español (131)
JOWANI BELLO MELO
Mapa mental dibujo en ingenieria
richard varón
Mapa Mental del Modelo OSI
Berenice Ríos
Plantilla para clasificar los hallazgos en la viñeta clínica.
luis.pd.18
NUMEROS NATURALES
PROYECTO APRENDER
Foro 4_MAD
Itziar Arnelas