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

1
What is the role of a 'comment' in source code?
Answer
(C)
To provide explanations for humans reading the code.
2
What is the process of finding and fixing errors in a program called?
Answer
(B)
Debugging
3
What does an algorithm represent in computer science?
Answer
(A)
A set of instructions for the computer to follow to solve a problem.
4
Which operator is used for exponentiation (raising a number to a power)?
Answer
(B)
**
5
Which of the following is a valid example of a data type?
Answer
(C)
String
6
What is the function of the `len()` method in Python (or equivalent in other languages, like 'length' in some)?
Answer
(C)
To determine the number of characters in a string or elements in a list.
7
Which of the following is an example of 'iteration'?
Answer
(C)
for loop
8
Which section is the visual output of the Visual Basic program?
Answer
(A)
The sum window
9
Which is a common use of comments in code?
Answer
(C)
To provide explanations to the code.
10
What is the purpose of indentation in programming code?
Answer
(B)
To make the code easier to read and understand.
11
What is a key feature of a function?
Answer
(B)
It always returns a value.
12
What is the function of the 'OUTPUT' statement in programming?
Answer
(B)
To display information to the user.
13
What does `ClassTotal` most likely represent in the example?
Answer
(D)
The total of student scores in the class.
14
What is the primary goal of using comments in code?
Answer
(C)
To explain the code's functionality.
15
What is the result of the expression: `(10 > 5) OR (2 < 1)`?
Answer
(A)
True
16
What is the purpose of a "prompt" when taking input in a program?
Answer
(C)
To show instructions to the user regarding what input is required.
17
What keyword typically declares a constant variable in programming?
Answer
(C)
CONST
18
Which data type is most appropriate for representing the radius of a circle?
Answer
(D)
REAL
19
What data type is suitable for storing textual data, such as a name or a sentence?
Answer
(C)
String
20
In the provided pseudocode, what does the variable `COUNTER` represent?
Answer
(B)
The number of marks entered.
21
Which of the following represents the 'input' operation?
Answer
(B)
read()
22
Which of the following is a common type of error in programming?
Answer
(D)
All of the above
23
Which programming construct is typically used to process each element of an array sequentially?
Answer
(B)
FOR loop
24
What is the role of an 'interpreter' in programming?
Answer
(B)
To execute the code directly, line by line.
25
In a programming context, what is a comment used for?
Answer
(C)
To explain what the code does.
26
What does the term 'modularity' mean in programming?
Answer
(C)
Dividing a program into independent, reusable components (modules).
27
What is the result of the expression `10 > 5 AND 2 < 1`?
Answer
(B)
False
28
Which of the following is a characteristic of a string data type?
Answer
(B)
Stores a sequence of characters.
29
What is the purpose of an `algorithm`?
Answer
(B)
To solve a problem step-by-step.
30
Which logical operator returns true if *at least one* condition is true?
Answer
(B)
OR
31
Which of the following is a valid variable name?
Answer
(C)
_variable
32
What is the output of: `print "abc" + "def"`?
Answer
(C)
abcdef
33
Which of the following is a characteristic of a good variable name?
Answer
(B)
Meaningful and descriptive
34
What is the role of a function?
Answer
(B)
To perform a specific task.
35
Which of the following is the primary purpose of a library routine?
Answer
(A)
To allow for modularity and reusability of code.
36
What does the term 'sequence' refer to in the context of programming?
Answer
(B)
The order in which steps in an algorithm are executed.
37
What does `//` represent in some programming languages (e.g. Python)?
Answer
(C)
Integer division operator
38
What is the primary role of a compiler?
Answer
(B)
To translate human-readable code into machine code.
39
Which part of the code is considered a 'function'?
Answer
(B)
A repeatable section of code.
40
Which data type is appropriate for storing a person's name in a program?
Answer
(D)
STRING
41
Which best describes the main goal of the provided examples?
Answer
(C)
To teach students how to calculate and display student marks.
42
What is the benefit of using meaningful identifier names for variables, constants, and procedures?
Answer
(C)
It improves the program's readability and maintainability.
43
Which of the following are examples of basic concepts used when developing a program?
Answer
A
B
C
D
44
What is the purpose of the 'main' method in a Java program?
Answer
(B)
To start the program's execution.
45
In programming, what does the `else` clause typically follow?
Answer
(B)
An `IF` statement
46
Which of these would be considered a variable type?
Answer
(A)
integer
47
What are the general steps in creating a program?
Answer
A
B
C
D
48
Which of the following tools can you use for debugging your code?
Answer
A
C
D
49
Which of the following is an example of a pre-condition loop?
Answer
(C)
WHILE...DO
50
What is the scope of a local variable?
Answer
(B)
Accessible only within the function or block of code where it is declared.