Welcome to your Python
Python
Which of the following is the correct file extension for Python files?
.pyth
.py
.pyt
.pt
None
Python
What is the output of print(type([]))?
None
Python
Which data type is immutable in Python?
Tuple
Dictionary
Set
List
None
Python
What does the len() function do?
Converts to integer
Returns last element
Deletes elements
Returns number of elements
None
Python
What is the output of 2 ** 3 in Python?
9
6
5
8
None
Python
How do you write comments in Python?
// comment
/* comment */
-- comment
# comment
None
Python
Which of the following is used to handle exceptions?
error-catch
handle-except
try-except
catch-block
None
Python
What is the output of bool(0)?
True
False
None
0
None
Python
Which method is used to add an element at the end of a list?
add()
append()
insert()
extend()
None
Which module in Python supports regular expressions?
re
regex
pyregex
regexp
None
Python
Which statement is used to exit a loop?
stop
break
return
exit
None
Python
What is the output of print(5 == 5.0)?
True
Error
None
False
None
Python
Which function is used to read input from the user?
get()
scan()
read()
input()
None
Python
What is the correct way to open a file for reading in Python?
open("file.txt", "a")
open("file.txt", "x")
open("file.txt", "r")
open("file.txt", "w")
None
Python
What is the output of len("Python")?
5
6
7
8
None
Python
What will be the output of: a = [1, 2, 3] b = a b. append(4) print(a)
[1, 2, 3, 4]
[1, 2, 3]
[4, 1, 2, 3]
Error
None
Python
Which of the following statements about Python is TRUE?
Python code must be compiled before execution
Python doesn’t support OOP
Python supports multiple inheritance
Python is statically typed
None
Python
What is the difference between is and ==?
is checks class type only
is checks equality, == checks type
is checks identity, == checks equality
Both are same
None
Python
What will be the output of print([i for i in range(5) if i % 2 == 0])?
[2, 4, 6]
[0, 2, 4]
[1, 2, 3, 4, 5]
[1, 3, 5]
None
Python
What does the @staticmethod decorator do?
Prevents method overriding
Makes method access only instance variables
Automatically calls the constructor
Allows method to be called without creating an object
None
Python
Which of the following can be used to handle memory cleanup?
init()
close()
delete()
del()
None
Python
Which of the following is TRUE about Python generators? a) b) c) d)
They are slower than normal functions
They use more memory
They return only one value
They return multiple values using yield
None
Python
Which of these is a web framework in Python?
Django
Spring
React
Flutter
None
Python
What is the difference between deep copy and shallow copy in Python?
Deep copy copies only references, shallow copy copies all objects
Deep copy is faster than shallow copy
Both copy everything
Shallow copy copies only references, deep copy copies objects recursively
None
Python
Which of the following statements about Python decorators is TRUE?
Decorators are used to modify the behavior of functions or classes
Decorators are only used for debugging
Decorators can only be used in loops
Decorators make functions slower
None
Time's up
Time is Up!
Common Jobs
Jobs
Referrals
My Profile