# Python Programming Quiz – 3rd Week Quiz Solution

0
3200

## Disclaimer for ReGyan

### 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.

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.

## Python Programming 3rd Week Quiz Solution

  What will be the output of the following? a=[1,2,3,4,5,6] b=[q for q in a if q%2==0]            print(b)

• (a): 2,4,6
• (b): false
• (c): 1,3,5
• (d): 0

 What will be the third item in the following? n=[-1,2,3,-4,5,-6] a=[(x, abs(x)) for x in n] print(a)

• (a): (-4,4)
• (b): (3,3)
• (c): (2,2)
• (d): (-1,1)

 If A=set(‘python’) and B=set(‘programming’) What is the output of A-B ?

• (a): {‘m’, ‘r’, ‘i’}
• (b): {‘m’, ‘r’, ‘g’, ‘a’, ‘i’}
• (c): {‘h’, ‘y’, ‘t’}
• (d): {‘y’, ‘h’, ‘t’, ‘a’}

 What will be the output of the following? a=5 if a=6: print(“Hello!”) else: print(“Hi”)

• (a): HelloHi
• (b): Hello
• (c): Hi
• (d): Error

Also read:- How to Increase eyesight in a week

 If A=set(‘apple’, ‘orange’, ‘pear’) then what is the class of A ?

• (a): list
• (b): tuple
• (c): int
• (d): set

 What should be the outcome of the following? count=40 count>=30 and count<39

• (a): True
• (b): False
• (c): Error
• (d): None of above

 If names=[‘abhay’, ‘mahesh’, ‘prashant’, ‘sandeep’] , what does the following statement do: ‘rakesh’ in names

• (a): checks if ‘rakesh’ is there in names
• (b): deletes ‘rakesh’ from names
• (c): add ‘raksesh’ to names
• (d): append names with ‘rakesh’
Answer: (a) checks if ‘rakesh’ is there in names

 If you want to check if the age is equal to or greater than 18, what should                 come  in the blank: if age___18: print(“You can vote.”)

• (a): <
• (b): >!
• (c): <=
• (d):>=

 If names=[‘monu’,’raman’,’shikhar’] , What will be the outcome of the following? if             ‘david’ in names: print (“It’s David”) elif ‘monu’ in names: print (“It’s Monu”) elif                 ‘shyam’ in names: print(“It’s Shyam”)

• (a): Error
• (b): It’s David
• (c): It’s Monu
• (d): It’s Shyam

 What will be the output of the following code: a=10 if a%2==0: print (“Even”) else:           print (“Odd”)

• (a): None of the following
• (b): Error
• (c): Odd
• (d): Even

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

• (a): elif
• (b): elseif
• (c): elsif
• (d): ifelse

 if statements in Python should be:

• (a): maintainable
• (c): efficient
• (d): all of the above

Answer: (d) all of the above

 What will be the output of the following? (3 < 1) and (4/0 > 1)

• (a): False
• (b): True
• (c): Run-time error
• (d): None of the above

 In Python ‘And’ and ‘Or’ operators are also called:

• (a): Short circuit operators
• (b): Logical operators
• (c): Both A and B
• (d): None of the above

Answer: (c) Both A and B

 In the following statement, which operation will be evaluated first according to the order of precedence of operators in Python? (3*20+5)-16/4

• (a): (3*20+5)
• (b): 16/4
• (c): 20+5
• (d):3*20