2.2 Flashcards
What is a variable in programming?
A variable is a storage location identified by a name that holds a value.
True or False: A constant can be changed after it has been declared.
False
Fill in the blank: A _____ is a sequence of instructions that a computer can execute.
program
What does an algorithm represent?
An algorithm is a step-by-step procedure for solving a problem.
Which of the following is a data type? (a) Integer (b) Loop (c) Function
a) Integer
What is the purpose of a loop in programming?
A loop is used to execute a block of code repeatedly until a condition is met.
What is the difference between a syntax error and a runtime error?
A syntax error occurs when the code violates the language’s rules, while a runtime error occurs during the execution of the program.
True or False: A function can return a value.
True
What is an array?
An array is a collection of items stored at contiguous memory locations.
Which keyword is used to define a function in Python?
def
What is meant by ‘conditional statement’?
A conditional statement executes different actions based on whether a condition is true or false.
Fill in the blank: A _____ is a reusable piece of code that performs a specific task.
function
What does ‘debugging’ refer to in programming?
Debugging is the process of identifying and removing errors from computer software.
What is the purpose of comments in code?
Comments are used to explain code and are ignored by the compiler.
Which of the following is a control structure? (a) If statement (b) Array (c) Function
a) If statement
True or False: A string is a data type that represents a sequence of characters.
True
What does ‘iteration’ mean in programming?
Iteration refers to the repeated execution of a set of instructions in a loop.
What is the purpose of an ‘if’ statement?
An ‘if’ statement executes a block of code if a specified condition is true.
Fill in the blank: A _____ is a variable that holds a true or false value.
boolean
What is a ‘syntax error’?
A syntax error occurs when the code does not conform to the rules of the programming language.
What is a ‘loop control variable’?
A loop control variable is a variable that determines how many times a loop will execute.
Which of the following represents a list of items? (a) Integer (b) Array (c) String
b) Array
What is meant by ‘scope’ in programming?
Scope refers to the visibility of variables and functions within a program.
True or False: A ‘for’ loop is used for iterating a specific number of times.
True
What is a ‘parameter’ in a function?
A parameter is a variable used to pass information into a function.
Fill in the blank: A _____ is a programming construct that allows for decision-making.
conditional statement
What do we call a value that does not change during the execution of a program?
constant