Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 23

The file size of an uncompressed image (in bits) is calculated using the following formula:

size (in bits)=width×height×color depth \text{size (in bits)} = \text{width} \times \text{height} \times \text{color depth} size (in bits)=width×height×color depth

To calculate the size in bytes, the number of bits is divided by 8.

The algorithm below is designed to output the size in bytes of an image with a width of 1920 pixels, a height of 1080 pixels, and a color depth of 24 bits.

A subroutine called calcImgSizeBytes has been developed as part of the algorithm.

Complete the program by identifying the correct term from the pool of options to fill each of the six empty gaps.

Options Pool

  • width
  • height
  • depth
  • sizeBits
  • sizeBytes
  • sizeBits / 8
  • sizeBits * 8
  • sizeBits MOD 8
  • RETURN
  • SUBROUTINE
  • OUTPUT
  • calcImgSizeBytes
  • calcImgSizeBits
  • 1920

Subroutine Pseudo-code

SUBROUTINE calcImgSizeBytes([Gap 1], height, [Gap 2])
    [Gap 3] ← width * height * depth
    sizeBytes ← [Gap 4]
    [Gap 5] sizeBytes
ENDSUBROUTINE

OUTPUT [Gap 6](1920, 1080, 24)
[6]
Markscheme

Structured programming and subroutines (procedures and functions) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured programming and subroutines (procedures and functions)

131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.

Question bank