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

  • 1
    What is meant by the term 'scope' in the context of programming variables?
    Respondre
    (B)
    The part of the code where a variable is visible and can be used.
  • 2
    What is the purpose of the `//` operator in Python?
    Respondre
    (C)
    Floor division (integer division)
  • 3
    What is the result of the following code: `print 10 != 5`
    Respondre
    (A)
    True
  • 4
    Which component of the computer is responsible for processing the data?
    Respondre
    (B)
    CPU
  • 5
    What do the operators AND, OR, and NOT primarily manipulate?
    Respondre
    (C)
    Boolean values
  • 6
    Which programming language uses a .java file extension?
    Respondre
    (B)
    Java
  • 7
    Which control structure is used to execute a block of code multiple times?
    Respondre
    (C)
    Loop
  • 8
    What does the term 'concatenation' mean in the context of string handling?
    Respondre
    (B)
    Combining two or more strings together.
  • 9
    Which of the following is a common type of loop used in programming?
    Respondre
    (B)
    FOR
  • 10
    What is the role of the "CPU" in a computer system?
    Respondre
    (B)
    To execute instructions and perform calculations.
  • 11
    What is the role of the `DIV` function?
    Respondre
    (B)
    To divide two numbers and return the whole number portion of the result.
  • 12
    In which programming environment would you write your code to be able to execute?
    Respondre
    (A)
    IDE
  • 13
    What does the term 'variable declaration' mean?
    Respondre
    (C)
    Creating a variable and specifying its type.
  • 14
    Which statement most accurately describes the difference between a procedure and a function?
    Respondre
    (A)
    Procedures can't return values; functions always return values.
  • 15
    In a Java program, where does the program start executing?
    Respondre
    (B)
    In the main method
  • 16
    What is the main difference between a local and a global variable?
    Respondre
    (C)
    Local variables are declared inside a function, and global variables are declared outside any function.
  • 17
    When designing an algorithm, what should you consider first?
    Respondre
    (B)
    The desired output and the steps needed to achieve it.
  • 18
    Which of the following is a characteristic of a good algorithm?
    Respondre
    (B)
    It should be efficient and produce the correct output.
  • 19
    What is the output of `print(10 // 3)`?
    Respondre
    (B)
    3
  • 20
    Which of the following are considered string handling methods?
    Respondre
    A
    B
  • 21
    What is the primary advantage of using nested loops in programming?
    Respondre
    (B)
    To repeat a set of instructions multiple times for different levels of iteration.
  • 22
    In file handling, what is the purpose of closing a file?
    Respondre
    (C)
    To release system resources.
  • 23
    Which of these is an example of a valid variable assignment in Python?
    Respondre
    (B)
    name = "John"
  • 24
    What is a benefit of using a high-level programming language over a low-level programming language?
    Respondre
    (C)
    Easier to write and understand.
  • 25
    What data type would be used to store the value 'True' or 'False'?
    Respondre
    (C)
    Boolean
  • 26
    What is the main purpose of comments in programming?
    Respondre
    (B)
    To provide explanations about the code.
  • 27
    How can you make your program easier to modify and update (more maintainable)?
    Respondre
    (B)
    By using meaningful variable names and comments.
  • 28
    In a program dealing with student data, what is the likely purpose of a constant declared as `MAX_SUBJECTS`?
    Respondre
    (B)
    To define the maximum number of subjects a student can take.
  • 29
    Why is modular programming beneficial?
    Respondre
    (C)
    It helps with code reuse and makes code easier to manage.
  • 30
    In the example given (total and counting), what data structure is being used?
    Respondre
    (B)
    Variables
  • 31
    What is the purpose of the `FOR` loop in the context of student and subject marks?
    Respondre
    (C)
    To iterate through a specified number of subjects or students.
  • 32
    What is an 'operand' in a programming context?
    Respondre
    (B)
    A variable or value that an operator acts upon.
  • 33
    Which data type is used to represent text in programming?
    Respondre
    (C)
    String
  • 34
    In a one-dimensional array, what typically represents the first element's index in most programming languages?
    Respondre
    (C)
    0
  • 35
    Which data type is most suitable for storing the number of hours worked?
    Respondre
    (D)
    INTEGER
  • 36
    Which programming concept is used to repeatedly execute a block of code?
    Respondre
    (C)
    Iteration
  • 37
    If you want to find the largest value in a set of numbers, what programming construct would you use?
    Respondre
    (A)
    A loop combined with a conditional statement.
  • 38
    What distinguishes local variables from global variables?
    Respondre
    (C)
    Local variables are only accessible within the block (e.g., function) where they are declared; global variables can be accessed throughout the program.
  • 39
    What is the purpose of the `OR` operator in a conditional statement?
    Respondre
    (B)
    To execute code if at least one condition is true.
  • 40
    What does a conditional statement (e.g., `IF-THEN-ELSE`) primarily do?
    Respondre
    (C)
    Execute code based on a specific condition.
  • 41
    What does DRY stand for in programming principles?
    Respondre
    (A)
    Don't Repeat Yourself
  • 42
    What is the role of the `break` statement inside a loop?
    Respondre
    (B)
    To stop the execution of the loop.
  • 43
    What does the `OUTPUT` statement typically require?
    Respondre
    (B)
    A variable or expression to display.
  • 44
    If you wanted to convert the string "hello" to uppercase, what string handling method would you use?
    Respondre
    (C)
    ToUpper()
  • 45
    When declaring an array, what determines the maximum number of elements it can hold?
    Respondre
    (C)
    The specified size or bounds of the array
  • 46
    Which data type is the most suitable for storing someone's age?
    Respondre
    (D)
    INTEGER
  • 47
    In which programming language can you find the `CASE` statement?
    Respondre
    (D)
    All languages that support Selection
  • 48
    Which structure is used to execute a piece of code repeatedly?
    Respondre
    (C)
    A loop.
  • 49
    What is the first line in Python code output?
    Respondre
    (C)
    print ('Hello World')
  • 50
    Which data type would you use to represent a true or false value in programming?
    Respondre
    (C)
    Boolean