Random name generator

School club

A random name generator.

A random name generator can be useful for creating dummy data for test purposes.


Write a program to output a random name from one list of forenames and another list of surnames.

Use this boilerplate code as a starting point:

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

Complete the subprogram called `generate_name` that:

  1. Assigns an array of forenames. You can use the names: Muhammad, Noah, Jack, Lily, Sophia, Olivia or some of your own.
  2. Assigns an array of surnames. You can use the names: Wang, Smith, Devi, Jones, Kim and Rodríguez or some of your own.
  3. It returns a random forename with a space and a random surname.

Complete the `main program` so that:

  1. It outputs a random name.

Typical inputs and outputs from the program would be:

Lily Rodríguez

Sophia Devi

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:


Run your program several times to check that your program has met the success criteria.

Check that you have:

  • Used comments within the code to describe the purpose of subprograms, conditions and iterations.
  • Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.
Craig'n'Dave logo

Craig ‘n’ Dave

In partnership with

Mission Encodeable
Bett Awards 2024 Finalist