Exam preparation · GCSE · OCR J277 1.2.4, AQA 8525 3.3.2, Edexcel 1CP2 2.1.3 · about 15 min
Conversions, units and file sizes at speed, with the checks that catch mistakes.
[1 mark]Convert 200 to 8-bit binary.
[1 mark]Convert 10110110 to hexadecimal.
[1 mark]How many different values can 8 bits hold?
[1 mark]A 64 by 48 image at 8 bits a pixel. How many bits?
[1 mark]What is the ASCII code for capital A?
[1 mark]Your binary answer has 7 digits. What should you check?
For each number in numbers, print <denary> = <8-bit binary> = <2-digit hex>, working each one out yourself rather than using bin(), hex() or format(). Then for the image in image (width, height, bits per pixel), print image: <n> bits and image: <n> kB, and for sound (rate, seconds, bit depth) print sound: <n> bits and sound: <n> kB. Give the kB to 1 decimal place.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() numbers = [5, 77, 200, 255] image = (64, 48, 8) # width, height, bits per pixel sound = (8000, 5, 8) # samples a second, seconds, bits a sample
Plan your program here, then type it in and press Run.