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

  • 1
    In the provided pseudocode, the loop continues until `Finish` equals what value?
    Svare
    (C)
    300
  • 2
    In the given example, which statements are logical operators?
    Svare
    A
    B
    D
  • 3
    In the context of the provided examples, what does the keyword 'RETURN' typically do in a function?
    Svare
    (D)
    It specifies the value to be returned by the function.
  • 4
    Which of these methods is used for extracting a part of the string?
    Svare
    (B)
    Substring
  • 5
    If age is 16, what output will the following code produce? ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
    Svare
    (B)
    You are a child
  • 6
    What is the relationship between outer and inner selection blocks in a nested statement structure?
    Svare
    (B)
    The inner block executes only if the outer block's condition is met.
  • 7
    Which of the following are valid examples of a 'Float' data type?
    Svare
    A
    D
  • 8
    Which of the following best describes the main goal of code optimization?
    Svare
    (C)
    To improve the code's performance.
  • 9
    In which type of loop is the condition checked *before* the loop body is executed?
    Svare
    (B)
    Pre-condition loop
  • 10
    Which statement best describes the role of an IDE (Integrated Development Environment) in the programming process?
    Svare
    (B)
    It provides a platform for writing, testing, and debugging code.
  • 11
    Which statement is correct about nested loops and nested selection statements?
    Svare
    (C)
    Both selection and iteration statements can be nested.
  • 12
    What is the primary function of the 'length' string method?
    Svare
    (B)
    To determine the number of characters in the string.
  • 13
    Which of the following programming concepts is described as 'the selection of a path through a program'?
    Svare
    (C)
    Selection
  • 14
    What is the purpose of the assignment operator (e.g., '=') in most programming languages?
    Svare
    (C)
    To assign a value to a variable.
  • 15
    In general, what is the benefit of using meaningful variable names?
    Svare
    (B)
    Improve code readability.
  • 16
    In Python, what is the primary purpose of the `print()` function?
    Svare
    (B)
    To display output on the console.
  • 17
    Which statement best describes what the CASE statement is used for?
    Svare
    (B)
    To execute a different block of code based on the value of a variable.
  • 18
    In a CASE statement, what happens if a match is found in the cases?
    Svare
    (B)
    The corresponding code block is executed.
  • 19
    What is the function of the `OUTPUT` statement in the context of the provided pseudo-code?
    Svare
    (C)
    To display information to the user.
  • 20
    If the age is 16, what is the output of the following code: ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
    Svare
    (A)
    You are a child
  • 21
    In the context of a two-dimensional array, what do the rows and columns help to do?
    Svare
    (C)
    Organize data
  • 22
    In the calculation example: `Calculate Number1 + Number2 * Number3;`, what operation will be performed first, according to the rules of precedence?
    Svare
    (B)
    Number2 * Number3
  • 23
    Which of the following statements are true about variables and constants?
    Svare
    A
    B
    C
  • 24
    Which of these is a valid arithmetic operator?
    Svare
    (C)
    ^
  • 25
    What is the primary function of a CASE statement in programming?
    Svare
    (A)
    To define multiple choices based on a single expression.
  • 26
    What does the modulo operator (%) compute?
    Svare
    (B)
    The remainder.
  • 27
    Which of the following are generally considered benefits of modular programming?
    Svare
    A
    B
    C
    D
  • 28
    What does the `//` notation typically signify in a programming language?
    Svare
    (C)
    A single-line comment
  • 29
    What is the purpose of the `NumOfStudents` variable?
    Svare
    (A)
    To store the number of students.
  • 30
    Which of the following concepts are fundamental constructs for developing a program?
    Svare
    A
    B
    C
    D
  • 31
    What does the 'length' method calculate for strings?
    Svare
    (A)
    The number of characters in the string.
  • 32
    In which of the following areas are programming skills most commonly used?
    Svare
    A
    B
    C
    D
  • 33
    What is the consequence of using nested selection statements?
    Svare
    (C)
    It lets you implement complex conditional logic.
  • 34
    In the context of the provided pseudocode, what is the purpose of the line "REPEAT ... UNTIL Finish = 300"?
    Svare
    (C)
    To implement an iteration or loop.
  • 35
    What is the primary purpose of the "Hello World" program in programming?
    Svare
    (C)
    To display an output message on the screen
  • 36
    If the condition in the IF statement evaluates to *false*, which block of code, if any, will be executed?
    Svare
    (C)
    The ELSE block (if present)
  • 37
    Which loop type always guarantees the loop body executes at least once?
    Svare
    (B)
    Post-condition loop
  • 38
    Which of the following is a benefit of using file handling in a program?
    Svare
    (B)
    Persistent storage of data
  • 39
    What is a pseudocode?
    Svare
    (C)
    An informal way to plan out a program.
  • 40
    Which logical operator is used to negate a condition (i.e., make it the opposite)?
    Svare
    (C)
    NOT
  • 41
    What action will take place when 'StudentHigh > ClassHigh' is true?
    Svare
    (A)
    ClassHigh = StudentHigh
  • 42
    Which data type is often used to represent text or a sequence of characters?
    Svare
    (C)
    String
  • 43
    Which programming structure enables you to control the order in which a set of statements is executed based on certain conditions?
    Svare
    (C)
    Selection statement
  • 44
    What does the modulo operator (%) calculate?
    Svare
    (B)
    The remainder of a division.
  • 45
    Which method is used to find the number of characters in a string?
    Svare
    (A)
    Length
  • 46
    In the given pseudo-code example, which of the following is used to change the values for testing?
    Svare
    (B)
    Constant values
  • 47
    What is the role of the `if` statement in a program?
    Svare
    (C)
    To execute code conditionally based on a condition.
  • 48
    What would be displayed if the following code segment was executed OUTPUT: myData[2]
    Svare
    (B)
    The value stored at the third position in the myData array.
  • 49
    What is the function of the 'Substring' method in string manipulation?
    Svare
    (B)
    Extract a part of a string
  • 50
    Which of the following is an example of exception handling?
    Svare
    (B)
    TRY and CATCH blocks