Fundamental Programming Concepts Flashcards

All 6 cards in this deck

What is a variable in programming?

A named memory location whose value can change while the program is running.

What is a constant in programming?

A named value that is set once and cannot change while the program is running.

Give one reason to use a constant instead of a variable in a program.

The value cannot be changed accidentally, and it only needs editing in one place.

What is an assignment statement?

e.g. in OCR Exam Reference Language

A statement that stores a value in a variable using ==.
e.g. score = 0

True or false? == can be used to assign a value to a variable.

False. == tests for equality; a single = is used for assignment.

What are the steps to take a value from the user and display a message using it in OCR Exam Reference Language?

e.g. ask for a name then greet the user

  1. Assign the input to a variable: name = input("Enter name")
  2. Display output with print: print("Hello " + name)