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

1
What does the term 'algorithm' refer to in the context of programming?
Answer
(B)
A set of instructions to solve a problem.
2
Which of the following is an example of an 'assignment' statement in programming?
Answer
(C)
x = 10
3
What are the main components to consider when writing an algorithm?
Answer
(C)
Input, process, and output.
4
What does it mean when a procedure call must match the procedure definition?
Answer
(D)
All of the above.
5
In the given context, what would be the result of the following pseudocode: x = 5; y = 2; OUTPUT x + y;
Answer
(B)
7
6
What would the Java code 'System.out.println("Hello World");' do?
Answer
(B)
Print the text 'Hello World' to the console
7
Which loop is used to execute a block of code a fixed number of times?
Answer
(A)
FOR loop
8
In the context of the programming, what does 'debugging' refer to?
Answer
(B)
Finding and fixing errors in the program
9
Which of the following are examples of basic data types in programming?
Answer
A
B
C
D
10
What does the term "variable scope" refer to in programming?
Answer
(B)
The area of the code where a variable is accessible.
11
What is the primary function of a "module" in a programming context?
Answer
(C)
To group related code and functionality.
12
What does a function always do differently than a procedure (if a function does it at all)?
Answer
(B)
It always returns a value.
13
Which statement is the appropriate way to iterate over the elements of an array?
Answer
(B)
FOR loop
14
What are some examples of high-level programming languages?
Answer
A
B
D
15
Which of the following statements about functions and procedures is true?
Answer
(C)
Functions can return a value, and procedures can also return a value, but not always.
16
What type of loop structure guarantees at least one execution of the loop body?
Answer
(C)
Post-condition loop
17
Which of the following is a function of a 'compiler'?
Answer
(B)
To translate code into machine language.
18
Which of the following is NOT a concept within the text?
Answer
(B)
Integration
19
What is the purpose of an algorithm in programming?
Answer
(B)
To solve a problem through a series of steps.
20
In a `CASE` statement, what determines which code block will be executed?
Answer
(B)
The value of a controlling expression.
21
What is the result of the code: `Console.WriteLine("Enter a value")`?
Answer
(A)
The program displays "Enter a value" on the console.
22
What would be the output of the code: `PRINT "Hello" + "World"`?
Answer
(C)
HelloWorld
23
Which of the following is a characteristic of a post-condition loop?
Answer
(B)
The loop body is always executed at least once.
24
What is the primary use of comments in code?
Answer
(B)
To explain the code to human readers.
25
Which keyword is used to import a module in Python?
Answer
(C)
import
26
What is the primary purpose of a function in programming?
Answer
(B)
To organize code into reusable blocks.
27
What is the purpose of the 'FOR' loop in programming?
Answer
(B)
To repeat a block of code a specific number of times.
28
In the pseudocode provided, what is the correct formula for calculating the average?
Answer
(B)
Average = Total / Counter
29
What does the `//` operator do in Python?
Answer
(B)
Integer division
30
What does the term 'syntax' refer to in programming?
Answer
(B)
The structure and grammar rules of the code.
31
What does the `NOT` operator do?
Answer
(B)
It reverses the truth value of an expression.
32
What is the correct order of operations (PEMDAS/BODMAS) in most programming languages?
Answer
(A)
Parentheses, Exponents, Multiplication and Division, Addition and Subtraction
33
Which type of loop is best suited for situations where you need to execute a block of code a specific number of times?
Answer
(C)
Count-controlled loop
34
What is the primary goal of code refactoring?
Answer
(C)
To improve the code's structure and readability without changing its behavior.
35
What is the purpose of a 'string' data type?
Answer
(B)
To store sequences of characters or text.
36
What type of variable is used in a 'Hello World' program?
Answer
(B)
String
37
What are the required steps involved to write a 'Hello World' program?
Answer
(A)
Output statements
38
What is 'selection' in the context of programming?
Answer
(B)
Choosing a specific code execution path based on a condition.
39
When should you use a procedure instead of writing the same code repeatedly?
Answer
(A)
When the code performs a specific task that needs to be done multiple times.
40
What is the correct syntax for a FOR loop in Python?
Answer
(B)
for i in range(1, 10):
41
What will `"Hello" + " " + "World"` evaluate to?
Answer
(B)
Hello World
42
What is the primary function of the `RETURN` statement in a function?
Answer
(C)
To send a value back from the function.
43
What programming construct is used to repeat a set of instructions?
Answer
(C)
A loop.
44
What should be done before starting the program in the Java code?
Answer
(C)
Declare variables and import the packages
45
Which operator is used for integer division?
Answer
(B)
\
46
Which of the following is a selection structure mentioned in the text?
Answer
(C)
IF statement
47
What is the basic data type used for a single character?
Answer
(C)
Char
48
Which data type would be most suitable for representing a price that might contain decimal places?
Answer
(D)
Double/Real
49
How does using meaningful identifiers (variable names, function names) benefit code maintenance?
Answer
(C)
It makes the code easier for developers to understand and modify.
50
What is the key advantage of using indexed elements in an array?
Answer
(C)
Fast and easy access to data.