Python Fundamentals: Character Set, Tokens, Variables & Data Types: 19 MCQs

All 19 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 8 questions

Q1. Which of the following best defines the Python character set?

Beginner
A The set of valid characters Python recognises
B The symbols used only in comments
C The list of all keywords in Python
D The rules for naming variables

Answers and explanations are in the Veda app.

Q2. Which of these is NOT one of the five families of the Python character set?

Beginner
A Digits
B Letters
C White spaces
D Operators

Answers and explanations are in the Veda app.

Q3. What is the smallest individual unit in a Python program called?

Beginner
A Character
B Expression
C Token
D Statement

Answers and explanations are in the Veda app.

Q4. How many keywords does Python have?

Beginner
A 35
B 30
C 25
D 40

Answers and explanations are in the Veda app.

Q5. Which of these is a valid identifier in Python?

Beginner
A _value
B for
C my-var
D 123ab

Answers and explanations are in the Veda app.

Q6. In the expression 3 + 5 = 8, what is the operator?

Beginner
A 8
B 3
C 5
D +

Answers and explanations are in the Veda app.

Q7. Which of the following is a punctuator in Python?

Beginner
A and
B :
C True
D +

Answers and explanations are in the Veda app.

Q8. Python has 35 keywords, all lowercase except False, True and None.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 7 questions

Q9. A student writes: x = 10. What is x in this statement?

Intermediate
A An identifier and a variable name
B A keyword
C A literal
D A punctuator

Answers and explanations are in the Veda app.

Q10. Which statement about Python keywords is correct?

Intermediate
A There are 25 keywords in Python
B Keywords are user-defined names
C All keywords are lowercase except False, True and None
D Keywords can be used as variable names if capitalised

Answers and explanations are in the Veda app.

Q11. Which of these is a literal?

Intermediate
A =
B if
C age
D "Hello"

Answers and explanations are in the Veda app.

Q12. What happens when you type help() and then keywords in the Python shell?

Intermediate
A It lists all punctuators
B It lists all operators
C It lists all Python keywords
D It lists all identifiers in your program

Answers and explanations are in the Veda app.

Q13. Which of the following correctly assigns the same value to two variables?

Intermediate
A x == y == 5
B x, y = 5
C x + y = 5
D x = y = 5

Answers and explanations are in the Veda app.

Q14. A programmer names a variable myVariable. Another writes myvariable. What is true?

Intermediate
A Both are keywords
B Both are invalid identifiers
C They are two distinct variables because Python is case-sensitive
D They refer to the same variable

Answers and explanations are in the Veda app.

Q15. Which of these is NOT a valid identifier?

Intermediate
A ab123
B _123
C 123ab
D A_1

Answers and explanations are in the Veda app.

Topper level · 4 questions

Q16. Which statement best explains why keywords cannot be used as variable names?

Advanced
A They are reserved with fixed meaning, so using them would make code ambiguous
B They contain special characters
C They are too short to be useful names
D They are always uppercase

Answers and explanations are in the Veda app.

Q17. Given the variable assignment `x = 5 + 3`, identify the tokens in this statement and classify them correctly. Which combination of tokens is accurate?

Advanced
A Operator: `=`, Identifier: `x`, Literal: `3`, Operator: `+`, Literal: `5`
B Identifier: `x`, Operator: `=`, Literal: `5`, Operator: `+`, Literal: `3`
C Identifier: `x`, Operator: `+`, Literal: `5`, Operator: `=`, Literal: `3`
D Literal: `5`, Operator: `=`, Identifier: `x`, Operator: `+`, Literal: `3`

Answers and explanations are in the Veda app.

Q18. Evaluate the following variable assignments: `a = 10`, `b = 20`, `c = a + b`. What will be the data type of `c` after these assignments?

Advanced
A NoneType
B Integer
C String
D Float

Answers and explanations are in the Veda app.

Q19. If you attempt to use a keyword as a variable name in Python, what will be the outcome? Analyze the following code snippet: `if = 10`.

Advanced
A The code will execute and assign 10 to `if`.
B The variable `if` will be created but will not hold any value.
C A SyntaxError will be raised.
D The code will execute but `if` will be ignored.

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages