01Which one of these is NOT true about recursion?
02Is Python case sensitive when dealing with identifiers?
03Which of the following commands will create a list?
04What is the output when we execute list("hello")?
05What is the output of len(list("hello"))?
06Suppose list1 is [2445,133,12454,123], what is max(list1)?
07Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
08Suppose list1 is [1, 5, 9], what is sum(list1)?
09What function do we use to shuffle the list?
10Suppose list is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
11Suppose list is [2, 33, 222, 14, 25], What is list[-1]?
12Suppose list1 is [2, 33, 222, 14, 25], What is list[:-1]?
13Suppose list is [3, 4, 5, 20, 5, 25, 1, 3], what is list after list.reverse()?
14Suppose list is [3, 4, 5, 20, 5, 25, 1, 3], what is list after list.extend([34, 5])?
15Suppose list is [3, 4, 5, 20, 5, 25, 1, 3], what is list after list.pop(1)?
16What will be the output of the following Python code?
"Welcome to Python".split()
17What will be the output of the following Python code?
list("a#b#c#d".split('#')) 18What will be the output of the following Python code?
weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
if 'monday' in weekdays:
print(1)
else:
print(2)
19What will be the output of the following Python code?
def f(i, values=[]):
values.append(i)
return values
f(1)
f(2)
v = f(3)
print(v)
20What will be the output of the following Python code?
names1 = ['Amir', 'Bala', 'Charlie']
names2 = [name.lower() for name in names1]
print(names2[2][0])
21To which of the following the "in" operator can be used to check if an item is in it?
22What will be the output of the following Python code?
veggies = ['carrot', 'broccoli', 'potato', 'asparagus']
veggies.insert(veggies.index('broccoli'), 'celery')
print(veggies)23Which module in Python supports regular expressions?
24Which of the following creates a pattern object?
25What does the function re.match do?
26What does the function re.search do?
27What will be the output of the following Python code?
import re
sentence = 'we are humans'
matched = re.match(r'(.*) (.*?) (.*)', sentence)
print(matched.groups())
28The difference between the functions re.sub and re.subn is that re.sub returns a _____ whereas re.subn returns a _______
29The function of re.search is ______
30Which of the following functions creates a Python object?
31The function of re.match is _______
32The special character \B matches the empty string, but only when it is _______
33What will be the output of the following Python code?
def test():
x, y = 4, 5
y, x = x, y
print(x)
print(y)
test()34What is an abstract class?
35What happens when you use the build-in function any() on a list?
36What data structure does a binary tree degenerate to if it isn't balanced properly?
37What statement about static methods is true?
39Which statement about strings in Python is true?
40If you do not explicitly return a value from a function, what happens?