0% found this document useful (0 votes)
13 views3 pages

Worksheet No 2 (Python Programming)

Uploaded by

Abhimanyu Saini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Worksheet No 2 (Python Programming)

Uploaded by

Abhimanyu Saini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

WORKSHEET NO:-2 ON PYTHON

Section A: Multiple Choice Questions (MCQs)

1. Which of the following is a valid variable name in Python?


a) 1value
b) my_value
c) my-value
d) for
2. Which function is used to accept input from the user in Python?
a) scanf()
b) input()
c) get()
d) read()
3. What is the output of the following code?

print(type(10))

a) <class 'float'>
b) <class 'int'>
c) <class 'str'>
d) <class 'bool'>

4. Which operator is used for floor division in Python?


a) /
b) //
c) %
d) **
5. What is the output of "AI" * 3 in Python?
a) 6
b) AI3
c) AIAIAI
d) Error
6. Which of the following is not a data type in Python?
a) int
b) float
c) real
d) str
7. Which keyword is used to define a function in Python?
a) fun
b) define
c) def
d) function
8. Which loop is known as an entry-controlled loop in Python?
a) for
b) while
c) do-while
d) both a and b
9. Which of the following is an immutable data type?
a) List
b) Set
c) Dictionary
d) Tuple
10. What will be the output of:

a = 5
b = 2
print(a ** b)

a) 10
b) 25
c) 7
d) Error

Section B: Fill in the Blanks

11. The __________ function is used to display output in Python.


12. In Python, __________ is used to denote a single-line comment.
13. The __________ loop in Python executes a block of code multiple times until the
condition becomes false.
14. __________ is the keyword used to exit a loop before its natural termination.
15. A __________ is a collection of key-value pairs in Python.

Section C: True/False

16. Python is a case-sensitive programming language. ( )


17. A string in Python can be enclosed in single, double, or triple quotes. ( )
18. Lists in Python are immutable. ( )
19. The elif keyword is used for multiple conditions in Python. ( )
20. Indentation in Python is compulsory. ( )

Answer Key
Section A: MCQs

1. b) my_value
2. b) input()
3. b) <class 'int'>
4. b) //
5. c) AIAIAI
6. c) real
7. c) def
8. b) while
9. d) Tuple
10. b) 25

Section B: Fill in the Blanks

11. print()
12. #
13. while
14. break
15. Dictionary

Section C: True/False

16. True
17. True
18. False
19. True
20. True

You might also like