What is a variable?
A named storage location in memory that holds a value
What is a data type?
A classification that specifies what kind of value a variable can hold
What is local scope?
The region within a program where a variable is accessible only within the function or block where it is declared.
What is abstraction?
The process of reducing complexity by focusing on the main idea and hiding irrelevant details.
Why are variables important in algorithms?
They store data that can change, allowing algorithms to perform dynamic operations.
How do you assign a value to a variable in pseudocode?
The syntax SET x TO 10 assigns the value 10 to the variable x in pseudocode
Name two common data types.
Examples include integer and string
What is global scope?
Variables that are accessible from any part of the program
How do variables support abstraction?
They allow for generalization by using names that can represent different values at different times.
How do you declare a variable in pseudocode?
The syntax SET x TO 0 declares a variable x in pseudocode.
What does it mean to initialize a variable?
Giving a variable an initial value when it is declared
What is a Boolean value?
A data type that represents two possible values: true or false
What is a parameter in a function?
A variable defined in a function’s declaration to accept input values
What is an abstract data type?
A model or concept that represents complex data structures or operations in a simplified manner
How do variables enhance algorithm efficiency?
Variables allow algorithms to operate on changing data, making them more versatile and efficient.
How can a variable's value be updated?
Changing the value of a variable to a new value
Give an example of a string
"Hello, World!" is an example
What is block scope?
Variables declared inside a set of curly braces {} or within any block of code
How do constants support abstraction?
Constants provide meaningful names for fixed values, making programs easier to understand.
What is the role of a loop control variable?
It is used to control the number of iterations in a loop, ensuring the algorithm runs correctly.
What is a variable identifier?
The name given to a variable that follows naming rules and conventions.
How do you convert data types in pseudocode?
Using functions like TO_INTEGER or TO_STRING in pseudocode
What is the scope of a variable declared inside a function?
The scope is limited to the function itself
Give an example of using abstraction in problem-solving
Using functions and variables to simplify a complex problem, such as breaking down a program into smaller, manageable pieces.
How do variables support algorithm debugging?
They can be used to track the state and flow of an algorithm, helping identify where errors occur.