Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 4

Python Question Bank

Primitive(P)
DataStructure(
D)
Logical(L) Question Description Answer Day 1
P Is Python case sensitive when dealing with identifiers? yes 1
P What is the maximum possible length of an identifier? none of the mentioned 1
P Which of the following is invalid? none of the mentioned 1
P Which of the following is an invalid variable? 1st_string 1
P Which of the following is not a keyword? eval 1
P What will be the output of the following
All keywords in Python are in _________ Python none of the mentioned 1
code snippet?
P Which of the following cannot be a variable? in
not(3>4) 1
P not(1&1) True False 1
What will be the output of the following Python
Which
P of the following Boolean expressions is not logically equivalent not(-6>10
to the other
or-6==10)
three? 2,2,2
What will be the code
outputsnippet?
of the following Python
P not(10<20) and not(10>30)
statement? false 1
P >>>"abcd"[2:] cd 1
What will be the output of the following Python
P What arithmetic operators cannot be used with strings?
statement? – 1
What will be the output of the following Python
P >>>print('new'
code? 'line') newline 2,1
P print(0xA + 0xB + 0xC) 33 1
P 1f s1.__contains__(s2) 1
P Which is the correct operator for power(x,y)? X**y 1
P What is the answer to this expression, 22 % 3 is? 1 1
P What is the output of this expression, 3*1**3? 3 1
P Which one of the following has the highest precedence in the expression?
Parentheses 1
P Which one of these is floor division? // 1

D Which of the following commands will create a list?all of the mentioned 1


D Suppose list1 is [2445,133,12454,123], what is max(list1)? 12454 1
D Suppose list1 =is ['Amir',
>>>names [2, 33, 222, 14,'Charlton',
'Bear', 25], What'Daman']
is list1[-1]?25 1
D >>>print(names[-1][-1]) n 1
D To add a new element to a list we use which command? list1.append(5) 1
D To insert 5 to the third position in list1, we use which command? list1.insert(2, 5) 1
D Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?2 1
D Which of the following is a Python tuple? (1, 2, 3) 1
D Suppose t = (1, 2, 4, 3), which of the following is incorrect? t[3] = 45 1
D If a=(1,2,3,4), a[1:-1] is
>>> a=(2,3,4) _________ (2,3) 1
D >>>a=(1,2,3,4)
>>> sum(a,3) 12 1
D >>> del a Yes, the entire tuple is delet 1
D Which of these about a set is not true? Immutable data type 1
D Which of the following is not the correct syntax for creatingset([[1,2],[3,4]])
a set? 1
Suppose
D listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
[3, 5, 20, 5, 25, 1, 3] 1
Suppose
D listExample is [3, 4, 5, 20, >>>list1[0]
5, 25, 1, 3],=what
4 is list1 after listExample.pop()?
[3, 4, 5, 20, 5, 25, 1] 1
D >>>print(list2)
>>>numbers.append([5,6,7,8]) [4, 3] 1
D >>>print(len(numbers))
>>>list2 = [5, 6, 7, 8] 5
D >>>print(len(list1 + list2)) 8 1
a[1]=34
D print(b) [10,23,56,[95]] 1

L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
Day 2 Day 3 Day 4 Day 5 Day 6 Day 7 Day 14 Day 21 Day 28
2 2 2
1 2
2 2 2
2 2
2 2 2
1 1
1 1
1 1
1 2
1 1
1 1
1 1
1 1
1 1
1
1 1
1 1
1 1
1 1
1 1

1 1
1 1 1
1 1
1 1
1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1 1
1 1
1 1
1 1
1 1
1 1

You might also like