Welcome to your Python Level 2

1. 
Which of the following methods is used to find the number of occurrences of an element in a tuple?
2. 
Which of the following statements is true about if statement in Python?
3. 
What is the output of the following Python code?

a=5
b=”10”
print( a + int(b) )

Deselect Answer

4. 
What is the function of using the discard() method in sets?
5. 
What is the output of the following Python code?

str = "Python Programming"
Print(str.split())

Deselect Answer

6. 
What is the function of using tuples in Python?
7. 
Which of the following data type is mutable in Python?
8. 
What will be the output of following Python code?

num=10
def func(num):
    print('number is',num)
    num=20
    print('number is changed to local',num)

func(num)
print('present number is',num)

Deselect Answer

9. 
What will be the output of following Python code?

my_tuple = ('e','d','S','l','a','s','h')
print(my_tuple[-4:-2])

Deselect Answer

10. 
Which statements are used by Python in Exception handling?
11. 
What is the output of the following Python code?

my_dict = {'a': 1, 'b': 2, 'c': 3}
print(my_dict.keys())

Deselect Answer

12. 
Which of the following loops is not supported in Python programming?
13. 
What is the function of the “pass” statement in Python?
14. 
What is the output of the following Python code?

def square(n):
    return n * n

numbers = [1, 2, 3, 4, 5]
square_numbers = list(map(square, numbers))
print(square_numbers)

Deselect Answer

15. 
What is the output of the following code?

set1 = {1, 2, 3}
set2 = {3, 4, 5}
print(set1.symmetric_difference(set2))

Deselect Answer

16. 
Which of the following is not a valid variable name in Python?
17. 
What is the purpose of using the lambda keyword in Python?
18. 
Which of the following methods is used to check the common elements in two sets?
19. 
What does the len() function returns in Python?
20. 
Which of the following methods is a correct way to remove an element from a list in Python?