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

  • 1
    What is the role of the 'return' statement in a function?
    پاسخ دهید
    (C)
    To end the function and return a value.
  • 2
    In the "Totaling" example, the value of TotalWeight is being increased by what?
    پاسخ دهید
    (A)
    Weight
  • 3
    What does the `'''` notation usually denote in Python?
    پاسخ دهید
    (B)
    A multi-line comment
  • 4
    What is a characteristic feature of a pre-condition loop?
    پاسخ دهید
    (B)
    The condition is checked before each iteration.
  • 5
    In the provided pseudo-code, what data type is used for the variables 'studentHigh', 'studentLow', and 'studentTotal'?
    پاسخ دهید
    (B)
    INTEGER
  • 6
    What is the value that needs to be provided for return to the user?
    پاسخ دهید
    (C)
    Return Value
  • 7
    What is the primary role of a debugger?
    پاسخ دهید
    (C)
    To find and fix errors in code.
  • 8
    What are potential benefits of using an IDE for programming?
    پاسخ دهید
    A
    B
    C
  • 9
    If a program contains nested statements, what is the relation between the outer and inner statements?
    پاسخ دهید
    (B)
    The inner statement is executed only when the condition of the outer statement is met.
  • 10
    What is meant by the term 'iteration' in the context of a programming loop?
    پاسخ دهید
    (C)
    A single execution of the code block within the loop.
  • 11
    What is the outcome of the given code using count-controlled loop: ``` For number to 10 to 50 Step 5 Console.WriteLine(number) Next number ```
    پاسخ دهید
    (A)
    Prints numbers from 10 to 50 increasing by 5.
  • 12
    What does the text suggest about the structure of a programming language's standard library?
    پاسخ دهید
    (B)
    It includes a standard library of functions and procedures.
  • 13
    If the following code is executed and age is 17: ``` IF age >= 17 THEN Print "You are an adult" ELSE Print "You are a child" ENDIF ``` What will be the output?
    پاسخ دهید
    (B)
    You are an adult
  • 14
    What is the main function of the 'Uppercase' string handling method?
    پاسخ دهید
    (B)
    To convert all the characters in a string to uppercase.
  • 15
    What is the role of parameters in a procedure or function?
    پاسخ دهید
    (A)
    They store the values of the arguments passed to the procedure or function.
  • 16
    In the provided pseudocode, what is the stopping condition for the loop?
    پاسخ دهید
    (B)
    When 'Finish' reaches 300.
  • 17
    In Java, what type of object is usually created when working with files for writing?
    پاسخ دهید
    (C)
    FileWriter
  • 18
    What is the meaning of `CALL` in the provided context?
    پاسخ دهید
    (B)
    To execute a function or procedure.
  • 19
    What is the main advantage of nesting selection statements?
    پاسخ دهید
    (C)
    It allows you to express complex conditions.
  • 20
    What is the function of the nested loop in this algorithm?
    پاسخ دهید
    (D)
    To calculate total of marks of students.
  • 21
    What happens when you open a file in append mode ('a')?
    پاسخ دهید
    (D)
    New content is added at the end of the file.
  • 22
    Which of these statements is not a part of a function definition?
    پاسخ دهید
    (C)
    The name of the variable
  • 23
    What does the pseudo-code example use to define the number of students and the number of subjects?
    پاسخ دهید
    (B)
    Constants.
  • 24
    Which statement is correct regarding the selection statements in programming languages?
    پاسخ دهید
    (A)
    Selection statements allow different routes through the steps of a program.
  • 25
    Which logical operator yields TRUE only when *either* or *both* operands are TRUE?
    پاسخ دهید
    (B)
    OR
  • 26
    In the context of file handling, what does the 'w' mode signify when opening a file (e.g., `myFile = open('example.txt', 'w')`)?
    پاسخ دهید
    (B)
    Write mode
  • 27
    What does the outer loop iterate through in the given pseudo-code examples?
    پاسخ دهید
    (C)
    The number of students.
  • 28
    In the context of the 'Worked example,' what does the term 'average mark' refer to?
    پاسخ دهید
    (C)
    The average mark of each student, calculated by dividing the student's total marks by the number of subjects.
  • 29
    What is the purpose of the 'Counter' variable in the given pseudocode example?
    پاسخ دهید
    (B)
    To keep track of the number of marks entered.
  • 30
    Based on the provided text, what is the main purpose of the algorithm?
    پاسخ دهید
    (A)
    To calculate and output highest, lowest, and average marks for a class of students.
  • 31
    In a CASE statement, what happens if none of the cases match the expression?
    پاسخ دهید
    (B)
    The code inside the ELSE or default case (if present) is executed.
  • 32
    What is the main concept of a reusable code?
    پاسخ دهید
    (C)
    Writing code only once.
  • 33
    In a nested selection (IF-ELSE inside another IF-ELSE), what is the term used to refer to the inner statements?
    پاسخ دهید
    (C)
    Nested statements
  • 34
    What type of loop is illustrated by the following code snippet? ``` REPEAT Statement(s) UNTIL condition ```
    پاسخ دهید
    (C)
    Post-condition loop
  • 35
    In Java, when are you required to import `java.io.File`?
    پاسخ دهید
    (D)
    All of the above
  • 36
    What is the primary purpose of the `Substring` method?
    پاسخ دهید
    (B)
    To extract a portion of a string.
  • 37
    In pseudocode, what is the main purpose of using 'OPENFILE'?
    پاسخ دهید
    (C)
    To establish a connection to the file
  • 38
    What is the first task mentioned in the 'Worked example'?
    پاسخ دهید
    (C)
    Calculate and output highest, lowest, and average marks for a class.
  • 39
    Which of these is NOT a common file operation discussed?
    پاسخ دهید
    (D)
    Deleting a file
  • 40
    Which of the following can be part of an arithmetic expression?
    پاسخ دهید
    A
    B
    C
  • 41
    What does the NOT logical operator do?
    پاسخ دهید
    (C)
    It reverses the logical value of an expression.
  • 42
    What happens if the value of a variable doesn't match any of the cases in a CASE statement, and there is no default clause?
    پاسخ دهید
    (C)
    The program continues to the next statement after the CASE block.
  • 43
    What does the code calculate at the end of the outer loop, in the "Worked example"?
    پاسخ دهید
    (B)
    Highest and lowest marks for each student.
  • 44
    In the provided examples, which elements help in making the code modular?
    پاسخ دهید
    (C)
    Procedures and functions
  • 45
    What is the key characteristic of a local variable?
    پاسخ دهید
    (C)
    It is only accessible within the block in which it is defined.
  • 46
    What does a two-dimensional array store?
    پاسخ دهید
    (B)
    A table of values with rows and columns.
  • 47
    What is one of the uses of library routines?
    پاسخ دهید
    (C)
    To perform standard tasks.
  • 48
    What is generally considered the first step in interacting with a file in most programming languages?
    پاسخ دهید
    (D)
    Opening the file.
  • 49
    What does the algorithm output at the end?
    پاسخ دهید
    (D)
    All of the above.
  • 50
    In the context of programming, what does "iteration" refer to?
    پاسخ دهید
    (B)
    The repetition of a set of steps