1/99
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is a variable?
A named storage location in memory that holds data which can be changed during program execution.
What is a constant?
A named storage location in memory that holds data which cannot be changed during program execution.
How do you assign a value to a variable in pseudocode?
VARIABLE_NAME ← VALUE (e.g., age ← 16)
What is input in programming?
Data entered into a program from an external source, such as a user via keyboard.
What is an example of an input statement in pseudocode?
INPUT variable_name (e.g., INPUT username)
What is output in programming?
Data sent from a program to an external destination, such as displaying on screen.
What is an example of an output statement in pseudocode?
OUTPUT “message” or OUTPUT variable_name
What is the purpose of casting in input?
To convert input data (usually string by default) to another data type, like integer.
Example of casting input to integer in Python?
age = int(input(“Enter your age
What is the difference between a local and global variable?
Local is declared inside a subprogram and only accessible there; global is declared outside and accessible everywhere.
What is sequence in programming?
The execution of instructions one after another in the order they appear.
What is selection in programming?
A structure that allows the program to choose different paths based on conditions (e.g., if statements).
What is iteration in programming?
Repeating a block of code multiple times (e.g., loops).
What is an example of sequence in pseudocode?
x ← 5; y ← 10; total ← x + y; OUTPUT total
What is the purpose of indentation in control structures?
To define the block of code that belongs to the structure, like in if or loop statements.
What is nesting in control structures?
Placing one control structure inside another, e.g., an if inside a loop.
What is a condition-controlled loop?
A loop that repeats while a condition is true (e.g., while loop).
What is a count-controlled loop?
A loop that repeats a fixed number of times (e.g., for loop).
Example of selection in pseudocode?
IF age > 18 THEN OUTPUT “Adult” ELSE OUTPUT “Minor” ENDIF
What is the difference between definite and indefinite iteration?
Definite has a known number of repeats (for); indefinite repeats until a condition changes (while).
What is an if statement?
A selection structure that executes code if a condition is true.
What is an else clause?
Part of if statement that executes if the condition is false.
What is elif (else if) used for?
To check additional conditions if the first if is false.
Example of a while loop in pseudocode?
WHILE condition DO statements ENDDO
When should you use a while loop?
When the number of iterations is unknown and depends on a condition.
Example of a for loop in pseudocode?
FOR i FROM 1 TO 10 DO OUTPUT i ENDDO
When should you use a for loop?
When iterating a known number of times, like over a range or array.
What is an infinite loop?
A loop that never ends because the exit condition is never met.
How do you break out of a loop early?
Use a break statement (in languages like Python).
Example of nested loops?
A loop inside another loop, e.g., for printing a grid.
What is an arithmetic operator?
Symbols used to perform mathematical calculations on numbers.
What does the + operator do?
Addition (e.g., 5 + 3 = 8)
What does the - operator do?
Subtraction (e.g., 5 - 3 = 2)
What does the * operator do?
Multiplication (e.g., 5 * 3 = 15)
What does the / operator do?
Division (returns float, e.g., 5 / 2 = 2.5)
What is integer division (//)?
Division that discards the remainder (e.g., 5 // 2 = 2)
What is modulus (%)?
Returns the remainder of division (e.g., 5 % 2 = 1)
What is exponentiation (**)?
Raises a number to a power (e.g., 2 ** 3 = 8)
What is the order of operations (BIDMAS/PEMDAS)?
Brackets, Indices/Exponents, Division/Multiplication, Addition/Subtraction.
Example of combined arithmetic
(10 + 2) * 3 / 2?
What is a data type?
A classification of data that determines what values it can hold and operations it can perform.
What is an integer data type?
Whole numbers, positive or negative, no decimals (e.g., 42, -5)
What is a real/float data type?
Numbers with decimal points (e.g., 3.14, -2.5)
What is a string data type?
Sequence of characters (text), enclosed in quotes (e.g., “hello”)
What is a Boolean data type?
True or False values, used for conditions.
What is casting?
Converting one data type to another (e.g., str(5) to “5”)
Why is data typing important?
Ensures correct operations and prevents errors, like adding string to number.
Example of Boolean in use?
IF is_adult = TRUE THEN …
What is a character data type?
A single character (e.g., ‘a’), often part of strings.
What happens if you add incompatible types?
Type error, unless casted.
What is string concatenation?
Joining two or more strings (e.g., “hello” + “world” = “helloworld”)
What is string length?
The number of characters in a string (e.g., LEN(“hello”) = 5)
What is substring/slice?
Extracting part of a string (e.g., “hello”[0
What does upper case conversion do?
Converts string to all uppercase (e.g., “hello”.UPPER() = “HELLO”)
What does lower case conversion do?
Converts string to all lowercase (e.g., “HELLO”.LOWER() = “hello”)
What is string indexing?
Accessing a character by position (starts at 0, e.g., “hello”[0] = “h”)
Example of finding position of substring?
POSITION(“l” IN “hello”) returns 2 (first occurrence, 0-based)
What is string repetition?
Repeating a string (e.g., “ha” * 3 = “hahaha”)
What is trimming whitespace?
Removing spaces from start/end (e.g., STRIP(” hello “ ) = “hello”)
Example of replacing in string?
REPLACE(“hello”, “e”, “a”) = “hallo”
What is file handling?
Reading from or writing to external files.
What modes can you open a file in?
Read (‘r’), write (‘w’), append (‘a’)
Example of opening a file in pseudocode?
file = OPEN(“data.txt”, “r”)
What is reading from a file?
Loading file content into the program (e.g., READLINE() or READALL())
What is writing to a file?
Saving data from program to file (e.g., WRITE(“hello”))
What is closing a file?
CLOSE(file) to free resources.
What is the ‘with’ statement in Python?
Automatically handles opening and closing files.
What is CSV file handling?
Comma-separated values, often read as lists or using CSV module.
What is an EOF error?
End of file reached while trying to read more.
Example of appending to file?
OPEN(“log.txt”, “a”); WRITE(“new line”)
What is a database?
A structured collection of data stored electronically.
What is SQL?
Structured Query Language, used to manage and query databases.
What is a table in a database?
A collection of related data in rows and columns.
What is a primary key?
A unique identifier for each record in a table.
What is a query?
A request for data from the database using SQL.
Example of SELECT statement?
SELECT * FROM students WHERE age > 16
What does INSERT do?
Adds a new record (e.g., INSERT INTO students (name, age) VALUES (“John”, 17))
What does UPDATE do?
Modifies existing records (e.g., UPDATE students SET age = 18 WHERE name = “John”)
What does DELETE do?
Removes records (e.g., DELETE FROM students WHERE age < 16)
What is a JOIN?
Combines data from two tables based on a related column.
What is an array?
A data structure that stores multiple values of the same type under one name.
What is a list in Python?
A dynamic array that can hold mixed types and change size.
What is indexing in arrays?
Accessing elements by position (starts at 0).
Example of declaring an array in pseudocode?
array_name[5] ← [1,2,3,4,5]
What is the length of an array?
Number of elements (e.g., LEN(array))
What is appending to a list?
Adding an element to the end (e.g., APPEND(value))
What is removing from an array?
DELETE at index or REMOVE value.
What is a 2D array?
Array of arrays, like a table (e.g., grid[3][4])
Example of iterating over array?
FOR EACH item IN array DO OUTPUT item
What is the difference between array and list?
Arrays are fixed size in some languages; lists are resizable.
What is a subprogram?
A named block of code that performs a task, can be called multiple times.
What is a function?
A subprogram that returns a value.
What is a procedure?
A subprogram that performs actions but doesn’t return a value.
What are parameters?
Values passed into a subprogram when called.
What is a return statement?
Sends a value back from a function.
Example of defining a function in pseudocode?
FUNCTION add(x, y) RETURN x + y ENDFUNCTION
What is calling a subprogram?
Using its name with arguments (e.g., result ← add(5,3))
What is the difference between parameter and argument?
Parameter is in definition; argument is passed when calling.
What is scope in subprograms?
Visibility of variables (local inside, global outside).
What is modular programming?
Breaking program into subprograms for reusability and clarity.