A Level Computer Science OCR Practice Exam 2025 – Complete Study Resource

Question: 1 / 400

Which type of shift operation retains the sign of a number?

Logical shift

Cyclic shift

Arithmetic shift

The correct choice is the arithmetic shift operation. In computing, an arithmetic shift involves shifting the bits of a binary number to the left or right while maintaining the sign bit, which is the most significant bit (MSB) that indicates the number's sign in two's complement representation.

For a right arithmetic shift, the number is divided by two for each shift, and the sign bit is preserved by replicating it into the new positions created on the left. This means that if the number is negative, the sign remains negative after the operation. Conversely, the left arithmetic shift operates the same way as a logical shift, effectively multiplying the number by two.

In contrast, a logical shift simply moves bits without any attention to the sign. A cyclic shift rotates the bits rather than moving them into new positions, while a direct shift isn’t a standard term with a clear definitive operation in shifting practices. Overall, the arithmetic shift is specifically designed to handle signed numbers correctly, making it the right choice in this context.

Get further explanation with Examzify DeepDiveBeta

Direct shift

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy