Logo

Python Questions Set 189:

Quiz Mode

What does the bitwise NOT operator (~) applied five times to the number 7 evaluate to?

1
2
3
4

Solution:

x = frozenset(('A', 'B', 'C'))

print(x)

1
2
3
4

Solution:

 To shuffle the list(say list1) what function do we use? 

1
2

Solution:

What is the output of the following Python statement?


print("Hello" + 1 + "World")

1
2
3
4

Solution:

Which of the following is not the correct syntax for creating a set? 

1
2
3
4

Solution:

Identify the correct syntax of the range() function in Python.

1
2
3
4

Solution:

Deduce the output of the following code:


def fun(n):

    if n == 1 or n == 0:

        return 1

    else:

        return fun(n-1) + fun(n-2)


print(fun(5))

1
2
3
4

Solution:

What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
   i.upper()
print(x)

1
2
3
4

Solution:

What will be the output of the following code?

a = [6, 7, 8, 9, 10]
b = [1, 1, 1, 1, 1]
c = map(lambda x, y: x * y, a, b)

Print the list(c)

1
2
3
4

Solution:

Given the code block below, how many rows will be printed by the df.head() function? Assume Test.csv has 1436 rows.

import pandas as pd

df = pd.read_csv('Test.csv')

df.head()

1
2
3
4

Solution: