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

1
In the provided pseudocode, the loop continues until `Finish` equals what value?
Answer
(C)
300
2
In the given example, which statements are logical operators?
Answer
A
B
D
3
In the context of the provided examples, what does the keyword 'RETURN' typically do in a function?
Answer
(D)
It specifies the value to be returned by the function.
4
Which of these methods is used for extracting a part of the string?
Answer
(B)
Substring
5
If age is 16, what output will the following code produce? ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
Answer
(B)
You are a child
6
What is the relationship between outer and inner selection blocks in a nested statement structure?
Answer
(B)
The inner block executes only if the outer block's condition is met.
7
Which of the following are valid examples of a 'Float' data type?
Answer
A
D
8
Which of the following best describes the main goal of code optimization?
Answer
(C)
To improve the code's performance.
9
In which type of loop is the condition checked *before* the loop body is executed?
Answer
(B)
Pre-condition loop
10
Which statement best describes the role of an IDE (Integrated Development Environment) in the programming process?
Answer
(B)
It provides a platform for writing, testing, and debugging code.
11
Which statement is correct about nested loops and nested selection statements?
Answer
(C)
Both selection and iteration statements can be nested.
12
What is the primary function of the 'length' string method?
Answer
(B)
To determine the number of characters in the string.
13
Which of the following programming concepts is described as 'the selection of a path through a program'?
Answer
(C)
Selection
14
What is the purpose of the assignment operator (e.g., '=') in most programming languages?
Answer
(C)
To assign a value to a variable.
15
In general, what is the benefit of using meaningful variable names?
Answer
(B)
Improve code readability.
16
In Python, what is the primary purpose of the `print()` function?
Answer
(B)
To display output on the console.
17
Which statement best describes what the CASE statement is used for?
Answer
(B)
To execute a different block of code based on the value of a variable.
18
In a CASE statement, what happens if a match is found in the cases?
Answer
(B)
The corresponding code block is executed.
19
What is the function of the `OUTPUT` statement in the context of the provided pseudo-code?
Answer
(C)
To display information to the user.
20
If the age is 16, what is the output of the following code: ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
Answer
(A)
You are a child
21
In the context of a two-dimensional array, what do the rows and columns help to do?
Answer
(C)
Organize data
22
In the calculation example: `Calculate Number1 + Number2 * Number3;`, what operation will be performed first, according to the rules of precedence?
Answer
(B)
Number2 * Number3
23
Which of the following statements are true about variables and constants?
Answer
A
B
C
24
Which of these is a valid arithmetic operator?
Answer
(C)
^
25
What is the primary function of a CASE statement in programming?
Answer
(A)
To define multiple choices based on a single expression.
26
What does the modulo operator (%) compute?
Answer
(B)
The remainder.
27
Which of the following are generally considered benefits of modular programming?
Answer
A
B
C
D
28
What does the `//` notation typically signify in a programming language?
Answer
(C)
A single-line comment
29
What is the purpose of the `NumOfStudents` variable?
Answer
(A)
To store the number of students.
30
Which of the following concepts are fundamental constructs for developing a program?
Answer
A
B
C
D
31
What does the 'length' method calculate for strings?
Answer
(A)
The number of characters in the string.
32
In which of the following areas are programming skills most commonly used?
Answer
A
B
C
D
33
What is the consequence of using nested selection statements?
Answer
(C)
It lets you implement complex conditional logic.
34
In the context of the provided pseudocode, what is the purpose of the line "REPEAT ... UNTIL Finish = 300"?
Answer
(C)
To implement an iteration or loop.
35
What is the primary purpose of the "Hello World" program in programming?
Answer
(C)
To display an output message on the screen
36
If the condition in the IF statement evaluates to *false*, which block of code, if any, will be executed?
Answer
(C)
The ELSE block (if present)
37
Which loop type always guarantees the loop body executes at least once?
Answer
(B)
Post-condition loop
38
Which of the following is a benefit of using file handling in a program?
Answer
(B)
Persistent storage of data
39
What is a pseudocode?
Answer
(C)
An informal way to plan out a program.
40
Which logical operator is used to negate a condition (i.e., make it the opposite)?
Answer
(C)
NOT
41
What action will take place when 'StudentHigh > ClassHigh' is true?
Answer
(A)
ClassHigh = StudentHigh
42
Which data type is often used to represent text or a sequence of characters?
Answer
(C)
String
43
Which programming structure enables you to control the order in which a set of statements is executed based on certain conditions?
Answer
(C)
Selection statement
44
What does the modulo operator (%) calculate?
Answer
(B)
The remainder of a division.
45
Which method is used to find the number of characters in a string?
Answer
(A)
Length
46
In the given pseudo-code example, which of the following is used to change the values for testing?
Answer
(B)
Constant values
47
What is the role of the `if` statement in a program?
Answer
(C)
To execute code conditionally based on a condition.
48
What would be displayed if the following code segment was executed OUTPUT: myData[2]
Answer
(B)
The value stored at the third position in the myData array.
49
What is the function of the 'Substring' method in string manipulation?
Answer
(B)
Extract a part of a string
50
Which of the following is an example of exception handling?
Answer
(B)
TRY and CATCH blocks