Summary
Programming concepts involve understanding how to store, manipulate, and use data within a program using variables, constants, and data types. Key concepts include sequence, selection, and repetition.
- Variable — a named location in memory that can store a value which may change during program execution. Example: In a program calculating the area of a rectangle, 'length' and 'width' can be variables.
- Constant — a named location in memory that holds a value which cannot change during program execution. Example: The value of Pi (3.14) in a program calculating the circumference of a circle.
- Data Type — specifies the type of data that a variable can hold, such as integer, string, or boolean. Example: An integer data type can hold whole numbers like 5 or -3.
- Subroutine — a block of code designed to perform a specific task, which can be reused in a program. Example: A function that calculates the sum of two numbers.
- Library Routine — a pre-written block of code stored in a library, designed to perform common tasks. Example: The 'math' library in Python provides functions like 'sqrt' to calculate square roots.
Exam Tips
Key Definitions to Remember
- Variable: A memory location that can store a changeable value.
- Constant: A memory location that stores a fixed value.
- Data Type: The kind of data a variable can hold, such as integer or string.
- Subroutine: A reusable block of code within a program.
Common Confusions
- Confusing variables with constants; remember variables can change, constants cannot.
- Misunderstanding data types; ensure you know the difference between types like integer and string.
Typical Exam Questions
- What is a variable? A memory location that can store a changeable value.
- How does a constant differ from a variable? A constant holds a fixed value that cannot change during program execution.
- What is a subroutine? A block of code designed to perform a specific task, reusable in a program.
What Examiners Usually Test
- Understanding of variables and constants.
- Ability to identify and use different data types.
- Knowledge of programming concepts like sequence, selection, and repetition.