Python
[Link] is a variable in Python?
A) A type of error
B) A container used to store data
C) A loop statement
D) A function
2. Which of the following is NOT a Python data type?
A) int
B) float
C) string
D) decimal
3. What does type casting do?
A) Deletes a variable
B) Converts one data type into another
C) Repeats a loop
D) Prints data
4. Which data type can store multiple values in a single variable?
A) int
B) bool
C) list
D) none
5. What is the main difference between a list and a tuple?
A) List is mutable, tuple is immutable
B) Tuple is faster than list
C) List stores only numbers
D) Tuple is only used in loops
6. What is the use of a set in Python?
A) Stores duplicate values
B) Stores only string values
C) Stores unique values
D) Stores only numbers
7. What does a dictionary store?
A) Only numbers
B) Only one value
C) Values in sequence
D) Data in key-value pairs
8. Why is elif used in conditional statements?
A) To stop a program
B) To run a loop
C) To check another condition
D) To create a list
9. What is the purpose of a for loop?
A) To stop the program
B) To repeat a block of code
C) To store data
D) To define a function
10. What is the difference between a for loop and a while loop?
A) They are exactly the same
B) For loop runs on condition, while runs on list
C) For loop is based on sequence, while loop is based on condition
D) While loop is faster
11. What does the break statement do?
A) Skips the current iteration
B) Ends the loop immediately
C) Restarts the loop
D) Ends the program
12. What does continue do in a loop?
A) Stops the loop
B) Skips the current iteration
C) Ends the program
D) Prints the output
13. What is a function in Python?
A) A loop inside another loop
B) A stored value
C) A reusable block of code
D) A datatype
14. What is the purpose of the return statement?
A) Stops the function forever
B) Sends a value back from a function
C) Repeats the function
D) Prints the function
15. What is the use of the range() function?
A) Generates a random number
B) Creates a loop only
C) Generates a sequence of numbers
D) Converts string to number