SDP10 Final - Part I

Description

SDP10 Quiz on SDP10 Final - Part I, created by Csse 1502 on 12/05/2018.
Csse 1502
Quiz by Csse 1502, updated more than 1 year ago
Csse 1502
Created by Csse 1502 almost 6 years ago
376
3

Resource summary

Question 1

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

Question 2

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

Question 3

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

Question 4

Question
A branch instruction
Answer
  • 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

Question 5

Question
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
Answer
  • True
  • False

Question 6

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

Question 7

Question
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)).
Answer
  • false
  • true

Question 8

Question
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?
Answer
  • 4
  • 0
  • 5
  • 3

Question 9

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

Question 10

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

Question 11

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

Question 12

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

Question 13

Question
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.
Answer
  • true
  • false

Question 14

Question
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
Answer
  • false
  • true

Question 15

Question
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
Answer
  • 1 only
  • 1 and 2
  • 2
  • 1,2,3

Question 16

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

Question 17

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

Question 18

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

Question 19

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

Question 20

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

Question 21

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

Question 22

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

Question 23

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

Question 24

Question
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?
Answer
  • 3
  • 4
  • 5
  • 6

Question 25

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

Question 26

Question
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?
Answer
  • s8 = u8
  • s8 > u8+1
  • s8 = u8 - 1
  • s8 < u8-1

Question 27

Question
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
Answer
  • II and III
  • .

Question 28

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

Question 29

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

Question 30

Question
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?
Answer
  • 8
  • 4
  • 6
  • 12

Question 31

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

Question 32

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

Question 33

Question
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
Answer
  • BCO
  • OBC
  • BOC
  • COB

Question 34

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

Question 35

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

Question 36

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

Question 37

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

Question 38

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

Question 39

Question
Consider the following code fragment
Answer
  • 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

Question 40

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

Question 41

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

Question 42

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

Question 43

Question
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.
Answer
  • ACL
  • ALC
  • LCA
  • CAL

Question 44

Question
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
Answer
  • 50-220 cycles
  • 0-50 cycles
  • 220-1100 cycles
  • 1100-2200 cycles

Question 45

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

Question 46

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

Question 47

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

Question 48

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

Question 49

Question
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?
Answer
  • 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

Question 50

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

Question 51

Question
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
Answer
  • III only
  • II and III only
  • I, II, and III
  • II only

Question 52

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

Question 53

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

Question 54

Question
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?
Answer
  • 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

Question 55

Question
Return from function issues a bubble in pipeline.
Answer
  • true
  • false

Question 56

Question
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?
Answer
  • 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

Question 57

Question
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).
Answer
  • false
  • true

Question 58

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

Question 59

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

Question 60

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

Question 61

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

Question 62

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

Question 63

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

Question 64

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

Question 65

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

Question 66

Question
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?
Answer
  • 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

Question 67

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

Question 68

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

Question 69

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

Question 70

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

Question 71

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

Question 72

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

Question 73

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

Question 74

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

Question 75

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

Question 76

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

Question 77

Question
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
Answer
  • capacity miss
  • cold miss
  • conflict miss
  • forced miss

Question 78

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

Question 79

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

Question 80

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

Question 81

Question
In C, a pointer variable is used for storing an address
Answer
  • True
  • False

Question 82

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

Question 83

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

Question 84

Question
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
Answer
  • Spatial locality
  • Temporal locality
  • Repetitive locality
  • Associative locality

Question 85

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

Question 86

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

Question 87

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

Question 88

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

Question 89

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

Question 90

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

Question 91

Question
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?
Answer
  • 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

Question 92

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

Question 93

Question
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.
Answer
  • false
  • true

Question 94

Question
The EBP is a callee-saved register.
Answer
  • true
  • false

Question 95

Question
The EFLAGS register contains the zero flag and the sign flag?
Answer
  • true
  • false

Question 96

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

Question 97

Question
The hardware is aware of the program stack
Answer
  • true
  • false

Question 98

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

Question 99

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

Question 100

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

Question 101

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

Question 102

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

Question 103

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

Question 104

Question
CPU optimized for throughput
Answer
  • True
  • False

Question 105

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

Question 106

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

Question 107

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

Question 108

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

Question 109

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

Question 110

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

Question 111

Question
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?
Answer
  • 1 & 2 only
  • 2 & 3 only
  • 1 only
  • 2

Question 112

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

Question 113

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

Question 114

Question
Linking can be performed at
Answer
  • run time
  • compile time
  • all of the above
  • load time

Question 115

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

Question 116

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

Question 117

Question
This is an example of?
Answer
  • None
  • Loop unrolling
  • Loop fusion
  • Loop fission

Question 118

Question
This is an example of?
Answer
  • MIMD
  • MISD
  • SIMD
  • SISD

Question 119

Question
This is an example of?
Answer
  • MIMD
  • MISD
  • SIMD
  • SISD

Question 120

Question
This is an example of?
Answer
  • MIMD
  • MISD
  • SIMD
  • SISD

Question 121

Question
This is an example of?
Answer
  • MIMD
  • MISD
  • SIMD
  • SISD

Question 122

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

Question 123

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

Question 124

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

Question 125

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

Question 126

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

Question 127

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

Question 128

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

Question 129

Question
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.
Answer
  • True
  • False

Question 130

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

Question 131

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

Question 132

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

Question 133

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

Question 134

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

Question 135

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

Question 136

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

Question 137

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

Question 138

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

Question 139

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

Question 140

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

Question 141

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

Question 142

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

Question 143

Question
In C, a pointer variable is used for storing an address
Answer
  • True
  • False

Question 144

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

Question 145

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

Question 146

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

Question 147

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

Question 148

Question
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?
Answer
  • 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

Question 149

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

Question 150

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

Question 151

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

Question 152

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

Question 153

Question
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?
Answer
  • 0x02345
  • 0x22244
  • 0x12040
  • 0x12354

Question 154

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

Question 155

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

Question 156

Question
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?
Answer
  • 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 &&

Question 157

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

Question 158

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

Question 159

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

Question 160

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

Question 161

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

Question 162

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

Question 163

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

Question 164

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

Question 165

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

Question 166

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

Question 167

Question
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
Answer
  • True
  • False

Question 168

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

Question 169

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

Question 170

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

Question 171

Question
The program counter contains:
Answer
  • 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

Question 172

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

Question 173

Question
Registers and cache memory are the same thing
Answer
  • False
  • True

Question 174

Question
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?
Answer
  • 32
  • 8
  • 16
  • 4

Question 175

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

Question 176

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

Question 177

Question
What is an example of?
Answer
  • Loop unrolling
  • Loop fission
  • none
  • Loop fusion

Question 178

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

Question 179

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

Question 180

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

Question 181

Question
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.
Answer
  • True
  • False

Question 182

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

Question 183

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

Question 184

Question
GPU optimized for latency.
Answer
  • true
  • false

Question 185

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

Question 186

Question
CPU optimized for latency
Answer
  • true
  • false

Question 187

Question
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:
Answer
  • Static linker
  • Dynamic linker
  • Both
  • none

Question 188

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

Question 189

Question
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?
Answer
  • parallel
  • master
  • section
  • schedule

Question 190

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

Question 191

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

Question 192

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

Question 193

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

Question 194

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

Question 195

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

Question 196

Question
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?
Answer
  • static
  • runtime
  • dynamic
  • auto

Question 197

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

Question 198

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

Question 199

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

Question 200

Question
This code indicates that any of the tasks Work1, Work2 + Work3 and Work4 may run in _____________:
Answer
  • parallel
  • sequence
  • both
  • none
Show full summary Hide full summary

Similar

Blood Brothers (Characters)
nuhaheza
Girls' and Boys' Education - A Mind Map
Cecelia Price
English Grammatical Terminology
Fionnghuala Malone
The Brain and the Nervous System
feelingthepayne
Unit 1: Media production & regulation
c.gale
NeuroAnatomy
أطباء 2020
Types and Components of Computer Systems
Jess Peason
Nervous System
4everlakena
GCSE REVISION TIMETABLE
rebekahanne11
2.1.4 Data Representation
Lavington ICT
Why did the Cold War begin?
n.mcdonald