Subjectwise MCQ
Statewise Prepration
Govt. Examwise MCQ
147 Python MCQ Questions in english हिन्दी
High-level, all-purpose Python is a very well-liked programming language. The most recent version of the Python programming language, Python 3, is utilised for cutting-edge software development projects like web development and machine learning applications. Python is a very good programming language for beginners, as well as for seasoned programmers with experience in other programming languages like C++ and Java.
What is the correct way to define a dictionary?
Dictionaries are defined using curly braces with key-value pairs.
How do you start a for loop in Python?
for i in range(5): is the correct syntax.
What is the output of bool([])?
Empty lists are falsey.
What does list("abc") return?
Converts a string into a list of characters.
Which of the following is used to define a class in Python?
Use the class keyword to define a class
What is the result of 3 == 3.0 in Python?
Python considers 3 and 3.0 equal in value.
What is the correct way to open a file for writing?
"w" mode opens the file for writing (overwrites if exists)
Which of these is not a keyword in Python?
eval is a built-in function, not a keyword.
What is the output of: print("5" + "5")?
String concatenation results in "55".
What does range(3) produce?
range(3) gives numbers from 0 to 2.
What is the output of bool(0)?
bool(0) is False, because 0 is considered falsey
ow do you insert comments in Python?
Python uses # for comments.
What does len("Hello") return?
"Hello" has 5 characters.
Which of the following is a mutable data type?
Lists are mutable; others are immutable
What data type is the object below? x = {"name": "Alice", "age": 25}
Curly braces with key-value pairs define a dictionary.
What will be the output of print(2 ** 3)?
** is the exponentiation operator (2³ = 8).
Which keyword is used to define a function in Python?
Python uses the def keyword to define functions
What is the correct file extension for Python files?
Python source files end with .py
What is the output of: print(type([]))?
[] denotes a list in Python
What will the following Python code produce?
x = [[0], [1]]
print((' '.join(list(map(str, x))),))
Which of the following is the use of id() function in python?
What does print(math.pow(3, 2)) produce?
What will the following Python code produce?
print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
Which of the following pertains to Python DocString's features?
What will the following Python expression produce?
round(4.576)
What will the following Python code snippet produce?
z=set('abc$de')
'a' in z
That which follows is a Python tuple, right?
What will the following Python programme produce?
def addItem(listParam):
listParam += [1]
mylist = [1, 2, 3, 4]
addItem(mylist)
print(len(mylist))