What are the syntax rules in programming?
Use the correct structure (e.g. brackets, semicolons)
Syntax rules ensure that the code is correctly formatted for the programming language being used.
What are naming rules in programming?
Use clear names for variables (e.g. totalMarks, not x)
Clear naming conventions improve code readability and maintainability.
What are control rules?
Decide how the program runs, including sequence, selection, and iteration
Control rules govern the logic and flow of the program’s execution.
What is sequence in programming?
Outlines how steps run in order
Sequence is the default control structure where instructions are executed linearly.
What is selection in programming?
Making decisions using if or else
Selection allows for conditional execution of code blocks.
What is iteration in programming?
Repeating steps using loops (e.g. for, while)
Iteration is used to execute a block of code multiple times.
What are validation rules?
Checking if data is correct (e.g. age must be between 0–120)
Validation rules help ensure that input data adheres to specified criteria.
What are error handling rules?
What to do if something goes wrong
Error handling ensures that the program can manage unexpected issues gracefully.
What are the different data types in programming?
Each data type serves a specific purpose in programming, affecting how data is stored and manipulated.
What is a string in programming?
A sequence of characters enclosed in quotes. Example: name = ‘Bob’
Strings are commonly used to represent text.
What is an integer in programming?
A whole number with no decimal point. Example: age = 30
Integers are used for counting and indexing.
What is a float in programming?
A number that has a decimal point. Example: price = 19.99
Floats are used for representing precise values like currency.
What is a list in programming?
An ordered collection of items (any type) enclosed in square brackets. Example: colors = [‘red’, ‘green’, ‘blue’]
Lists allow for storing multiple items in a single variable.
What is a dictionary in programming?
A collection of key-value pairs enclosed in curly braces. Example: person = {‘name’: ‘Bob’, ‘age’: 30, ‘city’: ‘Ballarat’}
Dictionaries provide a way to store data that can be accessed by a unique key.
What are control structures?
Used to control the flow of a program. Common ones include conditional logic and loops
Control structures are essential for creating dynamic and functional programs.
What is conditional logic in programming?
if / elif / else statements. Example: if age > 18: print(‘Adult’)
Conditional logic allows the program to execute different code paths based on conditions.
What is a loop in programming?
for / while structures. Example: for color in colors: print(color)
Loops enable repetitive execution of code, which is useful for processing collections.
What is a module in programming?
A file containing Python code (functions, variables, classes) that can be imported and used in your program. Example: import math
Modules promote code reuse and organization.
What is a variable in programming?
Stores data that can be used and changed throughout a program. Examples: message = ‘Welcome!’, count = 5
Variables are fundamental for holding values that can be manipulated.
What does the print() function do?
Displays output to the console. Example: print(‘Hello, Bob!’)
The print function is commonly used for debugging and user interaction.