Python Programming Special Quiz Answer 2020

12
3181
Python Programming Special Quiz Answer
Python Programming Special Quiz Answer

Disclaimer for ReGyan

If you require any more information or you have any problem regarding Copyright or have any questions about our site’s disclaimer, please feel free to contact us by email at [email protected].

 


Disclaimers for ReGyan

All the information on this website is published in good faith and for general information and educational purpose only. ReGyan does not make any warranties about the completeness, reliability, and accuracy of this information. Any action you take upon the information you find on this website (regyan.com), is strictly at your own risk. will not be liable for any losses and/or damages in connection with the use of our website.

Python Programming Special Quiz Answer 2020 is given below.

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

Also See:- Computer Science and Engineering Junior Research Fellowship 2020

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

That’s all for the Python programming special quiz answer. if you have any questions, please comment down below, we will try to answer with in the first 24 hours. I hope you liked this content.

12 COMMENTS

  1. Your answer for question 6 is wrong.
    Answer of question 6 is
    3. y3 is either the second largest or the third largest integer among x1, x2, x3, x4.

  2. In question (4) dict[‘key’] = ‘value’ will raise an error. We need to use proper single ‘ ‘ or double ” ” quotes.

LEAVE A REPLY

Please enter your comment!
Please enter your name here