Computer Science for IGCSE & O level - Programming (Section 15)
1
In the provided pseudocode, the loop continues until `Finish` equals what value?
2
In the given example, which statements are logical operators?
3
In the context of the provided examples, what does the keyword 'RETURN' typically do in a function?
Trả lời(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?
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
```
6
What is the relationship between outer and inner selection blocks in a nested statement structure?
Trả lời(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?
8
Which of the following best describes the main goal of code optimization?
Trả lời(C)
To improve the code's performance.
9
In which type of loop is the condition checked *before* the loop body is executed?
10
Which statement best describes the role of an IDE (Integrated Development Environment) in the programming process?
Trả lời(B)
It provides a platform for writing, testing, and debugging code.
11
Which statement is correct about nested loops and nested selection statements?
Trả lời(C)
Both selection and iteration statements can be nested.
12
What is the primary function of the 'length' string method?
Trả lời(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'?
14
What is the purpose of the assignment operator (e.g., '=') in most programming languages?
Trả lời(C)
To assign a value to a variable.
15
In general, what is the benefit of using meaningful variable names?
Trả lời(B)
Improve code readability.
16
In Python, what is the primary purpose of the `print()` function?
Trả lời(B)
To display output on the console.
17
Which statement best describes what the CASE statement is used for?
Trả lời(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?
Trả lời(B)
The corresponding code block is executed.
19
What is the function of the `OUTPUT` statement in the context of the provided pseudo-code?
Trả lời(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
```
21
In the context of a two-dimensional array, what do the rows and columns help to do?
22
In the calculation example: `Calculate Number1 + Number2 * Number3;`, what operation will be performed first, according to the rules of precedence?
23
Which of the following statements are true about variables and constants?
24
Which of these is a valid arithmetic operator?
25
What is the primary function of a CASE statement in programming?
Trả lời(A)
To define multiple choices based on a single expression.
26
What does the modulo operator (%) compute?
27
Which of the following are generally considered benefits of modular programming?
28
What does the `//` notation typically signify in a programming language?
29
What is the purpose of the `NumOfStudents` variable?
Trả lời(A)
To store the number of students.
30
Which of the following concepts are fundamental constructs for developing a program?
31
What does the 'length' method calculate for strings?
Trả lời(A)
The number of characters in the string.
32
In which of the following areas are programming skills most commonly used?
33
What is the consequence of using nested selection statements?
Trả lời(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"?
Trả lời(C)
To implement an iteration or loop.
35
What is the primary purpose of the "Hello World" program in programming?
Trả lời(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?
Trả lời(C)
The ELSE block (if present)
37
Which loop type always guarantees the loop body executes at least once?
38
Which of the following is a benefit of using file handling in a program?
Trả lời(B)
Persistent storage of data
39
Trả lời(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)?
41
What action will take place when 'StudentHigh > ClassHigh' is true?
42
Which data type is often used to represent text or a sequence of characters?
43
Which programming structure enables you to control the order in which a set of statements is executed based on certain conditions?
44
What does the modulo operator (%) calculate?
Trả lời(B)
The remainder of a division.
45
Which method is used to find the number of characters in a string?
46
In the given pseudo-code example, which of the following is used to change the values for testing?
47
What is the role of the `if` statement in a program?
Trả lời(C)
To execute code conditionally based on a condition.
48
What would be displayed if the following code segment was executed OUTPUT: myData[2]
Trả lời(B)
The value stored at the third position in the myData array.
49
What is the function of the 'Substring' method in string manipulation?
Trả lời(B)
Extract a part of a string
50
Which of the following is an example of exception handling?