Computer Science for IGCSE & O level - Programming (Section 5)
1
What does the term 'algorithm' refer to in the context of programming?
إجابة(B)
A set of instructions to solve a problem.
2
Which of the following is an example of an 'assignment' statement in programming?
3
What are the main components to consider when writing an algorithm?
إجابة(C)
Input, process, and output.
4
What does it mean when a procedure call must match the procedure definition?
5
In the given context, what would be the result of the following pseudocode: x = 5; y = 2; OUTPUT x + y;
6
What would the Java code 'System.out.println("Hello World");' do?
إجابة(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?
8
In the context of the programming, what does 'debugging' refer to?
إجابة(B)
Finding and fixing errors in the program
9
Which of the following are examples of basic data types in programming?
10
What does the term "variable scope" refer to in programming?
إجابة(B)
The area of the code where a variable is accessible.
11
What is the primary function of a "module" in a programming context?
إجابة(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)?
إجابة(B)
It always returns a value.
13
Which statement is the appropriate way to iterate over the elements of an array?
14
What are some examples of high-level programming languages?
15
Which of the following statements about functions and procedures is true?
إجابة(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?
17
Which of the following is a function of a 'compiler'?
إجابة(B)
To translate code into machine language.
18
Which of the following is NOT a concept within the text?
19
What is the purpose of an algorithm in programming?
إجابة(B)
To solve a problem through a series of steps.
20
In a `CASE` statement, what determines which code block will be executed?
إجابة(B)
The value of a controlling expression.
21
What is the result of the code: `Console.WriteLine("Enter a value")`?
إجابة(A)
The program displays "Enter a value" on the console.
22
What would be the output of the code: `PRINT "Hello" + "World"`?
23
Which of the following is a characteristic of a post-condition loop?
إجابة(B)
The loop body is always executed at least once.
24
What is the primary use of comments in code?
إجابة(B)
To explain the code to human readers.
25
Which keyword is used to import a module in Python?
26
What is the primary purpose of a function in programming?
إجابة(B)
To organize code into reusable blocks.
27
What is the purpose of the 'FOR' loop in programming?
إجابة(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?
إجابة(B)
Average = Total / Counter
29
What does the `//` operator do in Python?
30
What does the term 'syntax' refer to in programming?
إجابة(B)
The structure and grammar rules of the code.
31
What does the `NOT` operator do?
إجابة(B)
It reverses the truth value of an expression.
32
What is the correct order of operations (PEMDAS/BODMAS) in most programming languages?
إجابة(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?
34
What is the primary goal of code refactoring?
إجابة(C)
To improve the code's structure and readability without changing its behavior.
35
What is the purpose of a 'string' data type?
إجابة(B)
To store sequences of characters or text.
36
What type of variable is used in a 'Hello World' program?
37
What are the required steps involved to write a 'Hello World' program?
38
What is 'selection' in the context of programming?
إجابة(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?
إجابة(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?
41
What will `"Hello" + " " + "World"` evaluate to?
42
What is the primary function of the `RETURN` statement in a function?
إجابة(C)
To send a value back from the function.
43
What programming construct is used to repeat a set of instructions?
44
What should be done before starting the program in the Java code?
إجابة(C)
Declare variables and import the packages
45
Which operator is used for integer division?
46
Which of the following is a selection structure mentioned in the text?
47
What is the basic data type used for a single character?
48
Which data type would be most suitable for representing a price that might contain decimal places?
49
How does using meaningful identifiers (variable names, function names) benefit code maintenance?
إجابة(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?
إجابة(C)
Fast and easy access to data.