Six original Cambridge-style questions on non-composite and composite user-defined data types, with mark points.
TYPE T = (A, B, C); pointer TYPE P = ^INTEGER.^X is the address of X; Ptr^ is the value at the address in Ptr.SET OF + DEFINE), class (CLASS ... ENDCLASS, NEW).Explain why user-defined data types are necessary.
State the difference between a composite and a non-composite data type, giving one example of each.
Write pseudocode to define an enumerated type Light with values Red, Amber and Green, declare a variable Signal of this type, and set it to Green.
TYPE Light = (Red, Amber, Green). ✓DECLARE Signal : Light. ✓Signal ← Green (no quotation marks). ✓TYPE TIntPointer = ^INTEGER. Count and Total are INTEGER variables; P is a TIntPointer.
Count ← 5 Total ← 9 P ← ^Count P^ ← P^ * 3 P ← ^Total P^ ← P^ - Count
State the final values of Count and Total, and what P holds.
A school records, for each club: its name, the day it meets (one of Monday to Friday), the maximum number of members and the fee per term. Design user-defined data types for this data in pseudocode.
TYPE WeekDay = (Monday, Tuesday, Wednesday, Thursday, Friday). ✓TYPE ClubRecord ... ENDTYPE. ✓DECLARE ClubName : STRING, DECLARE MeetDay : WeekDay. ✓DECLARE MaxMembers : INTEGER, DECLARE Fee : REAL. ✓A game stores the power-ups a player has collected. Each power-up is identified by one letter, a player cannot hold the same power-up twice, and the order of collection does not matter. Justify the choice of a set and write a suitable type definition.
TYPE PowerUpSet = SET OF CHAR (and a DEFINE line for any fixed set of values). ✓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.