Six original Cambridge-style questions on data types and record structures, with mark points.
TYPE Name, a DECLARE line per field, ENDTYPE; then DECLARE a variable of that type.Variable.Field; in an array of records, Array[Index].Field.Explain what is meant by a record structure.
A cinema stores, for each film showing: the film title, the screen number (1 to 12), the ticket price, the date of the showing, whether it is 3D, and an age rating of one character. State the most appropriate data type for four of these items.
Write pseudocode to define a record type CarRecord with fields for a registration number, the make, the year of manufacture, the price and whether the car has been sold. Then declare a variable NewCar of this type.
TYPE CarRecord ... ENDTYPE enclosing the fields. ✓DECLARE Registration : STRING and DECLARE Make : STRING. ✓DECLARE Year : INTEGER, DECLARE Price : REAL, DECLARE Sold : BOOLEAN. ✓DECLARE NewCar : CarRecord after the type definition. ✓Using CarRecord and NewCar, write pseudocode statements to store a car with registration AB12 CDE, make Toyota, year 2021, price 15995.00, not yet sold, and then output its make and price.
NewCar.Registration ← "AB12 CDE" and NewCar.Make ← "Toyota". ✓NewCar.Year ← 2021, NewCar.Price ← 15995.00, NewCar.Sold ← FALSE. ✓OUTPUT NewCar.Make, " ", NewCar.Price. ✓Stock is an ARRAY[1:200] OF CarRecord. Write pseudocode to output the registration of every car that is not sold and was made before 2015, and then the total price of those cars.
Total ← 0 before the loop. ✓FOR Index ← 1 TO 200 ... NEXT Index. ✓IF Stock[Index].Sold = FALSE AND Stock[Index].Year < 2015 THEN. ✓OUTPUT Stock[Index].Registration and Total ← Total + Stock[Index].Price. ✓OUTPUT Total after the loop. ✓A programmer stores the cars in five separate 1D arrays (one per field) instead of one array of records. Give two advantages of using an array of records.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.