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

  • 1
    What do parameters do in functions or procedures?
    Antwort
    (B)
    They receive data passed into the function or procedure.
  • 2
    In the context of file handling, what does 'WRITE' typically signify?
    Antwort
    (D)
    Write data into a file.
  • 3
    What is the primary purpose of storing data in a file?
    Antwort
    (B)
    To store data persistently for later use.
  • 4
    Which statement is used to select one option out of multiple options?
    Antwort
    (C)
    CASE statement
  • 5
    What is the name for a named storage location in a computer's memory?
    Antwort
    (B)
    Variable
  • 6
    What is the result of this comparison: `5 <= 5`?
    Antwort
    (A)
    True
  • 7
    What is a common characteristic of a well-designed algorithm?
    Antwort
    (C)
    It should be efficient and solve the problem correctly.
  • 8
    What is the benefit of using comments in code?
    Antwort
    A
    B
  • 9
    What is the purpose of the `ELSE` statement in an `IF` statement?
    Antwort
    (B)
    To specify the actions to be taken if the `IF` condition is false.
  • 10
    Which of the following are important aspects when writing a file?
    Antwort
    A
    B
    C
  • 11
    What is the primary function of a loop in programming?
    Antwort
    (B)
    To execute a block of code repeatedly.
  • 12
    If you wanted to store the ages of students and their corresponding grades in an organized format, what type of structure would you use?
    Antwort
    (C)
    A two-dimensional array.
  • 13
    If `Value1 = MOD(20, 3)`, what is the value of `Value1`?
    Antwort
    (D)
    2
  • 14
    What is the result of the following operation: 10 % 3?
    Antwort
    (A)
    1
  • 15
    What is the primary difference between an `INTEGER` and a `REAL` data type?
    Antwort
    (B)
    INTEGER stores whole numbers, REAL stores numbers with decimal points.
  • 16
    In the context of programming, what is a variable?
    Antwort
    (B)
    A named data store that holds a value that can change.
  • 17
    Which statement is used in programming to execute a block of code multiple times?
    Antwort
    (D)
    FOR, WHILE
  • 18
    What is the purpose of a 'loop' in programming?
    Antwort
    (B)
    To execute a block of code repeatedly.
  • 19
    What is the role of comments in a program?
    Antwort
    (C)
    To explain the code to humans.
  • 20
    Which data type is most suitable for storing True/False values?
    Antwort
    (C)
    Boolean
  • 21
    What is a step-by-step set of instructions used for solving a problem?
    Antwort
    (C)
    An algorithm.
  • 22
    What does the term "iteration" primarily refer to in programming?
    Antwort
    (B)
    The repetition of a set of instructions
  • 23
    Why is it important to use clear and meaningful identifiers (variable names, function names, etc.)?
    Antwort
    (C)
    To improve the code's readability and maintainability.
  • 24
    Which of the following statements represents an input operation?
    Antwort
    (B)
    name = input()
  • 25
    What is the purpose of a 'comment' in a program?
    Antwort
    (B)
    To provide an explanation or description of the code.
  • 26
    Which of the following best describes the purpose of comments in code?
    Antwort
    (C)
    To provide documentation for the code.
  • 27
    Which of the following is a characteristic of high-level programming languages?
    Antwort
    B
    C
  • 28
    What does an IDE primarily offer to programmers?
    Antwort
    A
    B
    C
  • 29
    What would be an appropriate data type to store a person's name?
    Antwort
    (C)
    String
  • 30
    Which statement represents a logical decision in a program?
    Antwort
    (C)
    IF x > 10 THEN
  • 31
    Which of these elements can be found in a procedure definition?
    Antwort
    A
    B
    D
  • 32
    In the context of arrays, what does the term "index" refer to?
    Antwort
    (C)
    The position of each element within the array.
  • 33
    What keyword is commonly used to start a comment in Python, based on the provided examples?
    Antwort
    (C)
    #
  • 34
    Which string method is used to find the number of characters in a string?
    Antwort
    (A)
    Length
  • 35
    What is the role of the `NumOfSubjects` constant in the code?
    Antwort
    (C)
    To set a fixed value for a number of subjects.
  • 36
    What is the process of finding and fixing errors in a program called?
    Antwort
    (B)
    Debugging
  • 37
    What are the key components of a standard programming environment?
    Antwort
    (A)
    Text editor, compiler, and debugger
  • 38
    If the 'age' input is 20, what output will the following code produce? ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
    Antwort
    (B)
    You are an adult
  • 39
    What does the MOD function calculate in programming?
    Antwort
    (C)
    The remainder of a division.
  • 40
    What is a key benefit of using nested statements (e.g., an IF statement inside another IF statement)?
    Antwort
    (C)
    It allows for more complex and detailed logic.
  • 41
    What does the following Python code do? `myFile = open('myText.txt', 'r')`
    Antwort
    (B)
    Opens a file named 'myText.txt' for reading.
  • 42
    Which string method can be used to find the location of a certain character in a string?
    Antwort
    (C)
    Find
  • 43
    Which is true about nesting selection statements?
    Antwort
    (B)
    It can enhance code's modularity and structure.
  • 44
    What is the purpose of the 'length' string function?
    Antwort
    (B)
    To return the number of characters in a string.
  • 45
    What is a key characteristic of a procedure, as described in the provided text?
    Antwort
    (C)
    It is a set of programming statements grouped together under a single name.
  • 46
    What is a 'subroutine' also known as?
    Antwort
    (C)
    Function or Procedure
  • 47
    What is the objective of the 'Worked example' at the beginning of the document?
    Antwort
    (B)
    To calculate and output statistics for a class of students.
  • 48
    Which character is typically used as the multiplication operator?
    Antwort
    (B)
    *
  • 49
    In the pseudocode example for writing to a file, which command is used to write a line of text?
    Antwort
    (B)
    WRITEFILE
  • 50
    What will `myFile.read()` do in Python?
    Antwort
    (A)
    Reads the whole file