Computer Science for IGCSE & O level - Programming (Section 1)
1
What is the function of a 'variable'?
2
In the given pseudo-code, which statement is responsible for displaying output to the user?
3
Which of the following features are commonly found in programming languages to facilitate file handling?
4
In Python, how do you open a file to read its content?
Answer(B)
open("filename.txt", "r")
5
In the program provided, which concept demonstrates an example of abstraction?
Answer(A)
Using MOD and DIV library routines.
6
Which of these programming elements is most often used to handle decision making in code?
Answer(C)
Conditional statements (IF/ELSE)
7
What does the `continue` statement do within a loop?
Answer(B)
Skips the rest of the current iteration and goes to the next iteration.
8
What is the main goal of writing maintainable code?
Answer(C)
To make the code easier to understand, modify, and debug over time.
9
What will happen if you try to access a local variable outside of its scope?
Answer(B)
The program will generate an error.
10
What does the keyword `RETURN` typically do in a function?
Answer(D)
It specifies the value that the function will give back.
11
Which of the following is an example of a valid output statement?
12
What is a benefit of breaking down a complex problem into smaller sub-problems in programming?
13
When writing pseudocode, which action should you avoid to improve code readability?
Answer(D)
Using unnecessarily complex or ambiguous logic.
14
Which of the following is a critical element in the design of efficient and reliable programs?
Answer(C)
Applying the principles of modularity.
15
What is the name of the programming paradigm that contains procedures?
16
In the given examples, which type of loop is more similar to the `REPEAT...UNTIL` loop?
Answer(C)
Post-condition (DO...WHILE) loop
17
In pseudo-code, what does an `IF` statement generally do?
Answer(C)
Make a decision based on a condition
18
In the example, what is the function of `MOD`?
Answer(B)
To return the remainder after division.
19
Which of the following is used to represent 'not equal to' in most programming languages?
20
What is a key characteristic of a function?
Answer(B)
It always returns a value.
21
What is the meaning of 'algorithm'?
Answer(C)
A set of steps to solve a problem.
22
Which operator is used to check if two values are equal?
23
Which programming element is essential for creating modular programs?
24
Consider an array declaration in pseudocode: `DECLARE myArray : ARRAY[0:9] OF INTEGER`. What does the number 9 represent?
Answer(B)
The last index of the array.
25
What actions will need to occur to store data persistently?
26
What does the acronym API stand for?
Answer(B)
Application Programming Interface
27
What is 'syntax' in the context of programming?
Answer(B)
The rules for writing the code.
28
In the context of the provided code snippets, what could `studentAverage` represent?
Answer(B)
The average mark of a single student.
29
What do parameters within functions or procedures do?
Answer(B)
They pass data into the function or procedure.
30
In programming, what is a 'constant'?
Answer(B)
A value that cannot be changed during program execution.
31
In the pseudo-code, how are comments typically used to clarify the program's logic?
Answer(B)
Comments provide explanatory notes within the code.
32
What is the significance of the data type associated with a variable?
Answer(C)
It determines the type of values the variable can hold and the operations that can be performed on it.
33
What is the role of an algorithm in programming?
Answer(D)
To provide a step-by-step procedure for solving a problem.
34
If `Value2 = DIV(17, 3)`, what is the value of `Value2`?
35
Which data type is best suited for storing whole numbers?
36
What is the purpose of the `try...except` block in Python?
Answer(B)
To handle potential errors and exceptions.
37
In the given examples, which data type is used to store whole numbers?
38
What are the characteristics of a good identifier name in a program?
39
What does the term 'parameter' refer to in the context of a function?
Answer(B)
The input values the function uses.
40
Which variable(s) are likely to be declared as global variables?
41
What is the main difference between constants and variables?
Answer(C)
Variables can be changed during program execution, constants cannot.
42
What is the purpose of an `ELSE` statement when used with an `IF` statement?
Answer(A)
To execute a block of code if the `IF` condition is false.
43
What is the primary function of a compiler or interpreter?
Answer(B)
To translate the source code into machine-executable code.
44
In Visual Basic, how do you begin a program?
45
What are library routines?
Answer(B)
Pre-written code modules that perform specific tasks.
46
In pseudo-code examples, what does the `NumberStudents` constant likely represent in the context of a student mark calculation program?
Answer(C)
The total number of students whose marks are being processed.
47
What does an algorithm constitute in programming?
Answer(B)
The set of steps to solve a problem.
48
Which keyword is used in Java to begin the program?
49
Which of the following can store multiple data types?
50
What is the primary purpose of the `IF-THEN-ELSE` construct in programming?
Answer(C)
To control the flow of execution based on a condition.