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

  • 1
    What type of programming statements allows the program to execute different blocks of code based on certain conditions?
    Respondre
    (C)
    Selection statements
  • 2
    Which of the following is NOT a characteristic of a function in the context of the given material?
    Respondre
    (D)
    A function can't have parameters.
  • 3
    Which of the following is NOT a string handling method?
    Respondre
    (D)
    Multiply
  • 4
    What is the purpose of the line: `ClassHigh = 0` in the beginning of the provided code example?
    Respondre
    (A)
    To initialize the variable ClassHigh.
  • 5
    Which of the following are examples of standard library routines, based on the text?
    Respondre
    A
    B
  • 6
    What is a characteristic of a pre-condition loop?
    Respondre
    (C)
    The condition is checked *before* each iteration.
  • 7
    If the function is defined with parameters, what should the call match?
    Respondre
    (A)
    Argument should match parameters.
  • 8
    Which of the following data types can store true or false values?
    Respondre
    (C)
    Boolean
  • 9
    What does the pseudocode example `INPUT myText;` do?
    Respondre
    (C)
    Takes input from the user and stores it in a variable called 'myText'.
  • 10
    Based on the image, arrays can be:
    Respondre
    A
    B
  • 11
    How do you call a procedure or function with parameters?
    Respondre
    A
    B
    C
  • 12
    Which of these are important features when writing a file?
    Respondre
    A
    C
    D
  • 13
    What are the main components usually found in a "For" loop structure?
    Respondre
    A
    B
    C
  • 14
    What does the acronym 'IDE' stand for?
    Respondre
    (B)
    Integrated Development Environment
  • 15
    What should you consider when a procedure has parameters?
    Respondre
    (B)
    The argument should match the parameters.
  • 16
    What is the function of a 'FOR' loop in programming?
    Respondre
    (A)
    To execute a block of code repeatedly a specific number of times.
  • 17
    What is the primary purpose of nesting selection statements (e.g., an IF statement inside another IF statement)?
    Respondre
    (C)
    To enable the implementation of complex conditional logic.
  • 18
    Which of the following is an example of an input statement?
    Respondre
    (C)
    input("Enter a number:")
  • 19
    What is the main function of the `output` statement in the code examples?
    Respondre
    (C)
    To display results to the user.
  • 20
    What is the purpose of the `CLOSEFILE` statement in file handling?
    Respondre
    (C)
    To close the connection to the file.
  • 21
    What is a common use case for the 'try...catch' block?
    Respondre
    (B)
    To handle potential errors during file operations
  • 22
    Which of the following tasks is NOT typically performed by standard library routines (as discussed in the text)?
    Respondre
    (C)
    Defining the program's variables.
  • 23
    What is a fundamental concept in the context of creating a maintainable program?
    Respondre
    (B)
    Using meaningful identifier names.
  • 24
    Which type of statement enables a program to make decisions based on the evaluation of an expression?
    Respondre
    (C)
    Selection statement
  • 25
    In the provided Java code, what is the purpose of `try...catch` blocks?
    Respondre
    (B)
    To handle potential errors during file operations
  • 26
    What type of programming structure is characterized by loops that have at least one iteration?
    Respondre
    (C)
    Post-condition loops.
  • 27
    What operation is being performed by the code `NumberOfSacks = NumberOfSacks + 1;` (Counting)?
    Respondre
    (C)
    Incrementing the value of NumberOfSacks.
  • 28
    What type of loop always has at least one iteration?
    Respondre
    (C)
    Do-While loop
  • 29
    Which of the following is used to store a single character?
    Respondre
    (C)
    Char
  • 30
    What is the function of a file object?
    Respondre
    (B)
    To represent the file and provide methods for interacting with it.
  • 31
    Which logical operator would be used to combine the conditions 'A is true' and 'B is true' to only execute the consequent statements?
    Respondre
    (B)
    AND
  • 32
    What does the term 'bug' refer to in the context of programming?
    Respondre
    (B)
    An error or defect in a program.
  • 33
    What happens if there is a nesting of selection statements (IF-ELSE inside another IF-ELSE)?
    Respondre
    (C)
    It can create more complex decision-making logic.
  • 34
    When a function is defined, what will always be defined as the first statements to be defined?
    Respondre
    (D)
    The name of the function or procedure
  • 35
    What is the purpose of an algorithm?
    Respondre
    (B)
    To provide step-by-step instructions for solving a problem.
  • 36
    In the Totaling example (TotalWeight = TotalWeight + Weight), what does 'Weight' represent?
    Respondre
    (B)
    The amount to be added to the total weight.
  • 37
    Which statements are correct about nested statements?
    Respondre
    A
    C
  • 38
    Which string handling method is used to find the number of characters in a string?
    Respondre
    (B)
    Length
  • 39
    In the context of a program, what does 'iteration' refer to?
    Respondre
    (B)
    The process of repeating a set of instructions.
  • 40
    What is the purpose of the `OPENFILE` command in pseudocode for file handling?
    Respondre
    (C)
    To establish a connection with the file.
  • 41
    Which operator is used to get the remainder in division?
    Respondre
    (C)
    %
  • 42
    What is the primary function of selection statements in programming?
    Respondre
    (C)
    To make decisions and control program flow based on conditions.
  • 43
    What data type would be most appropriate for storing a student's grade (e.g., A, B, C)?
    Respondre
    (C)
    STRING
  • 44
    What operation does the following line of pseudo-code perform? `studentAverage = studentTotal / numOfSubjects`
    Respondre
    (B)
    Calculates the average mark of a student.
  • 45
    What does the inner loop of the program, as described in the 'Worked Example,' primarily calculate?
    Respondre
    (C)
    The total marks for each student.
  • 46
    In the code examples, which language uses `dim` and `console.writeline`?
    Respondre
    (B)
    Visual Basic
  • 47
    In Java, what is used to create an object for writing into a file?
    Respondre
    (C)
    FileWriter
  • 48
    What kind of loop is used for iteration in the examples given?
    Respondre
    (A)
    FOR...NEXT loop
  • 49
    What will be the output when `age` is 20, given the following code? ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
    Respondre
    (B)
    You are an adult
  • 50
    Which loop structure is known for checking the condition at the *end* of the loop?
    Respondre
    (B)
    Post-condition loop