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 'long'>
2
<class 'double'>
3
<class 'float'>
4
<class 'int'>
Question 2
What will be the output of the following code? python Copy Edit
a = [1, 2, 3, 4]
print(a[-1])
1
2
2
1
3
4
4
3
Question 3
What will be the output of the following code? python Copy Edit
print(bool([]), bool(0), bool(''))
1
False False False
2
False True False
3
True True True
4
True False False
Question 4
Which method is used to remove the last element from a list?
1
delete()
2
pop()
3
remove()
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
[1, 2, 3, 4]
2
[1, 2, 3]
3
Error
4
[4, 1, 2, 3]
Question 6
Which of the following statements is true for Python?
1
Python is neither compiled nor interpreted.
2
Python is a compiled language.
3
Python is both compiled and interpreted.
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] [1, 2]
3
[2] [2]
4
[1] [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
20
2
None
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
Error
2
20
3
None
4
10
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
Error
3
[0, 1, 4] [0, 1, 4]
4
[0, 1, 4] [0, 1, 4, 9]
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
3 2
2
1 3
3
1 2
4
2 3
Question 12
Which concept allows abstraction in Python?
1
The @abstractmethod decorator
2
The @override decorator
3
The staticmethod 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
B
2
66
3
b
4
A
Question 15
What will be the output of the following Python code?
print(ord('z') - ord('a'))
1
-25
2
26
3
25
4
24
Question 16
In Python, which function converts an integer ASCII value to its corresponding character?
1
chr()
2
convert()
3
ord()
4
asc()
Question 17
What will be the output of 'A' + 1 in Python?
1
TypeError
2
B
3
A1
4
66
Question 18
In Python, which data structure is equivalent to a HashMap
1
Tuple
2
List
3
Dictionary (dict)
4
Set
Question 19
In Python, which data type is used for large integers beyond the typical integer range?
1
bigInt
2
int
3
float
4
long
Question 20
What is the output of the following Python code?
s = "Python"
s[0] = 'p'
print(s)
1
Error
2
Python
3
ython
4
python
Question 21
What will be the output of this code snippet?
text = "abracadabra"
print(text.find('a'), text.rfind('a'))
1
1 10
2
0 10
3
10 0
4
0 0
Question 22
Which method would you use to convert the first character of each word in a string to uppercase and the rest to lowercase?
1
upper()
2
title()
3
lower()
4
capitalize()
Question 23
What is the output of the following code?
s = "Hello\nWorld"
print(r"{}".format(s))
1
Hello\nWorld
2
Hello  
World
3
Hello\nWorld (literally)
4
Error
Question 24
What will be the output of this snippet?
s = "abc" * 3
print(s)
1
Error
2
abc3
3
abc abc abc
4
abcabcabc
Question 25
Which Python library can be used to visualize search algorithms applied to a problem?
1
matplotlib
2
Pandas
3
TensorFlow
4
Scikit-learn
Question 26
In a doubly linked list containing nodes A ↔ B ↔ C ↔ D ↔ E ↔ F, if a pointer p points to node E, then what does p.previous.next refer to?
1
E
2
F
3
D
4
A