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

  • 1
    What does the program calculate in the first nested loop (FOR Subject = 1 TO NumOfSubjects)?
    回答
    (D)
    The sum of marks for a subject and average for the subject.
  • 2
    What are the common elements for a function definition?
    回答
    A
    B
    C
  • 3
    What does 'WRITE' do, in file handling as shown in pseudocode?
    回答
    (B)
    Writes a line of text to the file.
  • 4
    Which logical operator indicates 'both' conditions must be true for the result to be true?
    回答
    (B)
    AND
  • 5
    In the provided example of an IF-ELSE statement nested within another IF-ELSE, what's the relationship between the outer and inner blocks?
    回答
    (B)
    The inner block is executed based on the condition of the outer block.
  • 6
    What is the purpose of the constant declaration in the given examples?
    回答
    (B)
    To make the values unchangeable.
  • 7
    What does the '==' operator typically represent in programming?
    回答
    (B)
    Equality comparison
  • 8
    Which elements are commonly part of an algorithm?
    回答
    A
    B
    C
    D
  • 9
    In the examples given, which language uses `Console.WriteLine()`?
    回答
    (C)
    Visual Basic
  • 10
    What is the role of the 'Finish' variable in the given pseudocode example, specifically related to the "REPEAT ... UNTIL" loop?
    回答
    (B)
    To control the number of iterations.
  • 11
    In the Totaling example, what is the effect of `TotalWeight = TotalWeight + Weight;`?
    回答
    (C)
    Adds 'Weight' to 'TotalWeight' and stores the result in 'TotalWeight'.
  • 12
    What determines the number of times a "For" loop executes?
    回答
    (C)
    The range specified by the start, end, and step values.
  • 13
    What would be the outcome if the `answer` variable is given the value "*" in a case statement where cases are defined for '+', '-', '*' and '/', but no default case is available?
    回答
    (A)
    The code block corresponding to the '*' case would be executed.
  • 14
    In pseudo-code, what is the purpose of the statement `DECLARE`?
    回答
    (B)
    To define the data type of variables.
  • 15
    Based on the IF statement example, what will be the result if 'age' is 15?
    回答
    (D)
    No output will be generated.
  • 16
    In the pseudocode, what function is used to display something on the screen?
    回答
    (C)
    OUTPUT
  • 17
    What happens if the 'age' is 17 in the given code? ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ```
    回答
    (B)
    You are an adult
  • 18
    How do you know if a variable is a local variable?
    回答
    (A)
    It is declared within a procedure or function.
  • 19
    What does '/* ... */' denote in programming, based on the example?
    回答
    (B)
    A multi-line comment.
  • 20
    What data is used to calculate the result in the code example?
    回答
    (B)
    Student marks