2%

Question 1 of 51

1. What is the maximum length of a Python identifier?

Question 1 of 51

Question 2 of 51

2.

What will be the output of the following code snippet?

print(2**3 + (5 + 6)**(1 + 1))

 

Question 2 of 51

Question 3 of 51

3.

What will be the datatype of the var in the below code snippet?
var = 10
print(type(var))
var = "Hello"
print(type(var))

 

Question 3 of 51

Question 4 of 51

4.

How is a code block indicated in Python?

 

Question 4 of 51

Question 5 of 51

5.

What will be the output of the following code snippet?
a = [1, 2, 3]
a = tuple(a)
a[0] = 2
print(a)

 

Question 5 of 51

Question 6 of 51

6.

What will be the output of the following code snippet?
print(type(5 / 2))
print(type(5 // 2))

 

Question 6 of 51

Question 7 of 51

7.

What will be the output of the following code snippet?
a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
sum += ele
print(sum)

 

Question 7 of 51

Question 8 of 51

8.

What will be the output of the following code snippet?
count = 0
while(True):
if count % 3 == 0:
print(count, end = " ")
if(count > 15):
break;
count += 1

 

Question 8 of 51

Question 9 of 51

9.

Which of the following concepts is not a part of Python?

 

Question 9 of 51

Question 10 of 51

10.

What will be the output of the following code snippet?
def solve(a, b):
return b if a == 0 else solve(b % a, a)
print(solve(20, 50))

 

Question 10 of 51

Question 11 of 51

11.

What will be the output of the following code snippet?
def solve(a):
a = [1, 3, 5]
a = [2, 4, 6]
print(a)
solve(a)
print(a)

 

Question 11 of 51

Question 12 of 51

12.

What will be the output of the following code snippet?
def func():
global value
value = "Local"

value = "Global"
func()
print(value)

 

Question 12 of 51

Question 13 of 51

13.

Which of the following statements are used in Exception Handling in Python?

 

Question 13 of 51

Question 14 of 51

14.

What will be the output of the following code snippet?
a = 3
b = 1
print(a, b)
a, b = b, a
print(a, b)

 

Question 14 of 51

Question 15 of 51

15.

Which of the following types of loops are not supported in Python?

 

Question 15 of 51

Question 16 of 51

16.

Which of the following is the proper syntax to check if a particular element is present in a list?

 

Question 16 of 51

Question 17 of 51

17.

What will be the output of the following code snippet?
def thrive(n):
if n % 15 == 0:
print("thrive", end = “ ”)
elif n % 3 != 0 and n % 5 != 0:
print("neither", end = “ ”)
elif n % 3 == 0:
print("three", end = “ ”)
elif n % 5 == 0:
print("five", end = “ ”)
thrive(35)
thrive(56)
thrive(15)
thrive(39)

 

Question 17 of 51

Question 18 of 51

18.

What will be the output of the following code snippet?
def check(a):
print("Even" if a % 2 == 0 else "Odd")

check(12)

 

Question 18 of 51

Question 19 of 51

19.

What will be the output of the following code snippet?
example = ["Sunday", "Monday", "Tuesday", "Wednesday"];
print(example[-3:-1])

 

Question 19 of 51

Question 20 of 51

20.

What will be the output of the following code snippet?
a = [1, 2]
print(a * 3)

 

Question 20 of 51

Question 21 of 51

21.

What will be the output of the following code snippet?
example = ["Sunday", "Monday", "Tuesday", "Wednesday"];
del example[2]
print(example)

 

Question 21 of 51

Question 22 of 51

22.

What will be the type of the variable sorted_numbers in the below code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
print(sorted_numbers)

 

Question 22 of 51

Question 23 of 51

23.

What will be the output of the following code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
even = lambda a: a % 2 == 0
even_numbers = filter(even, sorted_numbers)
print(type(even_numbers))

 

Question 23 of 51

Question 24 of 51

24.

What will be the output of the following code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
odd_numbers = [x for x in sorted_numbers if x % 2 != 0]
print(odd_numbers)

 

Question 24 of 51

Question 25 of 51

25.

What will be the output of the following code snippet?
def is_even(number):
message = f"{number} is an even number" if number % 2 == 0 else f"{number} is an odd number"
return message
print(is_even(54))

 

Question 25 of 51

Question 26 of 51

26.

What will be the output of the following code snippet?
s = {1, 2, 3, 3, 2, 4, 5, 5}
print(s)

 

Question 26 of 51

Question 27 of 51

27.

What will be the output of the following code snippet?
a = {'Hello':'World', 'First': 1}
b = {val: k for k , val in a.items()}
print(b)

Question 27 of 51

Question 28 of 51

28.

Which of the following functions converts date to corresponding time in Python?

 

Question 28 of 51

Question 29 of 51

29.

Which of the following functions converts date to corresponding time in Python?

 

Question 29 of 51

Question 30 of 51

30.

Which of the following functions converts date to corresponding time in Python?

 

Question 30 of 51

Question 31 of 51

31.

Which of the following functions converts date to corresponding time in Python?

 

Question 31 of 51

Question 32 of 51

32.

Which of the following functions converts date to corresponding time in Python?

 

Question 32 of 51

Question 33 of 51

33.

What will be the output of the following code snippet?
a = "4, 5"
nums = a.split(',')
x, y = nums
int_prod = int(x) * int(y)
print(int_prod)

 

Question 33 of 51

Question 34 of 51

34.

What will be the output of the following code snippet?
square = lambda x: x ** 2
a = []
for i in range(5):
a.append(square(i))

print(a)

 

Question 34 of 51

Question 35 of 51

35.

What will be the output of the following code snippet?
def tester(*argv):
for arg in argv:
print(arg, end = ' ')
tester('Sunday', 'Monday', 'Tuesday', 'Wednesday')

x

Question 35 of 51

Question 36 of 51

36.

As what datatype are the *args stored, when passed into a function?

 

Question 36 of 51

Question 37 of 51

37.

What will be the output of the following code snippet?
def tester(**kwargs):
for key, value in kwargs.items():
print(key, value, end = " ")
tester(Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4)

 

Question 37 of 51

Question 38 of 51

38.

Which of the following blocks will always be executed whether an exception is encountered or not in a program?

 

Question 38 of 51

Question 39 of 51

39.

What will be the output of the following code snippet?
from math import *
a = 2.19
b = 3.999999
c = -3.30
print(int(a), floor(b), ceil(c), fabs(c))

 

Question 39 of 51

Question 40 of 51

40.

What will be the output of the following code snippet?
set1 = {1, 3, 5}
set2 = {2, 4, 6}
print(len(set1 + set2))

 

Question 40 of 51

Question 41 of 51

41.

What keyword is used in Python to raise exceptions?

 

Question 41 of 51

Question 42 of 51

42.

What will be the output of the following code snippet?
s1 = {1, 2, 3, 4, 5}
s2 = {2, 4, 6}
print(s1 ^ s2)

 

Question 42 of 51

Question 43 of 51

43.

Which of the following is not a valid set operation in python?

 

Question 43 of 51

Question 44 of 51

44.

What will be the output of the following code snippet?
a = [1, 2, 3, 4]
b = [3, 4, 5, 6]
c = [x for x in a if x not in b]
print(c)

 

Question 44 of 51

Question 45 of 51

45.

Which of the following are valid escape sequences in Python?

 

Question 45 of 51

Question 46 of 51

46.

Which of the following are valid string manipulation functions in Python?

 

Question 46 of 51

Question 47 of 51

47.

Which of the following modules need to be imported to handle date time computations in Python?

 

Question 47 of 51

Question 48 of 51

48.

How can assertions be disabled in Python?

 

Question 48 of 51

Question 49 of 51

49.

What will be the output of the following code snippet?
a = [[], "abc", [0], 1, 0]
print(list(filter(bool, a)))

 

Question 49 of 51

Question 50 of 51

50.

In which language is Python written?

 

Question 50 of 51

Question 51 of 51

51.

What will be the result of the following expression in Python “2 ** 3 + 5 ** 2”?

 

Question 51 of 51