Computer Science for IGCSE & O level - Programming (Section 10)
1
What is the primary function of a selection statement (like IF...THEN...ELSE)?
پاسخ دهید(C)
To choose which code block to execute based on a condition.
2
What is the main advantage of using a CASE statement over a series of IF-ELSE statements?
پاسخ دهید(B)
CASE statements are more readable when dealing with multiple conditions.
3
What is an advantage of using functions in a program?
پاسخ دهید(B)
They allow code reusability.
4
Which of the following is NOT a common characteristic of an IDE?
5
What is the exponentiation operator in most programming languages (as per the examples)?
6
In the context of the table of counting operations, what is the purpose of the statement: `NumberOfSacks = NumberOfSacks + 1`?
پاسخ دهید(C)
To increase the count of sacks by one.
7
What will be the output for the following pseudocode?
`Total = 10
Total = Total + 5
Output Total`
8
Which type of data would be used to store decimal values?
9
What does the `FOR` loop facilitate in the pseudo-code examples?
پاسخ دهید(B)
Iterates through a set of students.
10
What is a key benefit of writing modular code (using procedures and functions)?
پاسخ دهید(D)
It reduces code duplication and improves reusability.
11
What is meant by a 'maintainable' program?
پاسخ دهید(B)
A program that is easily understood, modified, and updated.
12
What is the key characteristic of a post-condition loop?
پاسخ دهید(B)
The loop body is guaranteed to execute at least once.
13
What is a key benefit of using nested selection statements?
پاسخ دهید(B)
It enables the implementation of more complex logic.
14
Which string method is used to find the number of characters in a string?
15
What is a compiler's main task?
پاسخ دهید(B)
To translate source code into machine code.
16
Which of the following is used to store multiple data items in an array?
پاسخ دهید(D)
Elements with the same data type
17
Within a FOR loop, what dictates the number of times the code inside the loop will execute?
پاسخ دهید(B)
The condition specified by the start value, end value, and step.
18
What is the primary purpose of file handling in programming?
پاسخ دهید(B)
To store data permanently.
19
In the provided pseudo-code, which construct is used to repeat a block of code a specific number of times?
20
What is the term that is often used to define a code block?
21
What does the concept of "sequence" represent in programming?
پاسخ دهید(A)
The order of steps in an algorithm
22
Which of the following is used to denote 'greater than or equal to' in many programming languages?
23
In what kind of loop is the condition checked *before* any of the loop's code is executed?
24
Which string handling method is used to convert a string to lowercase?
25
In a program, what is an example of an output statement?
26
In a `FOR` loop, what is usually defined at the start?
پاسخ دهید(C)
The initial value of a counter.
27
What does `myFile.close()` do in the Python example?
28
In the `Worked Example`, which part of the code would be executed repeatedly for each student?
29
Which method is typically used to change all characters in a string to lowercase?
30
If we have two conditions, A and B, which logical operator returns TRUE only when *both* A and B are TRUE?
31
What is the purpose of the Step value in a FOR loop, such as `For number = 10 to 50 Step 5`?
پاسخ دهید(C)
To determine the increment or decrement for each iteration.
32
When you open a file in 'r+' mode (read and write), what happens?
پاسخ دهید(B)
The file is opened for reading and writing, starting from the beginning.
33
What would typically be required when defining a function?
34
Which of the following is a characteristic of a variable in a computer program?
پاسخ دهید(B)
Its value can change during the execution of the program.
35
What is the role of comments in programming code?
پاسخ دهید(B)
To provide information and explanations for human readers.
36
In the pseudocode, what is the primary purpose of the line: `TOTAL = 0`?
پاسخ دهید(C)
To initialize the 'TOTAL' variable to zero.
37
What does the keyword `DECLARE` signify in the given code examples?
پاسخ دهید(A)
A variable is being defined.
38
What is the range of valid index values in an array in most programming languages?
پاسخ دهید(C)
From 0 to the number of elements in the array - 1.
39
What is the purpose of a 'FOR' loop when populating arrays?
پاسخ دهید(C)
To iterate through the elements of the array and assign values.
40
In the context of programming, what does "TotalWeight = TotalWeight + Weight" represent?
پاسخ دهید(B)
Adding the current value of TotalWeight and the value of Weight and assigning the result to TotalWeight.
41
What is the function of the 'Substring' method?
پاسخ دهید(B)
To extract part of a string.
42
What statement in pseudocode can be used to get input from the user?
43
What is the primary function of the `RETURN` statement inside of a function?
پاسخ دهید(B)
To specify the value to be returned.
44
What is the usual behavior of a CASE statement if there's no matching case and no ELSE (or default) clause?
پاسخ دهید(C)
The program continues with the next statement after the CASE block.
45
Which operation is performed by the following in the given example: `Calculate Number1 + Number2 + Number3 + Number4 + Number5;`?
46
What is the primary purpose of the programming language that the school has chosen to use?
47
In most programming languages, what typically signifies the end of a multi-line comment?
48
What is the primary function of the 'try' and 'catch' blocks?
پاسخ دهید(B)
To handle potential errors (exceptions) in a program.
49
If a variable is declared inside a function, what scope does it have?
50
What does the "Step 5" part of the `For` loop control in the given example: `For number to 10 to 50 Step 5`?
پاسخ دهید(C)
The increment value for each iteration.