Skip to content
J2J Institute
Search
K
Main Navigation
Home
Jobs
Code here
Courses
Java
Core
Advanced
Python
SQL
PowerBI
Testing
Manual
Automation
Interview Questions
Java
Python
SQL
Manual
Automation
Quiz
Java
Python
SQL
Appearance
Menu
Return to top
On this page
Intermediate level python quiz
What will be the output of the following code: print([1, 2, 3] * 2)?
[1, 2, 3, 1, 2, 3]
[2, 4, 6]
[1, 2, 3, 2, 4, 6]
Error
What is the purpose of the `__init__()` method in Python?
It initializes a class's attributes
It is used to call class methods
It is used to finalize an object
It is used to create a new instance of a class
How do you remove an item from a list by its index in Python?
list.remove(index)
list.pop(index)
list.delete(index)
del list[index]
What will be the output of the following code: print([1, 2, 3] == [1, 2, 3])?
True
False
Error
None
Which of the following can be used to define a default argument value for a function in Python?
def my_function(x = 5):
def my_function(x, 5):
def my_function(5, x):
def my_function(x, default=5):
What does the `filter()` function do in Python?
Filters out values from a list
Returns items that match a condition
Returns the length of a list
Creates a new list from an existing one
What is the output of the following code: print(5 // 2)?
2.5
2
1
3
Which of the following methods is used to join the elements of a list into a string in Python?
join()
concatenate()
combine()
merge()
How do you create a generator in Python?
Using a list comprehension
Using a function with yield
Using a for loop
Using an import statement
What is the purpose of the `@property` decorator in Python?
It turns a method into a read-only property
It allows you to call a method as a function
It defines a static method
It is used to define class-level variables
Submit