1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Revise later
SpaceTo flip
If confident
All Flashcards
What is a Variable?
A named storage location in memory.
What are Data Types?
Categories of values (e.g., integer, string, boolean).
What is a List?
An ordered collection of elements.
What is an Element?
An individual value in a list.
What is an Index?
The position of an element in a list.
What is an Algorithm?
A step-by-step procedure for solving a problem.
What is Sequencing?
Executing code statements in order.
What is a Boolean Value?
A value that is either `true` or `false`.
What is Iteration?
Repeating a block of code.
What is a Procedure?
A named block of code that performs a specific task.
What is the value of `x`?
`x ← 5`
`x ← x + 2`
7
What is the value of `myList[2]`?
`myList ← [10, 20, 30, 40]`
20
What is the result of `17 MOD 5`?
2
What is the result of `"hello" + "world"`?
"helloworld"
What is the result of `(5 > 3) AND (2 < 1)`?
false
What is printed?
`x ← 10`
`IF x > 5`
`DISPLAY("Greater")`
`ELSE`
`DISPLAY("Less")`
"Greater"
What is printed?
`x ← 10`
`y ← 5`
`IF x > 5`
`IF y > 2`
`DISPLAY("Both")`
`ELSE`
`DISPLAY("Only x")`
`ELSE`
`DISPLAY("Neither")`
"Both"
How many times does this loop execute?
`REPEAT 5 TIMES`
`DISPLAY("Hello")`
5
What is the final value of `x`?
`x ← 0`
`REPEAT UNTIL x > 3`
`x ← x + 1`
4
If `myList` is `[10, 20, 30, 40]`, what is the result of `INSERT(myList, 2, 25)`?
[10, 25, 20, 30, 40]
What are the steps of binary search?
1. Sort the data. 2. Find the middle element. 3. Compare target to middle. 4. Eliminate half the data. 5. Repeat until found or exhausted.