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

  • 1
    Which of the following are typical components of a file handling process?
    پاسخ دهید
    A
    B
    C
  • 2
    What does the `import java.io.File` statement do in Java?
    پاسخ دهید
    (A)
    Imports the file class
  • 3
    What happens if you attempt to read from a file that hasn't been opened first?
    پاسخ دهید
    (C)
    An error will likely occur.
  • 4
    Based on the information given, a one-dimensional array can also be referred to as:
    پاسخ دهید
    (B)
    A list
  • 5
    Which operator is typically used to represent 'not equal to' in most programming languages?
    پاسخ دهید
    (A)
    !=
  • 6
    Which of the following components are crucial for the file handling procedure?
    پاسخ دهید
    B
    C
    D
  • 7
    Which of the following statements is true about file storage?
    پاسخ دهید
    B
    C
    D
  • 8
    Which of the following best describes a global variable?
    پاسخ دهید
    (B)
    It can be used by any part of the program.
  • 9
    What does the `READFILE` statement in the pseudocode signify in the context of file handling?
    پاسخ دهید
    (C)
    Reads a line from the file.
  • 10
    Which of the following are common data types used in programming?
    پاسخ دهید
    A
    B
    C
    D
  • 11
    What does DRY stand for in programming principles?
    پاسخ دهید
    (A)
    Don't Repeat Yourself
  • 12
    Which of the following is a purpose of comments in the program?
    پاسخ دهید
    (B)
    They help in code readability.
  • 13
    In the pseudocode, what does the line `AVERAGE = TOTAL / COUNTER` calculate?
    پاسخ دهید
    (C)
    The average of the marks.
  • 14
    What is the correct keyword for declaring a constant?
    پاسخ دهید
    (C)
    CONST
  • 15
    What does the program compute after the completion of the outer loop? (FOR Student = 1 TO NumOfStudents)
    پاسخ دهید
    (D)
    All of the above
  • 16
    Which of the following are important aspects of code readability?
    پاسخ دهید
    A
    B
    C
  • 17
    Which logical operator would result in TRUE only if *both* operands are TRUE?
    پاسخ دهید
    (B)
    AND
  • 18
    If the value of 'age' is 10 and the following code executes, what will be printed? ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
    پاسخ دهید
    (A)
    You are a child
  • 19
    What is the result if a CASE statement has no matching case, and no default (or ELSE) clause?
    پاسخ دهید
    (C)
    The program continues execution after the CASE block.
  • 20
    Which of the following is considered a control structure?
    پاسخ دهید
    (C)
    Loops
  • 21
    What does the `Uppercase` method usually do in string manipulation?
    پاسخ دهید
    (C)
    Convert a string to uppercase.
  • 22
    What does the term 'scope' refer to in programming?
    پاسخ دهید
    (C)
    The part of the program where a variable is accessible.
  • 23
    What is typically required before writing to a file in most programming languages?
    پاسخ دهید
    (B)
    Opening the file in write mode
  • 24
    What is the purpose of comments in programming?
    پاسخ دهید
    (B)
    To improve code readability and explain the code.
  • 25
    In the pseudocode example, the variable 'COUNTER' is incremented in each iteration. What is the role of COUNTER?
    پاسخ دهید
    (C)
    To count the number of marks entered.
  • 26
    What will be calculated by the inner loop, for each student, during the nested loop structure?
    پاسخ دهید
    (C)
    The sum of all the marks obtained in all subjects.
  • 27
    What would be the appropriate data type for the variable used to store a student's name?
    پاسخ دهید
    (C)
    STRING
  • 28
    What is one of the first steps involved in writing to a file?
    پاسخ دهید
    (C)
    Opening the file.
  • 29
    What does the 'a' mode stand for when opening a file?
    پاسخ دهید
    (C)
    Append mode
  • 30
    What is the purpose of comments in a program?
    پاسخ دهید
    (C)
    To explain the code to humans.
  • 31
    What is the purpose of an algorithm?
    پاسخ دهید
    (B)
    To provide a set of instructions to solve a problem.
  • 32
    What is a procedure also known as?
    پاسخ دهید
    (C)
    A subroutine
  • 33
    What operation is performed by the statement `myFile.write('Hello')` in a Python example?
    پاسخ دهید
    (B)
    Writing 'Hello' to the file
  • 34
    What does the term 'index' refer to within an array?
    پاسخ دهید
    (C)
    The position of an element within the array
  • 35
    What does the `open()` function typically return when successful?
    پاسخ دهید
    (C)
    A file object
  • 36
    What does `myFile.readline()` do in Python?
    پاسخ دهید
    (B)
    Reads a line from the file
  • 37
    What is the function of the `Lowercase` method in string handling?
    پاسخ دهید
    (C)
    To convert a string to lowercase.
  • 38
    In the provided code, what is the purpose of initializing `ClassHigh` to 0?
    پاسخ دهید
    (C)
    To set the starting value for comparing with student marks.
  • 39
    What does a "For" loop usually require?
    پاسخ دهید
    (A)
    A start value, an end value, and an increment/decrement.
  • 40
    What is the purpose of `Input` in the pseudo code?
    پاسخ دهید
    (B)
    Takes the input from the user.
  • 41
    Which programming construct allows a program to repeat a block of code until a certain condition is met?
    پاسخ دهید
    (B)
    Iteration statement
  • 42
    Which of the following is NOT a typical action when working with a file?
    پاسخ دهید
    (D)
    Sorting
  • 43
    In a nested IF-ELSE structure, how are the inner blocks of code related to the outer structure?
    پاسخ دهید
    (B)
    The execution of the inner block depends on the condition of the outer block.
  • 44
    Which of the following are good practices when working with files?
    پاسخ دهید
    A
    C
  • 45
    What is the advantage of using meaningful identifiers for variables?
    پاسخ دهید
    (B)
    Improves code readability and understanding.
  • 46
    Which type of loop is characterized by the condition being evaluated *after* the loop body executes?
    پاسخ دهید
    (B)
    Post-condition loop
  • 47
    Which part of the program is executed based on the value of 'answer' in the case statement?
    پاسخ دهید
    (B)
    The code block associated with the matching case.
  • 48
    What does the '%' operator represent in many programming languages?
    پاسخ دهید
    (C)
    Modulo (remainder)
  • 49
    What is the primary benefit of the 'modular' approach to programming (using procedures and functions)?
    پاسخ دهید
    (D)
    It enhances reusability and reduces code duplication.
  • 50
    Which is a characteristic of a post-condition loop?
    پاسخ دهید
    (B)
    The condition is checked *after* the loop body.