Python Programming - MCQ Practice Questions
Core Python MCQs — syntax, data types, OOP, libraries for placements & IT exams.
119 questions | 100% Free
What does the len() function return when applied to a string 'India'?
Consider the code: num = '123'. What will int(num) return?
Which of the following is the correct syntax for a Python comment?
What is the output of: print('Hello' + ' ' + 'World')?
Which method is used to add an element to a list in Python?
What will be the output of: print(10 // 3)?
Which of the following is NOT a valid Python variable name?
What is the output of: print(10 // 3 + 10 % 3)?
What will be the data type of x after executing: x = ?
What is the output of: print(len('Python'))?
What will be the output of: print(10 if 5 > 3 else 20)?
What is the output of: print('a' in 'banana')?
What will be the output of: x = 5; x += 3; print(x)?
What will be the output of the following code? my_list = [1, 2, 3] my_list.append(4) print(len(my_list))
Which of the following is NOT a valid Python data type?
What will be the type of x after executing: x = [1, 2.5, 'hello']?
Which method removes and returns the last element from a list?
What will be the output? my_list = [1, 2, 3, 4, 5] print(my_list[1:3])