Test 2: Variables, Input/Output and Operators

MCQs

30 questions · 25 min · 30 marks

Want to try first? Take the free Computer Science test: 94hbp-7gz9m-ufent-tsj4r

Sample questions

The first 5 of 30. Try each one, then tap to see the answer.

  1. Question 1

    A variable in programming functions as:

    • AA storage container within a computer's memory
    • BA type of operator
    • CA comment
    • DA printer
    Show answer

    Answer: A

    A variable stores data that can be retrieved later in the code.

  2. Question 2

    A variable is called a variable because its value:

    • ANever changes
    • BIs always text
    • CCan change throughout the execution of a program
    • DIs always zero
    Show answer

    Answer: C

    The example assigns age = 71 and later age = 60.

  3. Question 3

    A Python variable name must begin with:

    • AA digit
    • BA letter or an underscore
    • CA space
    • DA symbol like @
    Show answer

    Answer: B

    The name must begin with a letter (a-z, A-Z) or an underscore.

  4. Question 4

    In Python, age and Age are:

    • AThe same variable
    • BSyntax errors
    • CTwo different variables
    • DComments
    Show answer

    Answer: C

    Variable names are case-sensitive.

  5. Question 5

    Which of the following cannot be used as a variable name?

    • Aage
    • B_count
    • Cfor
    • DAge
    Show answer

    Answer: C

    for is a reserved keyword.

More tests in Introduction to Python Programming

Practise with a free account

Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.

Create free account