Question 1
Question
Given the declaration int A[10][20]; in C, the following assembly code implements A[i][j] = 1; (assuming A, i, and j are all global variables).
Question 2
Question
The code (a && b) || (!a && !b) implements -
Answer
-
Adder
-
Equality
-
MUX
-
Set membership
Question 3
Question
What is the difference between logical and bitwise operators. (for example && and &)
Answer
-
The logical and operator ‘&&’ expects its operands to be boolean expressions (either 1 or 0) and returns a boolean value.
The bitwise and operator ‘&’ works on Integral (short, int, unsigned, char, bool, unsigned char, long) values and return Integral value.
If an integral value is used as an operand for ‘&&’ which is supposed to work on boolean values, following rule is used in C.
…..A zero is considered as false and non-zero is considered as true.
For example in the following program x and y are considered as 1.
The ‘&&’ operator doesn’t evaluate second operand if first operand becomes false. Similarly ‘||’ doesn’t evaluate second operand when first operand becomes true. The bitwise ‘&’ and ‘|’ operators always evaluate their operands.
-
&& (logical and operator) - The left and right operands are boolean expressions. If both the operands are non-zero, then the condition becomes true.
>
& (bitwise and operator) - The left and right operands are integral types. Binary AND Operator copies a bit to the result if it exists in both operands.
-
это открытый вопрос, выше два примера как можно ответить (этот вариант отмечен как правильный)
Question 4
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 5
Question
Choose the correct compilation of rax = (rbx ? rcx : rdx)?
Question 6
Question
This is an example of?
Answer
-
Serial processing
-
Linear processing
-
Parallel processing
-
none of the above
Question 7
Question
This is an example of?
Answer
-
Serial processing
-
Linear processing
-
Parallel processing
-
none of the above
Question 8
Question
Object files are:
Answer
-
не вариантов
-
не правильный вариант
Question 9
Question
Thread (as with OpenMP) Which of the following is true?
Answer
-
нет вариантов
-
не правильный ответ
Question 10
Question
______construct encloses code, forming a parallel region.
Answer
-
parallel
-
не правильный вариант
Question 11
Question
____ is the default schedule type. Upon entering the loop, each thread independently decides which chunk of the loop they will process
Answer
-
static
-
не правильный вариант
Question 12
Question
OpenMP assigns one iteration to each thread. When the thread finishes, it will be assigned the next iteration that hasn’t been executed yet.
Question 13
Question
The _____ directive causes threads encountering the barrier to wait until all the other threads in the same team have encountered the barrier.
Answer
-
barrier
-
не правильный вариант
Question 14
Question
What is the value of the following C expression? x = 0xBC and y = 0x35 (x & !y)
Answer
-
0x0000
-
0x0001
-
0xFFF
-
0x1200
Question 15
Question
We say that pipelining generally increases throughput. That statement means (select all that are part of the definition of “increases throughput”):
Answer
-
A entire programs take more time to complete
-
B entire programs take less time to complete
-
C each instruction takes less time to complete
-
D each instruction takes more time to complete
Question 16
Question
Consider the following code. Which of the following memory errors does it have? Select all that apply.
Answer
-
confusing pointer and value sizes
-
reading uninitialized memory
-
off-by-one memory access error
-
dereferencing a value as if it were a pointer
-
returning references to nonexistent values
Question 17
Question
What kind of locality does the following code benefit from? Assume that n and m are very large numbers.
Answer
-
spatial locality
-
temporal locality
-
both of the above
-
none of the above
Question 18
Question
Given that a and b are each either 0 or 1, which one of the following is not always true?
Question 19
Question
What is a “caller-save” register?
Answer
-
A special register that saves who called the procedure
-
A program register that the called procedure may not modify
-
A program register that the called procedure may modify
-
none of the above
Question 20
Question
A fully-associative cache is like a
Answer
-
direct-mapped cache with only one set
-
direct-mapped cache with only one line per set
-
set-associative cache with only one line per set
-
set-associative cache with only one set
Question 21
Question
Consider the following code. Which of the following changes would make the largest positive impact on its cache locality?
Answer
-
Block the accesses by nesting three or four for loops instead of just two
-
Change int** to int*
-
Change the for-j loop to count up from 0, not down from m-1
-
Put the for-i loop inside of the for-j loop instead of the other way around
Question 22
Question
Consider the following code. Which of the following changes would make the largest positive impact on its cache locality?
Answer
-
Change int** to int*
-
Put the for-i loop inside of the for-j loop instead of the other way around
-
Change the for-j loop to count up from 0, not down from m-1
-
Block the accesses by nesting three or four for loops instead of just two
Question 23
Question
In C, assuming that an int takes 4 bytes, if array a is declared as follows and a has the value 0x10000, what is the value of the expression a + 2? int a[12];
Question 24
Question
Given unsigned int variables a and b, if a + b == a ^ b is true, then which of the following must also be true?
Answer
-
a + b == a * b
-
a + b == a | b
-
a + b == a - b
-
a + b == a & b
Question 25
Question
The bias of any IEEE-style floating point number is 2e−1 − 1, where e is the number of exponent bits. Suppose 010010 is a six-bit IEEE-style floating point number that represents the decimal value 2.5. How many exponent bits does the number have?
Question 26
Question
Consider a six-bit IEEE-style floating-point number with 1 sign, 2 exponent, and 3 fraction bits. Assume the bias is 1. Answers are written in binary. What is the largest denormalized value?
Answer
-
0.0111
-
0.01111
-
0.111
-
1111
Question 27
Question
Consider a six-bit IEEE-style floating-point number with 1 sign, 2 exponent, and 3 fraction bits. Assume the bias is 1. Answers are written in binary. How many of the 26 bit patters in this format are NaNs?
Answer
-
1
-
5, 6, or 7
-
8
-
between 9 and 15
-
32
Question 28
Question
Consider a six-bit IEEE-style floating-point number with 1 sign, 2 exponent, and 3 fraction bits. Assume the bias is 1. Answers are written in binary.EEE
What is the smallest non-negative normalized value?
Question 29
Question
Consider a 5-bit IEEE-style floating point number with 3 exponent bits (bias 3). Which of the following can be expressed in this format? Options are written in binary
Question 30
Question
Y86 does not have an instruction for jumping to an address stored in a register location; instead the conceptual action jmp %eax can be implemented by
Question 31
Question
Given int variables a and b, which of the following implements if (!a) b == 0;?
Answer
-
b &= !!a;
-
b &= !-a;
-
b &= !a;
-
b &= a;
-
b &= -a;
-
b &= -!a;
-
none of the above