compscipaper2.0

5.0(2)
Studied by 2 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/99

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:16 PM on 2/23/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

100 Terms

1
New cards

What is a variable?

A named storage location in memory that holds data which can be changed during program execution.

2
New cards

What is a constant?

A named storage location in memory that holds data which cannot be changed during program execution.

3
New cards

How do you assign a value to a variable in pseudocode?

VARIABLE_NAME ← VALUE (e.g., age ← 16)

4
New cards

What is input in programming?

Data entered into a program from an external source, such as a user via keyboard.

5
New cards

What is an example of an input statement in pseudocode?

INPUT variable_name (e.g., INPUT username)

6
New cards

What is output in programming?

Data sent from a program to an external destination, such as displaying on screen.

7
New cards

What is an example of an output statement in pseudocode?

OUTPUT “message” or OUTPUT variable_name

8
New cards

What is the purpose of casting in input?

To convert input data (usually string by default) to another data type, like integer.

9
New cards

Example of casting input to integer in Python?

age = int(input(“Enter your age

10
New cards

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.

11
New cards

What is sequence in programming?

The execution of instructions one after another in the order they appear.

12
New cards

What is selection in programming?

A structure that allows the program to choose different paths based on conditions (e.g., if statements).

13
New cards

What is iteration in programming?

Repeating a block of code multiple times (e.g., loops).

14
New cards

What is an example of sequence in pseudocode?

x ← 5; y ← 10; total ← x + y; OUTPUT total

15
New cards

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.

16
New cards

What is nesting in control structures?

Placing one control structure inside another, e.g., an if inside a loop.

17
New cards

What is a condition-controlled loop?

A loop that repeats while a condition is true (e.g., while loop).

18
New cards

What is a count-controlled loop?

A loop that repeats a fixed number of times (e.g., for loop).

19
New cards

Example of selection in pseudocode?

IF age > 18 THEN OUTPUT “Adult” ELSE OUTPUT “Minor” ENDIF

20
New cards

What is the difference between definite and indefinite iteration?

Definite has a known number of repeats (for); indefinite repeats until a condition changes (while).

21
New cards

What is an if statement?

A selection structure that executes code if a condition is true.

22
New cards

What is an else clause?

Part of if statement that executes if the condition is false.

23
New cards

What is elif (else if) used for?

To check additional conditions if the first if is false.

24
New cards

Example of a while loop in pseudocode?

WHILE condition DO statements ENDDO

25
New cards

When should you use a while loop?

When the number of iterations is unknown and depends on a condition.

26
New cards

Example of a for loop in pseudocode?

FOR i FROM 1 TO 10 DO OUTPUT i ENDDO

27
New cards

When should you use a for loop?

When iterating a known number of times, like over a range or array.

28
New cards

What is an infinite loop?

A loop that never ends because the exit condition is never met.

29
New cards

How do you break out of a loop early?

Use a break statement (in languages like Python).

30
New cards

Example of nested loops?

A loop inside another loop, e.g., for printing a grid.

31
New cards

What is an arithmetic operator?

Symbols used to perform mathematical calculations on numbers.

32
New cards

What does the + operator do?

Addition (e.g., 5 + 3 = 8)

33
New cards

What does the - operator do?

Subtraction (e.g., 5 - 3 = 2)

34
New cards

What does the * operator do?

Multiplication (e.g., 5 * 3 = 15)

35
New cards

What does the / operator do?

Division (returns float, e.g., 5 / 2 = 2.5)

36
New cards

What is integer division (//)?

Division that discards the remainder (e.g., 5 // 2 = 2)

37
New cards

What is modulus (%)?

Returns the remainder of division (e.g., 5 % 2 = 1)

38
New cards

What is exponentiation (**)?

Raises a number to a power (e.g., 2 ** 3 = 8)

39
New cards

What is the order of operations (BIDMAS/PEMDAS)?

Brackets, Indices/Exponents, Division/Multiplication, Addition/Subtraction.

40
New cards

Example of combined arithmetic

(10 + 2) * 3 / 2?

41
New cards

What is a data type?

A classification of data that determines what values it can hold and operations it can perform.

42
New cards

What is an integer data type?

Whole numbers, positive or negative, no decimals (e.g., 42, -5)

43
New cards

What is a real/float data type?

Numbers with decimal points (e.g., 3.14, -2.5)

44
New cards

What is a string data type?

Sequence of characters (text), enclosed in quotes (e.g., “hello”)

45
New cards

What is a Boolean data type?

True or False values, used for conditions.

46
New cards

What is casting?

Converting one data type to another (e.g., str(5) to “5”)

47
New cards

Why is data typing important?

Ensures correct operations and prevents errors, like adding string to number.

48
New cards

Example of Boolean in use?

IF is_adult = TRUE THEN …

49
New cards

What is a character data type?

A single character (e.g., ‘a’), often part of strings.

50
New cards

What happens if you add incompatible types?

Type error, unless casted.

51
New cards

What is string concatenation?

Joining two or more strings (e.g., “hello” + “world” = “helloworld”)

52
New cards

What is string length?

The number of characters in a string (e.g., LEN(“hello”) = 5)

53
New cards

What is substring/slice?

Extracting part of a string (e.g., “hello”[0

54
New cards

What does upper case conversion do?

Converts string to all uppercase (e.g., “hello”.UPPER() = “HELLO”)

55
New cards

What does lower case conversion do?

Converts string to all lowercase (e.g., “HELLO”.LOWER() = “hello”)

56
New cards

What is string indexing?

Accessing a character by position (starts at 0, e.g., “hello”[0] = “h”)

57
New cards

Example of finding position of substring?

POSITION(“l” IN “hello”) returns 2 (first occurrence, 0-based)

58
New cards

What is string repetition?

Repeating a string (e.g., “ha” * 3 = “hahaha”)

59
New cards

What is trimming whitespace?

Removing spaces from start/end (e.g., STRIP(” hello “ ) = “hello”)

60
New cards

Example of replacing in string?

REPLACE(“hello”, “e”, “a”) = “hallo”

61
New cards

What is file handling?

Reading from or writing to external files.

62
New cards

What modes can you open a file in?

Read (‘r’), write (‘w’), append (‘a’)

63
New cards

Example of opening a file in pseudocode?

file = OPEN(“data.txt”, “r”)

64
New cards

What is reading from a file?

Loading file content into the program (e.g., READLINE() or READALL())

65
New cards

What is writing to a file?

Saving data from program to file (e.g., WRITE(“hello”))

66
New cards

What is closing a file?

CLOSE(file) to free resources.

67
New cards

What is the ‘with’ statement in Python?

Automatically handles opening and closing files.

68
New cards

What is CSV file handling?

Comma-separated values, often read as lists or using CSV module.

69
New cards

What is an EOF error?

End of file reached while trying to read more.

70
New cards

Example of appending to file?

OPEN(“log.txt”, “a”); WRITE(“new line”)

71
New cards

What is a database?

A structured collection of data stored electronically.

72
New cards

What is SQL?

Structured Query Language, used to manage and query databases.

73
New cards

What is a table in a database?

A collection of related data in rows and columns.

74
New cards

What is a primary key?

A unique identifier for each record in a table.

75
New cards

What is a query?

A request for data from the database using SQL.

76
New cards

Example of SELECT statement?

SELECT * FROM students WHERE age > 16

77
New cards

What does INSERT do?

Adds a new record (e.g., INSERT INTO students (name, age) VALUES (“John”, 17))

78
New cards

What does UPDATE do?

Modifies existing records (e.g., UPDATE students SET age = 18 WHERE name = “John”)

79
New cards

What does DELETE do?

Removes records (e.g., DELETE FROM students WHERE age < 16)

80
New cards

What is a JOIN?

Combines data from two tables based on a related column.

81
New cards

What is an array?

A data structure that stores multiple values of the same type under one name.

82
New cards

What is a list in Python?

A dynamic array that can hold mixed types and change size.

83
New cards

What is indexing in arrays?

Accessing elements by position (starts at 0).

84
New cards

Example of declaring an array in pseudocode?

array_name[5] ← [1,2,3,4,5]

85
New cards

What is the length of an array?

Number of elements (e.g., LEN(array))

86
New cards

What is appending to a list?

Adding an element to the end (e.g., APPEND(value))

87
New cards

What is removing from an array?

DELETE at index or REMOVE value.

88
New cards

What is a 2D array?

Array of arrays, like a table (e.g., grid[3][4])

89
New cards

Example of iterating over array?

FOR EACH item IN array DO OUTPUT item

90
New cards

What is the difference between array and list?

Arrays are fixed size in some languages; lists are resizable.

91
New cards

What is a subprogram?

A named block of code that performs a task, can be called multiple times.

92
New cards

What is a function?

A subprogram that returns a value.

93
New cards

What is a procedure?

A subprogram that performs actions but doesn’t return a value.

94
New cards

What are parameters?

Values passed into a subprogram when called.

95
New cards

What is a return statement?

Sends a value back from a function.

96
New cards

Example of defining a function in pseudocode?

FUNCTION add(x, y) RETURN x + y ENDFUNCTION

97
New cards

What is calling a subprogram?

Using its name with arguments (e.g., result ← add(5,3))

98
New cards

What is the difference between parameter and argument?

Parameter is in definition; argument is passed when calling.

99
New cards

What is scope in subprograms?

Visibility of variables (local inside, global outside).

100
New cards

What is modular programming?

Breaking program into subprograms for reusability and clarity.