Computer Science for IGCSE & O level - Programming (Section 11)

1
Which statements are always part of a function definition?
Answer
(D)
All of the above.
2
What is the most common way to handle a file if an error is detected?
Answer
(D)
Use exception handling
3
What does the MOD function return?
Answer
(C)
The remainder of a division
4
What does a Selection statement enable a program to do?
Answer
(C)
Make choices based on conditions.
5
What does the step value of a FOR loop determine?
Answer
(C)
The increment or decrement applied to the loop variable in each iteration.
6
What is the basic definition of a variable?
Answer
(C)
A named storage for data.
7
Which of these is NOT a part of a well-structured program?
Answer
(C)
Complex Structure.
8
What does the code snippet `OUTPUT
Answer
(C)
Displays 'Enter some value' on the screen.
9
What does the symbol '%' represent in programming contexts (as used in the provided image)?
Answer
(B)
Modulo (remainder after division)
10
Which of the following is an example of file handling in the context of this document?
Answer
(B)
Reading data from a file.
11
Which of the following is a recommended practice for creating a maintainable program?
Answer
A
C
D
12
What operations are common in programming?
Answer
A
B
C
D
13
In nested IF-ELSE statements, what is the relationship between the outer and inner blocks of code?
Answer
(B)
The inner block executes only if the outer block's condition is met.
14
In the totaling example, how does the code update the total weight?
Answer
(C)
By adding Weight to TotalWeight.
15
Which operators can be used to perform calculations?
Answer
A
B
D
16
What is the output value of 'Average' in the provided pseudocode after the loop completes if the input marks are 15, 25 and 30?
Answer
(B)
23.33
17
What is the purpose of version control systems like Git?
Answer
(B)
To manage different versions of code and facilitate collaboration
18
Which type of loop guarantees that the code within the loop's body will always execute at least once?
Answer
(D)
Repeat...Until loop
19
Which of the following is a characteristic of a constant in a computer program?
Answer
(C)
Its value doesn't change during the program's execution.
20
In the pseudocode, what action does the statement `TOTAL = TOTAL + MARK` perform?
Answer
(B)
Adds the current mark to the total.
21
Which data type would be best suited for storing the value of PI (3.14159)?
Answer
(D)
Float
22
What is the primary purpose of storing data in a file, as mentioned in the context of computer programming?
Answer
(B)
To permanently store data that will be required again.
23
What is the use of the `IF` statement in the pseudo-code examples?
Answer
(B)
To make a decision based on a condition.
24
Which of the following are characteristics of a good algorithm?
Answer
A
B
C
25
Which logical operator yields TRUE only if both operands are TRUE?
Answer
(B)
AND
26
In the Totaling examples, what operation is performed by the statement: `TotalWeight = TotalWeight + Weight;`?
Answer
(A)
Adding weight to total weight.
27
In the Totaling example, how is the variable 'TotalWeight' updated?
Answer
(C)
TotalWeight = TotalWeight + Weight
28
Which data type is most appropriate for storing a whole number (integer) in most programming languages?
Answer
(C)
Integer
29
What is the primary difference between procedures and functions?
Answer
(A)
Functions always return a value, while procedures do not.
30
What does the 'x' mode do when you open a file?
Answer
(C)
Creates the file if it does not exist and opens it for writing.
31
Which of the following is an example of a library routine?
Answer
(C)
The MOD function.
32
What is the purpose of the lines: `NumOfStudents = 5` and `NumOfSubjects = 4` in the provided pseudo-code?
Answer
(B)
To initialize the number of students and subjects.
33
If the condition in an IF statement is false, which part of the statement will be executed?
Answer
(C)
The ELSE block (if present).
34
Which of the following is considered a function that programmers use for comment in many languages?
Answer
(D)
All of the above
35
What's the primary function of the `Uppercase` method in string manipulation?
Answer
(C)
To convert all characters to uppercase.
36
Which of the following are characteristics of a good identifier name?
Answer
A
B
D
37
What is typically the symbol for division in programming?
Answer
(B)
/
38
Which statement is true about the provided example of a Pre-condition loop?
Answer
(B)
The loop may not execute at all.
39
What data types are used in Python, based on the code provided?
Answer
A
B
C
40
What kind of loop structure begins by checking the condition *before* executing the code block?
Answer
(B)
Pre-condition loop
41
In the given pseudocode, what action is repeatedly performed within the loop?
Answer
(B)
Adding a mark to the total.
42
In the context of programming, what is a 'variable'?
Answer
(B)
A named storage location for data that can change during program execution.
43
In pseudocode, which command is commonly used to take input from a user?
Answer
(C)
INPUT
44
What is the purpose of a 'loop' in programming?
Answer
(A)
To repeat a block of code multiple times.
45
What does the `Lowercase` string method typically do?
Answer
(C)
Convert all characters in the string to lowercase.
46
What is the purpose of a 'function' in programming?
Answer
(B)
To create a reusable block of code that performs a specific task.
47
What type of loop is represented by this code structure? ``` DO Statements WHILE condition ```
Answer
(B)
Post-condition loop
48
What type of algorithm is demonstrated in the provided "Worked example"?
Answer
(C)
Calculation algorithm
49
In the Java example provided, what object is used to write to a file?
Answer
(C)
FileWriter
50
Which type of loop is exemplified by this code: ``` WHILE condition DO Statements ENDWHILE ```
Answer
(B)
Pre-condition loop