Computer Science for IGCSE & O level - Programming (Section 8)
1
What does the acronym "IDE" stand for?
Answer(A)
Integrated Development Environment
2
What is the purpose of a comment in a programming language?
Answer(B)
To provide explanations and notes within the code.
3
Which operator will give you the quotient when two numbers are divided?
4
What will the following code print? `print "Hello"[1]`
5
How does using clear identifier names help improve code quality?
Answer(C)
It makes the code more readable and easier to maintain.
6
Which statement will output the sum of two numbers?
Answer(A)
Calculate Number1 + Number2
7
What is the role of an `AND` operator in a conditional statement?
Answer(B)
It executes code only if all conditions are true.
8
In pseudocode, what is the common keyword used for selection?
9
What is the primary purpose of a loop in programming?
Answer(B)
To execute a block of code repeatedly.
10
Which of the following are common components of a function's definition?
11
What data type is the best choice for storing a person's age?
12
What is the term for a step-by-step procedure for solving a problem?
13
What does a `CASE` statement do?
Answer(D)
It performs different actions based on the value of a variable.
14
What does the term 'algorithm' refer to in computer science?
Answer(B)
A set of instructions to solve a problem.
15
What is the function of 'input' in the context of programming?
Answer(A)
To get information from the user.
16
Which concept is demonstrated by using the 'IF' statement in a program?
17
What will this code print? `print "Hello".length()` (Assuming a language where length is a method of strings)
18
Which of the following is NOT a data type?
19
Which data type is the best fit for representing a person's height?
20
What is the primary purpose of an `IF` statement in a programming language?
Answer(C)
To execute a block of code conditionally.
21
In most programming languages, what does `!=` represent?
22
In Python, what will be the output of `print(15 % 4)`?
23
Which is the core feature that differentiates a function from a procedure?
Answer(B)
Functions always return a value.
24
What is the purpose of code testing?
Answer(C)
To check for and fix any errors (bugs).
25
Which operator is used to check equality?
26
What is the purpose of an `IF...ELSE IF...ELSE` statement?
Answer(B)
To check for multiple conditions and execute different code blocks based on which condition is met.
27
What is the keyword used in Python to define a function?
28
How does the use of procedures improve the structure of a program?
Answer(C)
By breaking a larger task into smaller, manageable units.
29
Which programming practice significantly enhances the organization and reusability of code?
Answer(C)
Employing modular design principles.
30
What does an 'operator' do in a programming context?
Answer(B)
Performs an action on operands.
31
What will be the result of "cat" < "dog" in most programming languages?
32
What is code testing primarily used for?
Answer(B)
To identify and fix errors.
33
What is the purpose of an 'input' statement in a program?
Answer(B)
To receive data from the user.
34
What does modular programming emphasize?
Answer(B)
Creating smaller, reusable blocks of code.
35
When using an `IF-ELSE` statement, what does the `ELSE` block contain?
Answer(A)
Code to be executed if the `IF` condition is false.
36
When should you use a conditional statement (e.g., `IF` statement)?
Answer(B)
To execute different code blocks based on a condition.
37
What is the function of the `Substring` method?
Answer(C)
To extract a portion of a string.
38
Which operator is used to perform an assignment?
39
What does 'compiling' a program mean?
Answer(B)
Translating source code into machine code.
40
How is the `RANDOM` routine typically used?
Answer(A)
To generate a random number.
41
What will be the output from the code below?
`IF age >= 18 THEN
PRINT "You are an adult"
ENDIF`
42
Which of the following is an example of a valid loop in Python?
43
Which type of code contains only one single value?
44
What is the purpose of the `OUTPUT` statement in pseudo-code?
Answer(B)
To display information to the user.
45
What is the main difference between a compiler and an interpreter?
Answer(B)
A compiler translates the entire code at once, while an interpreter translates code line by line.
46
In a programming context, what is a 'function'?
Answer(A)
A named block of code that performs a specific task.
47
What does the 'print' function usually do?
Answer(B)
Displays information on the screen.
48
What is the difference between '==' and '=' in programming?
Answer(C)
'==' is for comparison, '=' is for assignment.
49
What do you use when storing numbers with fractions or decimals?
50
Which concept is being implemented in a program when a conditional statement is employed?