ECET 2026 Preparation

Day 1 Night Blog: Python Basics – Variables & Data Types + MCQs

Concept Notes: Python Basics – Variables & Data Types

🔹 1. Introduction to Python

  • Python is a high-level, interpreted, and beginner-friendly programming language.
  • It has a clean syntax and doesn’t require declaring data types.
x = 5
name = "Rukesh"

2. Variables in Python

  • A variable stores a value.
  • No need to declare data type like in C/C++.
  • Python is dynamically typed – it figures out the type automatically.
x = 10         # Integer
name = "Rukesh"  # String
price = 99.5   # Float

Rules for Variable Names:

  • Must start with a letter or _
  • Cannot start with a number
  • Can contain letters, digits, and underscores
  • Cannot use keywords like if, class, def, etc.

3. Data Types in Python

TypeExampleDescription
intx = 10Whole numbers
floatpi = 3.14Decimal numbers
strname = "A"Textual data (single/double quotes)
boolTrue, FalseBoolean logic values
list[1, 2, 3]Ordered collection of items

Use type() function to check type:

print(type(x))  # <class 'int'>

Python Basics MCQs – Day 1 Practice Set

1️⃣ What is the correct way to assign a string to a variable in Python?
A) name = Rukesh
B) string name = "Rukesh"
C) name = "Rukesh"
D) char name = 'Rukesh'

2️⃣ What will be the output of: print(type(10))?
A) <type 'int'>
B) int
C) <class 'int'>
D) None

3️⃣ Which of the following is a valid variable name?
A) 2value
B) value_2
C) if
D) float

4️⃣ Which keyword is used to define a function in Python?
A) function
B) func
C) def
D) define

5️⃣ Which of these is not a data type in Python?
A) string
B) float
C) bool
D) list

6️⃣ What is the output of: print(10 / 2) in Python 3?
A) 5
B) 5.0
C) 5.00
D) Error

7️⃣ Which function is used to check the type of a variable?
A) typeOf()
B) typeof()
C) checkType()
D) type()

8️⃣ What is the output of type("123")?
A) int
B) str
C) float
D) bool

9️⃣ What is the correct way to write a comment in Python?
A) // This is a comment
B) # This is a comment
C) /* Comment */
D) -- Comment

🔟 Which is the boolean value in Python?
A) true
B) yes
C) TRUE
D) True

✅ Answer Key

Q.NoAnswer
1C
2C
3B
4C
5A
6B
7D
8B
9B
10D

🧠 Explanations

  • Q1: Strings must be in quotes → "Rukesh"
  • Q2: Python 3 returns: <class 'int'>
  • Q3: value_2 is valid. 2value starts with digit, if is a keyword
  • Q4: def is the correct keyword for defining functions
  • Q5: Python uses str for strings, not string
  • Q6: In Python 3, / always returns float → 5.0
  • Q7: type() is used to check data type
  • Q8: "123" in quotes is a string → str
  • Q9: Comments in Python use # symbol
  • Q10: Boolean values are case-sensitive: True, False

📥 Download Notes + MCQs PDF

📌 Available tonight in Telegram → @LearnNewThingsHub

💬 Comment Task for Learners

🗣 Confused between int and str values?
Drop a comment — we’ll explain it in tomorrow’s short!

Loading

Leave a comment

Your email address will not be published. Required fields are marked *