Write pseudocode statements for: the declaration and initialisation of constants

11.1 Programming Basics

Objective: Declaration & Initialisation of Constants in Pseudocode

📌 Constants are values that never change during program execution. Think of them as the rules of a game – once set, they stay the same. In pseudocode, you declare a constant by giving it a name and assigning it a value, then you can use that name anywhere in your program.

  • Constants are usually written in uppercase to distinguish them from variables.
  • They can be of any data type: integer, real, string, etc.
  • Once declared, you cannot change the value.
  • Use constants to make your code clearer and less error‑prone.

How to Write Pseudocode for Constants

  1. Choose a descriptive name (e.g., PI, MAX_SCORE).
  2. Write the declaration: CONST NAME = VALUE.
  3. Use the constant in calculations or comparisons: area = PI * radius * radius.
  4. Never assign a new value to the constant later in the program.

Pseudocode Examples

Example Explanation
CONST GRAVITY = 9.81
CONST DAYS_IN_WEEK = 7
Sets the acceleration due to gravity and the number of days in a week as fixed values.
CONST MAX_PLAYERS = 4
CONST GAME_TITLE = "Space Adventure"
Defines the maximum number of players and the title of the game.
Exam Tip: When writing pseudocode, always use the CONST keyword and keep the name in uppercase. This signals to the examiner that the value is fixed. Also, avoid reassigning a constant; if you need a new value, use a variable instead.
Common Mistake: Mixing up CONST with VAR. Remember, CONST is immutable, VAR can change.

Quick Recap

  • Use CONST for fixed values.
  • Name constants in uppercase.
  • Declare once, use everywhere.
  • Never reassign a constant.

💡 Remember: Constants help keep your code predictable and easy to read – just like the rules of a board game that everyone follows!

Revision

Log in to practice.

2 views 0 suggestions