Header Ads Widget

Responsive Advertisement

Python Programming Special Quiz Answer [Python Programming course on Prutor.ai by IIT kharagpur]

Here you will get all the assignment and quiz solutions of Python Programming Course by prutor.ai. Prutor is an online smart tutoring platform which provides various MOOC courses for student and organised by by IIT Kharagpur. At the end of each course student gets a certificate for sucessfull  completion of each course but throughout the course students have to pass all the weekly assignments and quizes.

Q:1. Which function is used to get rid of the blank spaces on the left?

1. strip()

2. left()

3. rstrip()

4. lstrip()




Answer- 4. lstrip()

Q:2. How is a line, or a group of lines related to the rest of the program?

1. square brackets []

2. indentation

3. braces {}

4. parentheses ()

Answer: (b) indentation

Q:3. if statement along with an else statement in Python is called ______ statement.

1. elif

2. elseif

3. elsif

4. ifelse

Answer: 1. elif

Q:4. We have an empty dictionary declared as dict = {}. Which of the following is correct way to add key-value pairs in it.

1. dict[‘value’] = ‘key’

2. dict[‘key’] = ‘value’

3. dict.append(‘key’)=’value’

4. None of the above




Answer: – 2. dict[‘key’] = ‘value’

Q:5. What does the following Python3 code do? (using python 3.X version) n = int(input(‘Enter a number?’))
i = 1
while i <= n:
i = i+1
print (i)

1. Print all integers from 1 to n

2. Print all integers from 1 to n-1

3. Print all integers from 2 to n

4. Print all integers from 2 to n+1

Answer: – 4. Print all integers from 2 to n+1

Q:6. Assume that the “min” function computes the minimum of two values, and “max” function computes the maximum of two values. Let x1, x2, x3 and x4 be 4 distinct integers. What can you say about the following program (using python 3.X version):
y1 = min(x1, x2)
y2 = min(x3, x4)
y3 = max(y1, y2)




1. y3 is the largest integer among x1, x2, x3, x4.

2. y3 is either the largest or the second largest integer among x1, x2, x3, x4.

3. y3 is either the second largest or the third largest integer among x1, x2, x3, x4.

4. y3 is the third largest integer among x1, x2, x3, x4.

Answer: – 3. y3 is either the second largest or the third largest integer among x1, x2, x3, x4.

Q:7. Select the correct alternative for special method __init__ in python –

1. Is used to create a new object for a class

2. Only one constructor is allowed per class

3. Uses default arguments

4. All of the above

Answer: – 4. All of the above

Q:8. A class can inherit attributes and methods from another class, this another class is then called –

1. subclass

2. superclass

3. childclass

4. heirclass




Answer: – 2. superclass

Q:9. The readlines() method returns ____________

1. str

2. a list of lines

3. a list of single characters

4. a list of integers

Answer: – 2. a list of lines

Q:10. In recursion,

1. Absence of base condition can cause infinite loop

2. There can be more than one base cases

3. Both 1 and 2

4. None of the above




Answer: – 3. Both 1 and 2


 If you have any quetions, please comment down below, we will try to answer with in first 24 hour. Hope you liked this content, We will come with another week’s quiz, Thanks for reading. Good Bye.

Post a Comment

0 Comments