Skip to content

e. Extras

Data types and structures

1. Select the most appropriate data type and/or structure for the following data:

a. 818

b. 7.64

c. Potato

d. Student: { Phoebe, Corp, 20080808, Foundation, True }

e. 0411 411 411

f. False

g. Ladder: { Seamus, Lili, Timur, Kestrel, Presilla, Olivia }

h. ,

i. 0



3. Pablo is designing a program to manage seating arrangements in a theatre. Each row in the theatre has a fixed number of seats, and the program needs to track whether each seat is occupied or vacant. What data structure should Pablo use, and why?


4. Use the pseudocode below to answer the questions that follow.

Function calculateDiscountedPrices()
BEGIN
    INPUT products
    discountedPrices ← empty array
    FOR product in products DO
        discountAmount ← product.price * (product.discountRate / 100)
        discountedPrice ← product.price - discountAmount
        discountedPrices ← discountedPrices + [discountedPrice]
    NEXT
    RETURN discountedPrices
END

a. Which data type is discountAmount?

b. What data structure is product?

c. What are the data structures being input by the function and returned by the function?

d. What naming convention is being used?