Skip to content
- Which of the following is used to create a thread in Python?
a) threading.Thread
b) multiprocessing.Process
c) asyncio.Task
d) concurrent.Future
Correct Answer: a) threading.Thread
- What is the output of
print("Python".isnumeric())?
a) True
b) False
c) Error
d) None
Correct Answer: b) False
- Which of the following is used to create a file in Python?
a) open()
b) read()
c) write()
d) close()
Correct Answer: a) open()
- What is the output of
print("Python".isdecimal())?
a) True
b) False
c) Error
d) None
Correct Answer: b) False
- Which of the following is used to create a set in Python?
a) {}
b) []
c) ()
d) <>
Correct Answer: a) {}
- What is the output of
print("Python".isspace())?
a) True
b) False
c) Error
d) None
Correct Answer: b) False
- Which of the following is used to create a frozen set in Python?
a) frozenset()
b) set()
c) frozen()
d) freeze()
Correct Answer: a) frozenset()
- What is the output of
print("Python".isupper())?
a) True
b) False
c) Error
d) None
Correct Answer: b) False
- Which of the following is used to create a range of numbers in Python?
a) range()
b) list()
c) tuple()
d) set()
Correct Answer: a) range()
- What is the output of
print("Python".swapcase())?
a) pYTHON
b) PYTHON
c) python
d) Error
Correct Answer: a) pYTHON
- Which of the following is used to create a list comprehension in Python?
a) [x for x in iterable]
b) {x for x in iterable}
c) (x for x in iterable)
d) <x for x in iterable>
Correct Answer: a) [x for x in iterable]
- What is the output of
print("Python".zfill(10))?
a) 0000Python
b) Python0000
c) Python
d) Error
Correct Answer: a) 0000Python
- Which of the following is used to create a dictionary comprehension in Python?
a) {key: value for key, value in iterable}
b) [key: value for key, value in iterable]
c) (key: value for key, value in iterable)
d) <key: value for key, value in iterable>
Correct Answer: a) {key: value for key, value in iterable}
- What is the output of
print("Python".ljust(10, "*"))?
a) Python****
b) Python
c) Python
d) Error
Correct Answer: a) Python
- Which of the following is used to create a set comprehension in Python?
a) {x for x in iterable}
b) [x for x in iterable]
c) (x for x in iterable)
d) <x for x in iterable>
Correct Answer: a) {x for x in iterable}
Pages:
1 2 3 4 5 6 7 8 9 10