Programming Basics (Cambridge (CIE) A Level Computer Science): Flashcards

Exam code: 9618

1/24

0Still learning

Know0

  • Define variable.

Cards in this collection (24)

  • Define variable.

    A variable is an identifier that can change during the lifetime of a program.

  • Define constant.

    A constant is an identifier that is set once in the lifetime of a program.

  • What is the difference between a variable and a constant?

    A variable can change during the program's lifetime, whereas a constant is set once and is never reassigned.

  • How are constants usually named?

    In all uppercase characters.

  • How should a variable identifier be written?

    In mixed case (Pascal case), starting with a capital letter and not a digit.

  • What happens when a variable is declared?

    Memory is allocated based on the data type indicated.

  • A variable can be associated with a                  when it is declared.

    A variable can be associated with a datatype when it is declared.

  • What is the pseudocode syntax for declaring a constant?

    CONSTANT <identifier> ← <value>

  • Write pseudocode to declare a constant Pi with the value 3.14159.

    CONSTANT Pi ← 3.14159

  • Why do constants help a program?

    They aid the readability and maintainability of the code.

  • True or False?

    A constant can be reassigned during execution.

    False.

    Constants are not reassigned during execution. They are fixed values used throughout the algorithm.

  • What are arithmetic operators used for?

    To perform basic maths operations in a program, such as adding, subtracting, multiplying and dividing values.

  • Which operator gives the remainder after division?

    MOD. For example, 10 MOD 3 gives 1.

  • Which operator is used for exponentiation?

    ^. For example, 3 ^ 3 gives 27.

  • What does the + operator do when used with strings?

    It performs concatenation. For example, "John" + " " + "Doe" gives "John Doe".

  • Arithmetic operators follow operator                     , so multiplication happens before addition.

    Arithmetic operators follow operator precedence, so multiplication happens before addition.

  • What does 2 + 3 * 4 evaluate to, and why?

    14, because multiplication is carried out before addition under operator precedence.

  • What does (2 + 3) * 4 evaluate to?

    20, because the brackets are evaluated first.

  • What are logical operators used for?

    To compare values. They return either TRUE or FALSE, and are commonly used in conditions and loops.

  • Which pseudocode operator means 'not equal to'?

    <>

  • True or False?

    In 9618 pseudocode, != means 'not equal to'.

    False.

    The 9618 operator for 'not equal to' is <>.

  • Name the two operators that combine a comparison with equality.

    >= meaning greater than or equal to, and <= meaning less than or equal to.

  • x is 5 and y is 10.

    What does x < y evaluate to?

    TRUE

  • x is 5 and y is 10.

    What does x >= y evaluate to?

    FALSE

Sign up to unlock flashcards

or