Skip to content
- What is the output of
print("Python".replace("P", "J"))?
a) Jython
b) Python
c) Error
d) None
Correct Answer: a) Jython
- Which of the following is a built-in module in Python?
a) math
b) random
c) os
d) All of the above
Correct Answer: d) All of the above
- What is the output of
print(10 % 3)?
a) 1
b) 3
c) 0
d) Error
Correct Answer: a) 1
- Which of the following is used to exit a loop in Python?
a) break
b) continue
c) pass
d) exit
Correct Answer: a) break
- What is the output of
print("Python"[-1])?
a) P
b) n
c) o
d) Error
Correct Answer: b) n
- What is the output of
print(2 ** 3)?
a) 6
b) 8
c) 9
d) Error
Correct Answer: b) 8
- Which of the following is used to create a tuple in Python?
a) {}
b) []
c) ()
d) <>
Correct Answer: c) ()
- What is the output of
print("Python".islower())?
a) True
b) False
c) Error
d) None
Correct Answer: b) False
- Which of the following is used to remove an element from a list?
a) remove()
b) delete()
c) discard()
d) pop()
Correct Answer: a) remove()
- What is the output of
print("Python".startswith("P"))?
a) True
b) False
c) Error
d) None
Correct Answer: a) True
- 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".endswith("n"))?
a) True
b) False
c) Error
d) None
Correct Answer: a) True
- Which of the following is used to reverse a list in Python?
a) reverse()
b) reversed()
c) sort()
d) sorted()
Correct Answer: a) reverse()
- What is the output of
print("Python".capitalize())?
a) python
b) Python
c) PYTHON
d) Error
Correct Answer: b) Python
- Which of the following is used to check if a key exists in a dictionary?
a) in
b) exists
c) has_key
d) contains
Correct Answer: a) in
Pages:
1 2 3 4 5 6 7 8 9 10