Meaningful Identifiers Flashcards

1️⃣ Familiarise yourself with the flashcards:

  • Look through all the flashcards to see what's on both sides.
  • Make sure you understand the information on each card. If something's unclear, click the link to the revision notes at the bottom of the page for more details.

2️⃣ Test yourself:

  • Look at the question or prompt on each card and try to remember the answer before flipping it over.
  • Check the answer and make a note of any cards you find challenging and need to go over more.

3️⃣ Consistently Review and Practice:

  • Use spaced repetition: spend more time on the cards you struggle with and go over them more often.
  • Regularly review all the flashcards to help you better understand and retain the information over time.

Note: We may include questions that have multiple correct answers. It's useful to remember specific examples to understand these concepts better.

PERSONALISED 1-TO-1 TUTORING

Need more help on this topic? Get 1-to-1 support

Get support with clear explanations, practice and feedback (Ages 5 to 16).

  • DBS-checked tutors
  • Flexible times
  • Parents can be updated

Want an ad-free experience? Subscribe to remove ads

What is an identifier in programming?

A name you give to a variable, constant, or function.

What does a meaningful identifier do?

It clearly shows what the data or code is for.

Give one reason to use meaningful identifiers.

They make code easier to read, share, and fix.

Which is more meaningful: x or total_price, and why?

total_price, because it shows what the value means.

Name some common rules for valid identifiers.

Start with a letter. Use letters, digits, or underscores. No spaces. Do not use reserved words.

What is a reserved word, and can you use it as a name?

A word the language uses, like if. You cannot use it as an identifier.

In Python, are score and Score the same identifier?

No. Identifiers are case-sensitive, so they are different.

What is snake_case naming?

Lower case words joined with underscores, like total_price.

How should you name constants?

Use clear names in UPPER_CASE, like MAX_SPEED.

What kind of words suit variables and functions?

Use nouns for variable names. Use verbs for function names.

When is a one-letter name like i acceptable?

For a short, simple counter. Avoid it for other names.

How long should a good identifier be?

Long enough to be clear, but not too long to type.