Data representation · A level · AQA 7517 4.5.6.1, Eduqas A500QS 2.3 · about 30 min
Analogue and digital signals, ADCs and DACs, bitmapped and vector graphics and when to use each.
[1 mark]How many bytes does an 800 x 600 bitmap with a colour depth of 24 bits take, ignoring metadata?
[1 mark]How many different levels can a 10-bit ADC output?
[1 mark]A company logo must look sharp on a business card and on a large banner. Which is better, and why?
[1 mark]Which of these would a vector graphic store for a circle?
Tick every answer that is true.
[1 mark]Where would a DAC be used?
[1 mark]The byte 01000001 is stored in memory. What does it represent?
shapes is a vector drawing of two objects. A rectangle has x and y (its top-left corner) and w and h; a circle has a centre cx, cy and a radius r. All are in pixels. Rasterise it onto a bitmap WIDTH 32 pixels wide and HEIGHT 16 pixels tall, 1 bit per pixel.
1. The pixel in column col (0 to 31) and row row (0 to 15) has its centre at (col + 0.5, row + 0.5). It is on when that centre is inside any shape: for a rectangle, x <= px < x + w and y <= py < y + h; for a circle, the squared distance from the centre is no more than r squared.
2. Print the 16 rows, top row first, each as 32 characters: # for on and . for off.
3. Then print, calculating each number from WIDTH and HEIGHT: 1-bit bitmap: <n> bits, 24-bit bitmap: <n> bits, and 1-bit bitmap at 4 times the size: <n> bits (4 times the width and 4 times the height, still 1 bit per pixel).
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
WIDTH = 32
HEIGHT = 16
shapes = [
{"type": "rect", "x": 2, "y": 2, "w": 10, "h": 6},
{"type": "circle", "cx": 22, "cy": 8, "r": 5},
]
def inside(shape, px, py):
return FalsePlan your program here, then type it in and press Run.
line shape with two end points and a thickness.