Python Variables and Basic Concepts – 20 MCQ Chapter 4 Set 4
Question 1 of 20
What is a variable in Python?
Question 2 of 20
Which symbol is used to assign a value to a variable in Python?
Question 3 of 20
Which is a valid Python variable name?
Question 4 of 20
What will be the output of name = "Alice"; print(name)?
Question 5 of 20
Which variable name is NOT valid in Python?
Question 6 of 20
What happens when the value of a variable is assigned again?
Question 7 of 20
What is the output of x, y, z = 10, 20, 30 followed by print(y)?
Question 8 of 20
What happens in x = y = z = 100?
Question 9 of 20
What does casting mean in Python?
Question 10 of 20
Which function converts a value to an integer?
Question 11 of 20
What is the output of x = int(5.8); print(x)?
Question 12 of 20
What is the output of x = float(5); print(x)?
Question 13 of 20
Which function converts a value into a string?
Question 14 of 20
Which function is used to check the data type of a variable?
Question 15 of 20
What will type(25) return?
Question 16 of 20
Which statement correctly creates a string?
Question 17 of 20
Which statement about single and double quotes is correct?
Question 18 of 20
Why is this statement useful: text = "I'm learning Python."?
Question 19 of 20
What does case sensitivity mean in Python?
Question 20 of 20
Which pair represents two different Python variables?
Python Variables and Basic Concepts – 20 MCQ Quiz for Students
Post Description
Test your Python basics with these 20 multiple-choice questions on variables, variable creation, casting, data types, strings, quotes, naming rules, and case sensitivity. Ideal for NCERT/CBSE students and Python beginners.
Focus Keyword
Python Variables MCQ
Meta Title
Python Variables MCQ – 20 Questions with Answers
URL Slug
python-variables-mcq-questions
Meta Description
Practice 20 Python Variables MCQs with answers and explanations. Learn variables, casting, data types, strings, quotes, naming rules, and case sensitivity.
FAQ
- What is a variable in Python?
A variable is a name used to store data or information in a Python program.
- How do you create a variable in Python?
A variable is created by assigning a value using the = operator. For example, age = 20.
- What is casting in Python?
Casting is the process of changing one data type into another, such as converting an integer into a float or string.
- Which functions are commonly used for casting?
The commonly used casting functions are int(), float(), and str().
- How can we check the type of a variable?
The type() function is used to check the data type of a variable.
- Are single and double quotes both allowed in Python?
Yes. Python allows strings to be written using either single quotes or double quotes.
- Is Python case-sensitive?
Yes. Python treats uppercase and lowercase letters as different. For example, Age and age are different variables.
- What are the rules for naming Python variables?
A variable name can start with a letter or underscore, cannot start with a number, cannot contain spaces, and should use meaningful names.