# Python Quizzes

## Results

 -
Share to Your Friend                Related Posts  Matplotlib in Python
Share to Your Friend                Related Posts  Tuples in Python



###  #1 Which is a valid identifier in Python?

 DATA-REC
 29CLCT
 _DS
 del
Correct option is _DSOption DATA-REC is false because -(hyphen)  can not be part of an identifier. (adsbygoogle = window.adsbygoogle || []).push({}); Option 29CLCT is false because 29( a number i)  can be part of  an identifier, however, it can not be at the beginning. Related Posts  Bubble Sort in Python

###  #2 If s is a set having elements s={1,2,3,4,5,6}, what would be the output of the above program ?

 1 3 5
 2 3 5
 2 4 6
 1 1 1
Explanation-for loop iterates over set s, and it first stores values  in item variable (adsbygoogle = window.adsbygoogle || []).push({}); if checks whether 1 % 2  which is equal to 1 And Python treats non-zero numbers as True  then it prints  value of item which is 1 if checks whether 2 % 2  which is equal to 0And Python treats zero as False  and  control does not enter in if blockif checks whether 3 % 2  which is equal to 1And Python treats non-zero numbers as True  then it prints   value of item which is 3 if checks whether 4% 2  which is equal to 0And Python treats zero as False  and does not enter in if blockRelated Posts  Bubble Sort in Pythonif checks whether 5% 2  which is equal to 1And Python treats non-zero numbers as True  then it prints  value of item which is 5 if checks whether 2 % 2  which is equal to 0And Python treats zero as False  and does not enter in if blockAnswer is 1 3 5

###  #3 If d is a dictionary having elements d={‘India’:’New Delhi’, ‘Germany’:’Berlin’, ‘France’:’Paris’, ‘Spain’:’Madrid’}, how will value ‘Berlin’ be accessed.

 d[1]
 d[2]
 d['Germany']
Click on the  below link to see the explanationDictionary in Python Related Posts  Decision Making in Python

###  #4 A tuple in Python is

 Mutable(Changeble)
 Immutable(Unchangeble)
Click on the below link to see the explanationTuples in Python   Related Posts  Dictionary in Python

###  #5 If t is a tuple having elements t=(1,2,3,4,5,6), how will element 5 be printed?

 t[-2]
 t[4]
 t[5]
 t[-2] and [4]
 t[-2] and [5]
Click on the below link to see the explanationTuples in Python Related Posts  Variable Declaration and Definition in Python

###  #6 If a nested list is a=[3,5,8,4,15,34,[5,8,[-4,-8],9,3], 8,9,[6,9],12,7], then how which index you will use to access element -8.

 a[6][3][1]
 a[6][2][1]
 a[10]
 a[1][2][2]
Click on the link to see the explanationhttps://www.postnetwork.co/nested-lists-in-python/    Related Posts  How Do API Key Work?

###  #7 What would be the output of the above program? (See ASCII code table corresponding to hexadecimal values)

 HELLO
 HAPPY

###  #8 Which one is a Boolean literal in Python?

 T
 True
 1

###  #9 Which one is a special literal in Python?

 No
 Null
 None

###  #10 Which quotation mark can be used for a multiline string?

 Single quotation mark
 Double quotation marks
 Triple quotation marks

###  #11 Which option is correct?

 a
 b
 c
 a and b
 a, b and c
 None of the above
None of the above is correct because  opening quotation is triple but closing is double. So, there would be an error Related Posts  File Handling in Python