2012 Old Spec

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

Question 6

The algorithm, represented as a flowchart in Figure 4, and the variable table, Table 3, describe the converting of a 4-bit binary value into denary.


Figure 4

alt


Table 3

Identifier Data Type Purpose
Column Integer Stores the place value (column heading)
Answer Integer Stores the denary value equivalent to the bit pattern entered by the user
Bit Integer Stores a 0 or 1 entered by the user



What you need to do

  1. Write a program for the above algorithm.
  2. Test the program by showing the result of entering the values 1, 1, 0, 1 (in that order).