1.2.3 Flashcards
(26 cards)
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 variable can be changed after it is initialized.
False
Fill in the blank: An ________ is a sequence of instructions that performs a specific task.
algorithm
What is the purpose of a loop in programming?
A loop is used to repeat a block of code multiple times.
What symbol is often used to denote a comment in Python?
#
Multiple Choice: Which of the following is a valid variable name? A) 1stVariable B) first_variable C) first-variable D) first variable
B) first_variable
What does ‘if’ statement do in programming?
An ‘if’ statement executes a block of code if its condition evaluates to true.
True or False: The else statement can be used without an if statement.
False
What is the purpose of a function?
A function is a reusable block of code that performs a specific task.
Fill in the blank: A ________ is a collection of related data items.
data structure
What is an array?
An array is a data structure that can hold multiple values of the same type.
Multiple Choice: Which of the following is NOT a data type? A) Integer B) String C) List D) Loop
D) Loop
What is the difference between a list and a tuple in Python?
A list is mutable (can be changed), while a tuple is immutable (cannot be changed).
True or False: In programming, ‘syntax’ refers to the structure of code.
True
What is an error in programming?
An error is an issue in the code that prevents it from running correctly.
Fill in the blank: A ________ is a way to group related functions and variables.
module
What does ‘debugging’ mean?
Debugging is the process of identifying and removing errors from code.
Multiple Choice: Which of the following is a control structure? A) Variable B) Loop C) Function D) Data type
B) Loop
What is the function of ‘return’ in a function?
The ‘return’ statement ends the function and sends a value back to the caller.
True or False: Comments in code are executed by the program.
False
What is the purpose of a ‘while’ loop?
A ‘while’ loop continues to execute as long as its condition is true.
Fill in the blank: The ________ operator is used to compare two values for equality.
equality
What is an IDE?
An IDE (Integrated Development Environment) is software that provides tools for programming.
Multiple Choice: Which of the following is an example of a conditional statement? A) for loop B) if statement C) function D) variable declaration
B) if statement