Technology · Unit 11

Programming

Variables, functions, data structures and languages

Real programs need ways to store values, reuse logic and organise data, and this unit covers the constructs every language provides for those jobs.

It covers variables, functions, data structures, objects and classes, and the differences between programming languages.

This unit breaks down into 23 short steps and 117 questions, starting at difficulty 1 and building to 5. Below you can see exactly what it covers, how the path is structured, and worked examples with explanations.

Steps
23
Questions
117
Difficulty
1-5

What this unit covers

  • Programming Languages
  • Functions
  • Data Structures
  • Variables
  • Objects and Classes

Where this fits

Needs Coding Basics and Data and Information.

Where people slip

Languages differ far less than they appear to. The same concepts appear with different syntax, and the second language is much easier than the first for that reason.

How the unit is structured

Programming runs as 23 short steps that unlock in order. 17 are practice rounds and 6 are challenge rounds that pull together everything before them. Questions start at difficulty 1 and climb to 5 as you progress.

Step 1 · easierStep 23 · harder

Challenge rounds

Example questions

30 real questions from this unit, with the answer and the reason behind it, grouped by what they practise. There are 117 in the unit altogether.

Data Structures

  • Fill the blankLevel 1

    1. An array is an ordered ____ of items stored together.

    • collectioncorrect
    • color
    • sound
    • button

    An array is a collection of items kept in order.

  • Multiple choiceLevel 1

    2. What is a list, also called an array?

    • An ordered collection of itemscorrect
    • A single letter
    • A power cable
    • A type of monitor

    A list or array is an ordered collection that can hold many items together.

  • Choose all that applyLevel 2

    3. Which of these are data structures?

    • Listcorrect
    • Arraycorrect
    • Dictionarycorrect
    • Printer
    • Speaker

    Lists, arrays, and dictionaries organize data, while a printer and a speaker are physical devices.

  • Guess the numberLevel 2

    4. In Python, the very first item in a list has which index number?

    Answer: 0

    Python lists start counting at 0, so the first item is at index 0.

  • Sort into groupsLevel 2

    5. Sort each structure by how you reach its items.

    Answer: Array = Reached by index; List = Reached by index; Dictionary = Reached by key; Map = Reached by key

    Arrays and lists are reached by a position number, while dictionaries and maps are reached by a key.

  • Match the pairsLevel 3

    6. Match each data structure to how it behaves.

    Answer: Stack = Last In, First Out; Queue = First In, First Out; Array = Reached by index number; Dictionary = Reached by key

    Each structure has its own rule for how items go in and come out.

Functions

  • Fill the blankLevel 1

    7. A function is a ____ block of code you can run whenever you need it.

    • reusablecorrect
    • broken
    • frozen
    • invisible

    Functions are reusable, so you can run them again and again.

  • Multiple choiceLevel 2

    8. Why do programmers use functions?

    • To avoid writing the same code againcorrect
    • To make the screen bigger
    • To charge the phone
    • To change the wallpaper

    Functions let you reuse the same code instead of writing it out again and again.

  • Put in orderLevel 2

    9. Put these steps in the correct order to use a function.

    Answer: Write (define) the function -> Call the function -> The function runs its code -> Get the result back

    You first define a function, then call it, it runs its code, and finally gives back a result.

  • True or falseLevel 2

    10. A function can take inputs to work with.

    Answer: True

    Functions can accept inputs, often called arguments, to use inside their code.

  • Choose all that applyLevel 3

    11. Which of these statements about function inputs are true?

    • An argument is the value you pass incorrect
    • A parameter is a named input in the definitioncorrect
    • A function can have several parameterscorrect
    • A function can never take any inputs

    Arguments are the values passed in, parameters are the names in the definition, and a function can take several.

  • Odd one outLevel 3

    12. Which of these is NOT related to how functions work?

    • Hard drivecorrect
    • Parameter
    • Return value
    • Argument

    A hard drive stores data, while parameters, return values, and arguments are all parts of functions.

Objects and Classes

  • Fill the blankLevel 1

    13. A class is a ____ used to create objects.

    • blueprintcorrect
    • snack
    • color
    • noise

    A class works like a blueprint that objects are built from.

  • Choose all that applyLevel 2

    14. Which statements about object-oriented programming are true?

    • A class is a blueprint for objectscorrect
    • An object is made from a classcorrect
    • A method is a function inside a classcorrect
    • A class is a kind of computer monitor

    A class is a blueprint, an object is built from a class, and a method is a function inside a class.

  • Match the pairsLevel 2

    15. Match each programming word to its meaning.

    Answer: Variable = Stores a value; Function = Reusable block of code; List = Collection of items; Class = Blueprint for objects

    These are four building blocks used across programming.

  • Multiple choiceLevel 2

    16. A function that belongs to a class is called a ____.

    • methodcorrect
    • monitor
    • cable
    • pixel

    A method is a function defined inside a class that acts on its objects.

  • Odd one outLevel 2

    17. Which of these is NOT part of object-oriented programming?

    • Monitorcorrect
    • Class
    • Object
    • Method

    A monitor is a physical screen, while classes, objects, and methods are OOP ideas.

  • Guess the numberLevel 3

    18. How many main pillars does object-oriented programming traditionally have?

    Answer: 4

    OOP is usually described with four pillars: encapsulation, inheritance, polymorphism, and abstraction.

Programming Languages

  • Fill the blankLevel 1

    19. We write programs using a programming ____.

    • languagecorrect
    • sandwich
    • planet
    • song

    A programming language gives us the words and rules to write code.

  • Multiple choiceLevel 1

    20. Which of these is a programming language?

    • Pythoncorrect
    • Photoshop
    • YouTube
    • Bluetooth

    Python is a real programming language, while the others are apps or a wireless feature.

  • Match the pairsLevel 2

    21. Match each language to something it is commonly used for.

    Answer: Python = Data and AI; JavaScript = Interactive web pages; Java = Android apps; C++ = Video games

    Different languages became popular for different jobs, though many can do more than one thing.

  • Odd one outLevel 2

    22. Which of these is NOT a programming language?

    • Instagramcorrect
    • Python
    • Java
    • JavaScript

    Instagram is a social media app, while Python, Java, and JavaScript are programming languages.

  • Choose all that applyLevel 3

    23. Which of these statements about programming languages are true?

    • Python is popular for data and AIcorrect
    • JavaScript runs in web browserscorrect
    • Java is often used for Android appscorrect
    • HTML is a fast, compiled language

    Python suits data and AI, JavaScript runs in browsers, and Java is common for Android apps.

  • Sort into groupsLevel 4

    24. Sort each language by how it is most commonly run.

    Answer: C = Usually compiled; C++ = Usually compiled; Python = Usually interpreted; JavaScript = Usually interpreted

    C and C++ are usually compiled ahead of time, while Python and JavaScript are usually interpreted.

Variables

  • Fill the blankLevel 1

    25. A variable is a named box that ____ a value so the program can use it later.

    • storescorrect
    • eats
    • deletes
    • hides

    A variable holds, or stores, a value under a name you choose.

  • Choose all that applyLevel 2

    26. Which of these can a variable store?

    • A numbercorrect
    • A word or some textcorrect
    • A true or false valuecorrect
    • A physical keyboard

    Variables can hold values such as numbers, text, and true or false, but not physical objects.

  • Guess the numberLevel 2

    27. How many different values can a single boolean variable hold?

    Answer: 2

    A boolean can be only true or false, so it has exactly two possible values.

  • Multiple choiceLevel 2

    28. Which symbol is most often used to put a value into a variable?

    • =correct
    • ?
    • @
    • #

    In most languages the = sign assigns the value on the right to the variable on the left.

  • Odd one outLevel 2

    29. Which of these is NOT something a variable can store?

    • A real, physical monitor
    • A number
    • A word
    • A true or false value

    Variables store data like numbers, words, and true or false values, not real physical parts.

  • Sort into groupsLevel 3

    30. Sort each value into its matching data type.

    Answer: 42 = Integer; 0 = Integer; cat = String; hello = String; true = Boolean; false = Boolean

    Whole numbers are integers, quoted text is a string, and true or false is a boolean.

Where these questions come from. Each unit starts as a plan of the concepts it should cover and the difficulty it should span. Questions are written against that plan with AI assistance, then checked by a validator that rejects anything without a single defensible answer, an explanation, or plausible wrong options. How we write questions sets out the whole process, and corrections are fixed in the bank and reach the site and the app the same day.

How you practise

This unit mixes 10 different question formats, so you are recalling and applying rather than recognising the same layout every time.

  • Choose all that apply
  • Fill the blank
  • Guess the number
  • Match the pairs
  • Multiple choice
  • Odd one out
  • Put in order
  • Sort into groups
  • True or false
  • Type the answer

Practise Programming

117 questions across 23 steps. Start with step one and crawl at your own pace.

Play this unit

More units in Technology

See all 18 units in Technology