Python
Python
2. How would you print out the informal, readable string representation of an
object?
a. repr()
b. str()
c. print()
d. eval()
6. Which of the following does the use of the self keyword in Python represent?
a. The instance of the class
b. The class of an instance
c. The variables of an instance outside the class
d. The variables of an instance inside the class
15. Which of the following is an invalid type for the max() function?
a. str
b. list
c. tuple
d. queue
16. What does this function do? num = int(input("Enter a number: ")) xxx = 1 if
num < 0: print(" xxx does not exist for negative numbers") elif num == 0:
print("The xxx of @ is 1") else: for i in range(1, num + 1): XXX = xxx*i
a. It deletes negative numbers from lists.
b. It calculates factorials.
c. It inverts lists.
d. It performs list comprehension.
a. [1,2,3,5]
b. 1
c. IndexError
d. 6