Python Test 6

More Python Tests

Question 1: Variable used inside a function become its ________.

Question 2: What will be the output of the following code?

a=10
def myfunction():
    a=20
    return
print ('a=',a)

Question 3: What is the output of the following code?

fn = lambda x : x * x
print(fn(8))

Question 4: What will be the output of the following code?

def display(x, y, z):
    print(x, y, z)

tpl = (5, 10, 15)
display(*tpl)

Question 5: Which of these is not a built-in module in Python distribution?

Question 6: What does the print(randrange(1,10)) statement do?

Question 7: Which of the following is not a module attribute?

Question 8: Which of the following is an incorrect syntax?

Question 9: Which tool is used to install packages from PyPI into your Python program?

Question 10: Which of the followings can be a part of a class in Python?

Question 11: What is self in Python?

Question 12: How to define a property in the class in Python?

Question 13: Instance variables and methods in the Python class are:

Question 14: Which of the following is the correct syntax of inheritance?

Question 15: What are the dunder (magic) methods in Python?