Python Week 3 Quiz Answers



Disclaimer for Pruto-ai

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 contact@prutor-ai.com.

All the information on this website is published in good faith and for general information and educational purpose only. Prutor-ai 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 (Prutor-ai.blogspot.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.

In this students get weekly assignments that they have to complete every week. Here we will show you or give you all the answers for the python quiz, These answers are for all those who have confusion in the questions or they don’t want to submit wrong answers.

 or if you haven’t, then its a good time to check the answers first and then submit.

Q:1. If :-
        A=set('python')
        B=set('programming')
        Then what will be the output of print(A-B) ?
        Note :- The Order of output may change.

 

1. {'m', 'r', 'i'}

2. {'m', 'r', 'g', 'a', 'i'}

3. {'h', 'y', 't'}

4. {'y', 'h', 't', 'a'}

Answer: {'h', 'y', 't'}

Reason: We have to subtract A-B therefore p,o and n is subtracted from the python.

Q:2. What will be the outcome of the following code?
        count=40
        print(count>=30 and count<39)

1. True

2. False

3. Error

4. None of the Above

Answer: False

Reason: As the count=40 it does not satisfies the condition print(count>=30 and count<39) and hence False print.

Q:3. If we have a list as :-
names=['abhay', 'mahesh', 'prashant', 'sandeep'] , then what does the following statement do:
'rakesh' in names

 

1. checks if ‘rakesh’ is there in names

2. deletes ‘rakesh’ from names

3. add ‘raksesh’ to names

4. append names with ‘rakesh’

Answer: checks if ‘rakesh’ is there in names

Reason: Due to “in” it checks if “rakesh” is there in name or not.

 

Q:4. What will be the output of the following code?
        print( (3 < 1) and (4/0 > 1))

1. False

2. True

3. Run-time error

4. None of the above

Answer: False

Reason: As the condition is not satisfied therefore it print False.

 

Q:5. In Python 'And' and 'Or' operators are also called:

1. Short circuit operators

2. Logical operators

3. Both A and B

4. None of the above

Answer: Both A and B

Reason: Execution of Boolean operation if the truth value of expression has been determined already.