Define variable
An abstraction that holds the value of a piece of data.
Define what a boolean expression is.
Statement where answer is either true or false.
What is iteration?
Repeating a set of instructions.
Define a list
Data structure that stores elements together
What is an algorithm?
Step by step instructions to solve a problem.
What dozes the assignment operator (<-) do?
Sets a value to a variable.
Define conditional statements.
Statements that use boolean expressions to decide which part of a code to execute.
Difference between fixed loop and a conditional loop?
Fixed - set number of times
Conditional - runs until a condition is met
What are indexes used for?
To access or change elements at a specific location in a list.
System can become slow/unresponsive.
What is output of this code:
x <- 5
x <- x + 2
DISPLAY(x)
7
What make an output of true for an AND operator?
True and true
Why is using loops useful?
Eliminate repetitive code.
Which number will be displayed?
nums <- [1,3,5]
DISPLAY nums[2]
3
How can one algorithm solve multiple different problems?
Algorithms can be used in different programs to execute a specific task.
Why are variables used?
They let programs store, update, and reuse data.
What is a nested loop?
When one loop is placed inside of another.
What does appending to a list do?
Adds an element to the end.
Why is efficiency important in algorithms?
Using more efficient algorithms save time.
T or F: When b <- a and the value of a changes later on, the value of b also changes.
False
Returns the opposite. If condition is true, then false is returned. If condition is false, then true is returned.
What are nested loops used for?
Repeating instructions when each repetition needs more actions to be done.
How to get the last element of a list?
Use the same index as the length of the list.
Why is using an algorithm more efficient than individual code segments?
Less repetition, and code can be reused.