OA. free
Free
Nvidia Core Computer Science Core Computer Science Medium

10.

Nvidia technical mcq question, verified with a worked answer. Free to practise - no sign-up.

10. Calculator

Using 8-bit integers, what is the final result of the following operations: NOT((0x8 OR 128) + 1) XOR 15

Note:

  • AND = "logical and" operator
  • OR = "logical or" operator
  • XOR = "logical exclusive or" operator
  • NOT = "logical not" operator
  • 0x = hexadecimal numbers
  • + = Arithmetic addition operator

Pick ONE option

Choose one option.
Show answer & explanation
Answer: A. 0x79

The problem requires evaluating a sequence of bitwise and arithmetic operations on 8-bit integers. The key is to correctly handle the 8-bit overflow during addition and the bitwise NOT (one's complement) operation.

Step-by-step Derivation:
Step-by-step calculation:

  1. 0x8 OR 128:

    • 0x8 in binary (8-bit): 0000 1000
    • 128 in binary (8-bit): 1000 0000
    • 0000 1000 OR 1000 0000 = 1000 1000 (which is 136 in decimal).
  2. (0x8 OR 128) + 1:

    • 1000 1000 + 0000 0001 = 1000 1001 (which is 137 in decimal).
  3. NOT(1000 1001):

    • Bitwise NOT flips all bits: NOT(1000 1001) = 0111 0110.
    • 0111 0110 in hex is 0x76 (Decimal 118).
  4. 0x76 XOR 15:

    • 0x76 in binary: 0111 0110
    • 15 in binary: 0000 1111
    • XOR operation:
      0111 0110
      0000 1111

      0111 1001
  5. Convert result to Hex:

    • 0111 1001 binary = 0x79 hex.

Final Result: 0x79