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

  • 1
    What does the term 'algorithm' refer to in the context of programming?
    Odpoveď
    (B)
    A set of instructions to solve a problem.
  • 2
    Which of the following is an example of an 'assignment' statement in programming?
    Odpoveď
    (C)
    x = 10
  • 3
    What are the main components to consider when writing an algorithm?
    Odpoveď
    (C)
    Input, process, and output.
  • 4
    What does it mean when a procedure call must match the procedure definition?
    Odpoveď
    (D)
    All of the above.
  • 5
    In the given context, what would be the result of the following pseudocode: x = 5; y = 2; OUTPUT x + y;
    Odpoveď
    (B)
    7
  • 6
    What would the Java code 'System.out.println("Hello World");' do?
    Odpoveď
    (B)
    Print the text 'Hello World' to the console
  • 7
    Which loop is used to execute a block of code a fixed number of times?
    Odpoveď
    (A)
    FOR loop
  • 8
    In the context of the programming, what does 'debugging' refer to?
    Odpoveď
    (B)
    Finding and fixing errors in the program
  • 9
    Which of the following are examples of basic data types in programming?
    Odpoveď
    A
    B
    C
    D
  • 10
    What does the term "variable scope" refer to in programming?
    Odpoveď
    (B)
    The area of the code where a variable is accessible.
  • 11
    What is the primary function of a "module" in a programming context?
    Odpoveď
    (C)
    To group related code and functionality.
  • 12
    What does a function always do differently than a procedure (if a function does it at all)?
    Odpoveď
    (B)
    It always returns a value.
  • 13
    Which statement is the appropriate way to iterate over the elements of an array?
    Odpoveď
    (B)
    FOR loop
  • 14
    What are some examples of high-level programming languages?
    Odpoveď
    A
    B
    D
  • 15
    Which of the following statements about functions and procedures is true?
    Odpoveď
    (C)
    Functions can return a value, and procedures can also return a value, but not always.
  • 16
    What type of loop structure guarantees at least one execution of the loop body?
    Odpoveď
    (C)
    Post-condition loop
  • 17
    Which of the following is a function of a 'compiler'?
    Odpoveď
    (B)
    To translate code into machine language.
  • 18
    Which of the following is NOT a concept within the text?
    Odpoveď
    (B)
    Integration
  • 19
    What is the purpose of an algorithm in programming?
    Odpoveď
    (B)
    To solve a problem through a series of steps.
  • 20
    In a `CASE` statement, what determines which code block will be executed?
    Odpoveď
    (B)
    The value of a controlling expression.
  • 21
    What is the result of the code: `Console.WriteLine("Enter a value")`?
    Odpoveď
    (A)
    The program displays "Enter a value" on the console.
  • 22
    What would be the output of the code: `PRINT "Hello" + "World"`?
    Odpoveď
    (C)
    HelloWorld
  • 23
    Which of the following is a characteristic of a post-condition loop?
    Odpoveď
    (B)
    The loop body is always executed at least once.
  • 24
    What is the primary use of comments in code?
    Odpoveď
    (B)
    To explain the code to human readers.
  • 25
    Which keyword is used to import a module in Python?
    Odpoveď
    (C)
    import
  • 26
    What is the primary purpose of a function in programming?
    Odpoveď
    (B)
    To organize code into reusable blocks.
  • 27
    What is the purpose of the 'FOR' loop in programming?
    Odpoveď
    (B)
    To repeat a block of code a specific number of times.
  • 28
    In the pseudocode provided, what is the correct formula for calculating the average?
    Odpoveď
    (B)
    Average = Total / Counter
  • 29
    What does the `//` operator do in Python?
    Odpoveď
    (B)
    Integer division
  • 30
    What does the term 'syntax' refer to in programming?
    Odpoveď
    (B)
    The structure and grammar rules of the code.
  • 31
    What does the `NOT` operator do?
    Odpoveď
    (B)
    It reverses the truth value of an expression.
  • 32
    What is the correct order of operations (PEMDAS/BODMAS) in most programming languages?
    Odpoveď
    (A)
    Parentheses, Exponents, Multiplication and Division, Addition and Subtraction
  • 33
    Which type of loop is best suited for situations where you need to execute a block of code a specific number of times?
    Odpoveď
    (C)
    Count-controlled loop
  • 34
    What is the primary goal of code refactoring?
    Odpoveď
    (C)
    To improve the code's structure and readability without changing its behavior.
  • 35
    What is the purpose of a 'string' data type?
    Odpoveď
    (B)
    To store sequences of characters or text.
  • 36
    What type of variable is used in a 'Hello World' program?
    Odpoveď
    (B)
    String
  • 37
    What are the required steps involved to write a 'Hello World' program?
    Odpoveď
    (A)
    Output statements
  • 38
    What is 'selection' in the context of programming?
    Odpoveď
    (B)
    Choosing a specific code execution path based on a condition.
  • 39
    When should you use a procedure instead of writing the same code repeatedly?
    Odpoveď
    (A)
    When the code performs a specific task that needs to be done multiple times.
  • 40
    What is the correct syntax for a FOR loop in Python?
    Odpoveď
    (B)
    for i in range(1, 10):
  • 41
    What will `"Hello" + " " + "World"` evaluate to?
    Odpoveď
    (B)
    Hello World
  • 42
    What is the primary function of the `RETURN` statement in a function?
    Odpoveď
    (C)
    To send a value back from the function.
  • 43
    What programming construct is used to repeat a set of instructions?
    Odpoveď
    (C)
    A loop.
  • 44
    What should be done before starting the program in the Java code?
    Odpoveď
    (C)
    Declare variables and import the packages
  • 45
    Which operator is used for integer division?
    Odpoveď
    (B)
    \
  • 46
    Which of the following is a selection structure mentioned in the text?
    Odpoveď
    (C)
    IF statement
  • 47
    What is the basic data type used for a single character?
    Odpoveď
    (C)
    Char
  • 48
    Which data type would be most suitable for representing a price that might contain decimal places?
    Odpoveď
    (D)
    Double/Real
  • 49
    How does using meaningful identifiers (variable names, function names) benefit code maintenance?
    Odpoveď
    (C)
    It makes the code easier for developers to understand and modify.
  • 50
    What is the key advantage of using indexed elements in an array?
    Odpoveď
    (C)
    Fast and easy access to data.