What is the difference between logical and bitwise operators. (for example && and &)
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.
это открытый вопрос, выше два примера как можно ответить (этот вариант отмечен как правильный)
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?
None of the above
Choose the correct compilation of rax = (rbx ? rcx : rdx)?
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
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;
8 plus the contents of location 0x10000
Given unsigned int variables a and b, if a + b == a ^ b is true, then which of the following must also be true?
a + b == a * b
a + b == a | b
a + b == a - b
a + b == a & b
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?
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?
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?
5, 6, or 7
between 9 and 15
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?
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
None of the above can be represented in this format
None of the above because you can’t have a 5-bit IEEE-style floating point number with 3 exponent bits
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
rmmovl %eax, $1234 ; jmp $1234
pushl %eax ; ret
rrmovl %eax, %PC
All of the above work
None of the above work
Given int variables a and b, which of the following implements if (!a) b == 0;?