LogIn
I don't have account.
Question 1
What will be the output of the following code? python Copy Edit
print(type(5 / 2))
1
<class 'double'>
2
<class 'float'>
3
<class 'int'>
4
<class 'long'>
Question 2
What will be the output of the following code? python Copy Edit
a = [1, 2, 3, 4]
print(a[-1])
1
1
2
4
3
3
4
2
Question 3
What will be the output of the following code? python Copy Edit
print(bool([]), bool(0), bool(''))
1
False False False
2
True True True
3
False True False
4
True False False
Question 4
Which method is used to remove the last element from a list?
1
delete()
2
remove()
3
pop()
4
discard()
Question 5
What will be the output of the following code?
a = [1, 2, 3]
b = a
b.append(4)
print(a)
1
Error
2
[1, 2, 3, 4]
3
[4, 1, 2, 3]
4
[1, 2, 3]
Question 6
Which of the following statements is true for Python?
1
Python is both compiled and interpreted.
2
Python is neither compiled nor interpreted.
3
Python is a compiled language.
4
Python is an interpreted language.
Question 7
What will be the output of the following code?
def foo(x, y=[]):
    y.append(x)
    return y
print(foo(1))
print(foo(2))
1
[1] [1, 2]
2
[1] [2]
3
[1, 2] [1, 2]
4
[2] [2]
Question 8
What will be the output of the following code?
class A:
    def __init__(self):
        self.var = 10
class B(A):
    def __init__(self):
        super().__init__()
        self.var = 20
obj = B()
print(obj.var)
1
None
2
20
3
10
4
Error
Question 9
What will be the output of the following code?
class A:
    def __init__(self):
        self.var = 10
class B(A):
    def __init__(self):
        self.var = 20
        super().__init__()
obj = B()
print(obj.var)
1
20
2
10
3
None
4
Error
Question 10
What will be the output of the following code?
x = (i**2 for i in range(3))
print(list(x))
print(list(x))
1
[0, 1, 4] []
2
[0, 1, 4] [0, 1, 4, 9]
3
[0, 1, 4] [0, 1, 4]
4
Error
Question 11
What will be the output of the following code?
stack = []
stack.append(1)
stack.append(2)
stack.append(3)
print(stack.pop(), stack.pop())
1
1 3
2
3 2
3
2 3
4
1 2
Question 12
Which concept allows abstraction in Python?
1
The @abstractmethod decorator
2
The staticmethod decorator
3
The @override decorator
4
The lambda function
Question 13
In Python, which function is used to get the ASCII value of a character?
1
asc()
2
ord()
3
chr()
4
ascii()
Question 14
What will be the output of the following Python code?
print(chr(66))
1
66
2
b
3
A
4
B
Question 15
What will be the output of the following Python code?
print(ord('z') - ord('a'))
1
25
2
-25
3
24
4
26
Question 16
In Python, which function converts an integer ASCII value to its corresponding character?
1
convert()
2
ord()
3
chr()
4
asc()
Question 17
What will be the output of 'A' + 1 in Python?
1
B
2
A1
3
TypeError
4
66
Question 18
In Python, which data structure is equivalent to a HashMap
1
List
2
Dictionary (dict)
3
Tuple
4
Set
Question 19
In Python, which data type is used for large integers beyond the typical integer range?
1
float
2
bigInt
3
int
4
long
Question 20
Which Python library can be used to visualize search algorithms applied to a problem?
1
matplotlib
2
TensorFlow
3
Pandas
4
Scikit-learn