Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

Past Papers CS101 โ€“ VU Computer Science 2’s Complement Operations Solved Answers

Machine Instructions, Bit Manipulation, and 2’s Complement Operations

Q#1: How is a machine instruction fetched from main memory to the CPU, and what determines the order of execution for instructions?
Answer:

  • Machine instructions are fetched from main memory to the CPU via a bus.
  • The program counter (PC) determines the order of execution by holding the address of the next instruction.
  • Instructions execute sequentially as stored in memory unless altered by a JUMP instruction.

Q#2: In the context of data manipulation, how is the AND operation typically used, and what is the significance of masking?
Answer:

  • The AND operation is used to set certain bits to 0 while leaving others unchanged; this is called masking.
  • One operand, called a mask, controls which bits of the other operand affect the result.
  • Example: ANDing a byte with 00100000 will produce all 0s if the third bit from the high-order end is 0, allowing selective bit manipulation.

Q#3: What is the purpose of rotation and shift operations, and how are they classified?
Answer:

  • Rotation and shift operations move bits within a register and help solve alignment problems.
  • Classified by direction and type:
    • Circular shifts: Bits wrap around to the opposite end.
    • Logical shifts: Bits that fall off are discarded, and empty positions are filled with 0.
  • Logical shifts can also perform multiplication or division by powers of two.

Q#4: How can subtraction be simulated using addition in 2’s complement notation, and what are the key considerations when handling numbers in 2’s complement notation?
Answer:

  • Subtraction is simulated by adding the first number to the 2โ€™s complement (negation) of the second number.
  • Key considerations:
    • Addition is straightforward in 2’s complement.
    • Sign extension must be handled to preserve the sign bit.
    • For floating-point numbers, arithmetic must account for the mantissa, exponent, and sign bit.
Contents Copyrights Reserved By T4Tutorials