0 ratings0% found this document useful (0 votes) 203 views15 pagesPython Revision-Mcq - Move Fast With CS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
4 MOVE FAST WITH COMPUTER SCIENCE (Pyihon) ~ Xl
Multiple Choice Questions
G) Is Python case sensitive when dealing with identifiers ?
grves (0) no
~ (©) machine dependent (d) none of the mentioned
Q Which of the following is an invalid variable ?
(a) my_day_2 (by 2nd_day (c) Day_two (a) 2
@ Which of the following is not a keyword ?
(@éval (b) assert (©) nonlocal _@) pass
@ Which of the following cannot be a variable ?
(@) _init__ Lyin (c) it (d) on
Which of these is not a core data type ?
(@) Lists (0) Dictionary (©) Tuples (lass
© How would you write x¥ in Python as an expression ?
@ xy uaery
(xy (a) none of these
@ Which of the following is an invalid statement ?
(@) abe = 1,000,000 fa b c= 1000 2000 3000
(©) a, b, c= 1000, 2000, 3000 (d) a= b= = 1,000,000
@ Which value type does iny jut() return ?
(@) Boolean String (o) Int (@) Float
@% Given a function that does not return any value, what value is thrown by default
when executed in shell ?
(a) int () bool (© void \(anone
40) What will be the value of the expression ?
14+13%15
(a) 14 wr (0) 12 @o
3) Evaluate the expression given below if A=16 and B=15,
ALBI/A
(a) 0.0 vo (1.0 (@1
(13 What is the value of x ?
%© Ant(13.25 4.4/2)
(a) 17 waa 9 15 (23
(3. The expression 8/4/2 will evaluate eguival
(a) #1(4/2) ww
lent to which of the following expressions :
OBJECTIVE TYPE QUESTIONS TEUNIT: PROGRAMMING AND COMPUTATIONAL THINKING 5
GD) Which among the following list of op
+ **,%, 1, >, |
wn © (d) %
Which of the following expressions results
lors has the highest precedence ?
@>> X = 33 4
What would you fill in place of in the above expr
integer value ? Select all that apply (Python 3.xx)
@il / (% () All of the mentioned
G18. Which two operators can be used on numeric values in Python ?
(a) @ Le A (a #
019. Which of the following four code fragments will yield the following output ?
Eina
Mina
Dika
sion so that x has an
Select all of the function calls that result in this output
(a) print(** "ina
\nMina
\nDika''')
(b) print(**EinaMinaDika'**)
(c) print (*Eina\nMina\nbika* )
(@)— print(*eina
Mina
Dika')
@) Which of the following is valid arithmetic operator in Python ?
ot (ny? wx (a) and
61) Which operator is used ws
eck Whether two variables are the same ?
(a) - Mf ol We
62) Which one of these Is a floor division operator ?
@/ ) (% () None of the mentioned
£3) What ia the value ofthis expression : 22% Dis ?
c (7 yt (10 70
24.) What is the value of this expression : 22% 2.0 is?
(7 Wt AS 10 (70HH COMPUTER SCIENCE (Python) ~ Xi
6 Move FAST Wit
i ion, 3°13 ?
*) What is the output of this expression,
(a) 27 wo Las (a1
: i ion, 3*1"3 7
What is the value ofthis expression,
27 9 63 @1
what is the value of this expression 3°31 ? ;
27 9 (3 @1
What is the value of this expression, or?
(27 sy (3 @1
What is the value of the following expression ?
21//4+ 6/3
@?7 who (0 7.25 (@ 7.33
G0, What is the output of the following expression ?
print(4.00/(2.0+ 2.0))
(@) Exror S10 (© 1.00 @1
GI. Which of the following expressions involves implicit type promotion when evaluated
in Python ?
(@) 53 +18 (99% 41 (045 % 3 (71-36
32. What will be the output of the following expression ?
24//6%3, 24//4//2, 48//3//4
ay, 3, 4) © O34) (9 (1, 12, #error)
33. What is the output of the following expression ?
float (5 + int(4.39 + 2.1)%2)
(4.0 (5 (0 8.0 @s8
34. Which of the following expressions is an example of type casting ?
(G40 + float(6) (0) 5.3. + 6.3 (0) 5.0+3 AB int.) +7
35. Which type of error occurs when you execute the following code fragments ?
(a) SyntaxError (b) NameError (c) ValueError (d) TypeError
(a) (1, 3, #error)
>>> 126
(iii) >>> "abe! #4 ~4
(iv) >>> al=2
>>> ala
() >>> dnt ("21.23")UNIT I: PROGRAMMING AND COMPUTATIONAL THINKING
36. Which line of code has the correct syntax for the print statement ?
(a) print(Its’ a rainy day) (b) Print(‘it’s a rainy day’)
(c) print(‘it’s a rainy day”)
(@ print(‘it\’s a rainy day’)
37. You have the following code segment :
print(“Here we have a Line of text \n and \n we can do \newlines!")
What is the output of this code ?
()
()
©
@
Here we have a line of text and we can do newlines!
Here we have a line of text and
we can do newlines!
Here we have a line of text
and
we can do
newlines!
Here we have a line of text
and
we can do
ewlines!
38. Which code segment will output the number 20 to the console window ?
39.
@
()
©
(d)
myValue@1 = "10"
myValueg2 = "10"
myValuedi = myValue@1 + myValueo2
print (myValue@2)
myValueot = 10
myValue@2 = 10
myValuedd = myValue@1 + myValue@2
print (myValue@1)
MyValueot = 1
myValue02 = 10
print (myValue@1 + myValue@2)
10"
MyValuea:
myValue@2 = "10"
print (myValue@1 + myValue@2)
Which code segment will NOT reach its print( ) function ?
@
®
©
)
if "yes' t= ‘no’:
print ("condition met")
if yes’ I= "yes":
print("condition met")
no’:
if not 'yes’ :
print ("condition met")
If "yes" == "yes" :
print("condition met")st wit COMPUTER SC SCIENVE VO
move FA = FAS
ments will yield following output ?
lowing four code frag
40. Which of the foll
ziva ;
pi [Noticeblanklinesin between]
iva
Riva
is output
Select all of the function calls that result in this
(a print(‘'‘Ziva
\nDiva
\nRiva''')
(y_ print("* Zivabivariva’’ By
( _ print(‘Ziva\nDiva\nRiva’)
(@ print (‘Ziva
Diva
Riva’)
(> : a :
) The numbered position of a letter in a string 1s called
(a) position (b) integer position
(@) location
(oindex
tells if an element is present in a sequence or not.
2) 2) The operator _
(@) exists eri in (9 into (@ inside
(43) The keys of a dictionary must be of types.
(® mutable (0) immutable (@ any of these
(@) integer
(3D) iF the following set of commands is executed in shell, what will be the output ?
a
>>> str = “hello”
>>> str[:2]
>
one (6) lo (0) olleh (@) hello
(G)wrat data type is the object below ?
L=[1, 23, ‘hello’, 2]
(@) list (®) dictionary (0 array (@) tuple
(46) What data type is the object below ?
L=1, 23, ‘hello’, 1
P (a) list (b) dictionary (©) array (@) tuple
Gs i
7) oe aes values in terms of key and value, what core data type does Python provide ?
(a) list :
) list (b) tuple (0) class (@) dictionary
6. What is the
What is the value of the following expression ?
343.09, 3°¢3.0
(6.0, 27.0) (b) (6.0, 9,00)
6.0, 9.00)
(a) 16.0, 27.0) (016, 27) edUNIT 1: PROGRAMMING AND COMPUTATIONAL THINKING 9
49) List AL is defined as follows :
AL=[1, 2,3, 4,5]
Which of the following statements removes the middle element 3 from it so that the
list AL equals (1, 2, 4, 5] 2
(a) del a[2] (b) af2:3] = [ J (c) af2:2] = [ ]
(@) a[2] =[] (c) a.remove(3)
50. Which of the following are valid strings in Python ?
(a) This is a string () ‘This is a string’
(©) (This is a string) (@) “This is a string”
S1/ You have the following code segment :
String: "my"
String2 = “work”
print(Stringl + String2)
What is the output of this code ?
(a) my work (b) work orftywork (d) my
You have the following code segment :
String: ‘my”
String2 = "work"
print(Stringl + String2.upper())
What is the output of this code ?
(@ mywork MY Work (gmyWORK (@) My Work
63) Which line of code produces an error ?
(@) “one” + two’ (b) 142 (9 “one” +°2" gpa’ +2
54) What is the output of this code ?
>>> int("3"+"4")
(@“7" (b) ” So () 24
55. Considering the code given below, which line of code will cause an error ?
1. num=[5, 4, 3, [2], 1]
2. print(num[@])
3. print(num[3][@])
4. print(num[5])
(@) Line 3 (®) Line 2 (0) Line 4 (@) Line 1
56. Identify the valid declaration of L :
L=(1, 23, ‘hi’, 6]
(2) list () dictionary (0 array (@) tuple
57. Suppose s is assigned as follows :
$= ‘foobar’
All of the following expressions produce the same result except one. Which one ?
(@) sf :: 5] © sls:-Nl::-5) (©) ss: -ayf -1] + sflen(s)-1)
(d) s[0} + s[-1) (¢) s[:: 5] Ji10
8.
9,
60,
6
3
67.
69.
7
MOVE FAST WITH COMPUTER SCIENCE (Python) ~ Xi)
index ~I belongs to the of string.
Negativ
(a) first character (b) last character
(©) second last character (d) second character
Which of the following is/are not legal string operators ?
(a) in (+ (* @/
Which of the following functions will return the total number of cl
haracters in a
string ?
(a) count( ) (b) index( ) (c) len( ) (d) all of these
Which of the following functions will return the last three characters of a string s ?
(a) s[3:] (b) s[:3] (c) s[- 3:) (@) sf: - 3]
Which of the following functions will return the first three characters of a string 5?
(a) s{3:] (®) s[3] (0 sl- 3] (4) sl: - 3)
Which of the following functions will return the string in all caps ?
(@) upper( ) (b) toupper( ) (0) isupper( ) (4) to-upper( )
~ Which of the following functions will return the string with every ‘P’ replaced witha
22
(@) find) (b) index ) (0) replace( ) (@) split( )
- Which of the following functions will return a list containing all words of a string ?
(@) fina) (b) index( ) (©) pattition( ) (@) split( )
Which of the following functions will retum the always a tuple of 3 elements ?
(@) find( ) (®) index() (©) partition( ) (@) split( )
What is the output of the following code ?
str = "Mission 999";
str2 = "999"
print(stri.isdigit(), str2.isdigit())
(a) False True (b) False False (0) True False (a) True True
- Choose the correct function to get the ASCII code of a character.
(a) char(‘char’) (®) ord(‘char’) (©) ascii(‘char’) _—_(d) All of these
Which method should I use to convert String “Python programming is fun” to
“Python Programming Is Fun” ? is
(a) capitalize ) (0) titleQ) (c) istitle( ) (@) upper()
Guess the correct output of the following string operation.
sted = "Wah*
print(stra*2)
(a) WahWah
(b) TypeError: unsupported operand type(s) for*
(c) WWaahh
(d) Wah2
‘ste’ and ‘int’UNIT [: PROGRAMMING AND COMPUTATIONAL THINKING i
71, What is the output of the following strin
str
operation ?
"My roll no. is 12"
print(str.isalnum())
(a) True (b) False (0) Error (@) No output
72, Select the correct output of the following string operation.
str1 = 'Waha*
print (stri[:3] + ‘Bhyi' + stra[-3:])
(a) Wah Bhyi Wah () Wah Bhyi aha
(9 WahBhyiWah (@) WahBhyiWaha
73. Select the correct output of the following string operation.
str = “my name is Anu John”"
print (str.capitalize())
(a) ‘My name is anu john’
(b) TypeError: unsupported operand type(s) for * : ‘str’ and ‘int’
(0) ‘My name is Anu John’
(a) ‘My Name Is Anu John’
74. Choose the correct function to get the character from ASCII number.
(a) ascii(number) (®) char(number)
(© chr(number) (@ all of these
75. $=" (single space). Then s.isalnum( ) will return 5
(a) True (b) False (© Error (@) nothing
76, Which of the following functions removes all leading and trailing spaces from a
string ?
(a) Istrip( ) (© rstrip() (Q strip() (a) all of these
77. Which of the following functions will raise an error if the given substring is not found
in the string ?
(a) find) (b) index( ) (0) replace( ) (@) all of these
78. You have the following code segment +
string! = "my"
string2 = “work”
print (Stringl + String2)
What is the output of this code ?
(@) my work (b) work (©) mywork (a) my
79. List can contain values of these types :
(a) integers (b) floats (0 lists (a) tuples
(6) all of these
80. Which of the following will create an empty list ?
(@L=[] (b) L = list() (0) L = list() (d) L = List(empty)- xil
rove east vm COMPUTER SCIENCE (hon) =H
12
oo fhe last element of a list L with 5 elements >
the following will return #
81 He he (b) L[4] () L A) @ Le)
(a)
SALE
8: L=[(1, 2] then L 2 will yiel
* zy qr2 () 11,22) (9 (1, 1, 2, 2) 121,
If L1 = [1, 3, 5] and L2 = 2, 4, 6] then L1+L2will yield
(123,456) (1 3,5,2,4, 6]
©1711) (@ (1,3, 5, 2, 4, 6}
84. Given a list L = [10, 20, 30, 40, 50, 60, 70], what would L{1 : 4] return ?
83.
(a) {10, 20, 30, 40) (b) (20, 30, 40, 50}
(0 [20, 30, 40] (4) [30, 40, 50]
$5. Given a list L = [10, 20, 30, 40, 50, 60, 70], what would L{2 : -2] return ?
(a) [10, 20, 30, 40} (6) [20, 30, 40, 50)
(©) [20, 30, 40] (d) (30, 40, 50]
86. Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[+4 : -1] return ?
(@) (20, 30, 40] (®) [30, 40, 50]
(c) [40, 50, 60) (a) [50, 60, 70]
87. Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[-3 : 99] return ?
(@) (20, 30, 40) (®) [80, 40, 50]
(©) (40, 50, 60] (@) [50, 60, 70)
88. To find the last element of list namely ‘smiles’ in Python, ____willl be used.
(@) smiles[0] (b) smiles{—1] (Q) smiles[Ipos]___(d) smiles{:—1]
89. Out of the following, what is the correct syntax to copy one list into another ?
(a) listA = listB[ ] (b) lista
(0) listA = listB[ ]() (@) lista =
90. What is printed by the following Python code ?
print (1ist(range(3)))
@ (0, 1, 2, 3] ®) (1,2, 3] (© (0,1, 2] (4) 0,1,2
91. Which of the following commands will create a list 2
(@) list = list( ) (©) list = []
(0) listt = list({1, 2, 3)) (@) all of these
92. What is the output when we execute list(“hello”) ?
() Uh, “ec, 'Y, V, ‘o'] © [hello’]
(© [Mo'} (@) [olleh’]
93. What gets printed when the following code is executed ?
nanes~= (‘Hasan', ‘Balwant’, *Sean*, ‘Dia")
print (names[-1][-1])
@H ®n (©) Hasan @) Dia
@aof,
95.
96,
97.
105.
106.
UNL PROGRAMMING AND COMPUIANONAL tHNKNG «13
What is the output of the following code ?
1= [None] * 10
print(1en(1))
(10 On
Consider the list aList
(©) Syntax Error (d) None
["SIPO", [1, 3, 5, 7] |. What would the following code print ?
print( alist(0}[1] , atist(1](2])
{a) 8,3 (0) S,1 (13 (@L1
Which of the following is a standard Python library function and not an exclusively
list function ?
(a) append( ) (b) remove( ) (c) pop() (a) len()
Which of the following can add only one value to a list ?
(a) add) (b) append( ) (©) extend( ) (d) none of these
. Which of the following can add a list of elements to a list ?
(a) add) (®) append( ) (0) extend( ) (@) none of these
Which of the following will always return a list ?
(a) max( ) (© min() (0) sort( ) (d) sorted( )
|. Which of the following can delete an element from a list if the index of the element is
given ?
(@) pop() (®) remove( ) (0) del (d) all of these
. Which of the following can delete an element from a list, if its value is given ?
(@) pop() © remove ) (0) del (@) all of these
Which of the following searches for an element in a list and returns its index ?
(@) search( ) (® find( ) (0) index( ) (@) Isearch( )
. Which of the following can copy a list to another list ?
(a) list() (b) new( ) (0) copy() (d) = operator
Which of the following statements will-create a tuple ?
@ tpl=('a", “b") ©) tpIIe(’a", “”)
(©) tp1=(3)"3 (d) None of these
Choose the correct statement(s).
(a) Both tuples and lists are immutable.
(b) Tuples are immutable while lists are mutable.
(© Both tuples and lists are mutable.
(@) Tuples are mutable while lists are immutable.
Choose the correct statement(s).
(@) In Python, a tuple can contain only integers as its elements.
() In Python, a tuple can contain only strings as its elements
(©) In Python, a tuple can contain elements of different types.
(@) In Python, a tuple can contain either string or integer but not both at a time.ple(s) ?
17. Which of the following is/are correctly declared tu
= (a) a= ("Hina®, "Aina", “Tina”, “Nina")
2) poe)
(c) a=("Hina", “Mina’
(@) a= ({"Hina”, "Mina"
a="Hina”, "Mina", “Tina”, "Nina”)
108. Which of the following will create a single element tuple ?
(@) () () (1) © (f)) (4) tuple({1})
109. What will be the output of the following Python code ?
tpl = (2,4,3)
tp3=tp1"2
print(tp3)
(a) (48,6) (b) (2,4,3,2,4,3) (9) (2,2,4,4,3,3) (@) Error
110. What will be the output of the following Python code ?
tpl = (15,11,17,16,12)
tp1.pop(12)
print(tp1)
(@) (15,11,1612) (6) (13,1,17,16)—(c) (13,11,17,16,12) (a) Error
111, Which of the following options will not result in an error when performed on types in
Python where tp = (5,2,7,0,3) ?
(a) tp[a] = 2 (b) tp.append(2)
(Q tpi=tp+tp (@) tp.sum()
112. What will be the output of the following Python code ?
te=()
tpl=tp*2
print(len(tp1))
0 2 1 (@) Error
113. What will be the output of the following Python code ?
tp=(5)
tpi=tp*2
print(len(tp1))
(a0 2 @1 (@ Exror
114. What will be the output of the following Python code ?
tp=(5,)
tpl=tp*2
print (len(tp1))
@o 2 1 (@) Error
115, Given tp = (5,3.1,9.0). Which of the following two statements will give the same
output ?
(i) print( tp[:-2) ) (i print( tp[e:5] )
(iil) print( tp{e:4) ) (io) print( tp[-4:] )
(a) (i), (i) () (ii), (iv) © (, (i) (4 (, (ityUNIT I: PROGRAMMING AND COMPUTATIONAL THINKING 15
116, What is the output of the following code ?
t= (10, 20, 30, 40, 50, 50, 70)
print(t[5:-1])
(@ Blank output( ) (b) (60,70)
(©) 60,50,70) (a) (60,)
117. What is the output of the following code ?
t= (10, 20, 30, 40, 50, 60, 70)
print(t[S:-1])
(a) Blank output() () (10, 20, 30, 40, 50)
(©) (10, 30, 50, 70) (@) (10, 20, 30, 40, 50, 60, 70)
18. Which of the below given functions cannot be used with nested tuples ?
(a) index( ) (b) count( ) (©) max( ) (@ sum()
119. What will be the output of the following code ? {Textbook Q., Chapter 2 (Type B)]
tuple_a='a", 'b’
tuple_b=(‘a', 'b')
print (tuple_a == tuple_b)
(a0 (1 (c) False @ True
120. Which is the correct form of declaration of a dictionary ?
(@) Day = (1Monday’, 2:Tuesday’, 3:' wednesday}
(®) Day = {1Monday’, 2;"Tuesday’, 3;wednesday’)
(©) Day = [1Monday’, 2: Tuesday’, 3:'wednesday']
(@ Day = (1'monday’, 2'tuesday’, 3'wednesday’}
121. Dictionaries are set of elements.
(@) sorted (®) ordered (©) unordered (@ random
122. Dictionaries are also called
(@) mappings (¥) hashes
(0) associative arrays (@) all of these
123. Dictionaries are data types of Python.
(a) mutable () immutable (© simple (@) all of these
124. Which of the following functions will return the key, value pairs of a dictionary ?
(a) keys( ) (®) values( ) (6) items( ) (@) all of these
125, Which of the following will add a key to the dictionary only if it does not already exist
in the dictionary ?
(a) fromkeys( ) (® update ) (0) setdefault() —_(d) all of these
126. Which of the following will create a dictionary with given keys and a common value?
(a) fromkeys( ) (®) update ) (0) setdefault() __(d) all of these
127. Which value is assigned to keys, if no value is specified with the fromkeys( method ?
(ayo 1 (©) None (a) any of theseCIENCE (Python) — Xit
MOVE FAST WITH COMPUTER SCIENCE (Python) ~ Xit
16 Fas a =
Which of the following can be used to delete item(s) from a dictionary
128. hich of ,
(a) del statement () pop( ) (©) popitem( ) (4) all of these
Which of the following will raise an error if the Biven key is not foung ng
dictionary ? ,
(2) del statement (b) pop( ) (©) popitem( ) (4) all of these
1X) Which of the following will raise an error if the given dictionary is empty >
(a) del statement (b) Pop( ) (©) popitem( ) (d) all of these
ISLA copy of the dictionary where only the Copy of the keys is created fog the ney
dictionary, is called copy.
(2) key copy (b) shallow copy
(@) partial copy
A copy of the dictionary where the copy of the keys as well as th;
the new dictionary, is called copy.
(2) key copy
(9) deep copy
(©) deep copy
fe values is created fy
(6) shallow copy
(@) partial copy
15S. Which of the following is correct with Tespect to above Python code ?
=a": 3,"b": 7)
(4) a dictionary d is created,
(6) a and b are the keys of dictionary d,
(93 and 7 are the values of dictionary d.
(@) All of these.
1s What would the following code print ?
$= {'spring': "autunn’, ‘autumn’: ‘fall,
print (df ‘autuan')
(@) autumn (6) fall (© spring (@) Exror
What is printed by the following statements 2
Dis {("cat":12, “dog*:6,
Print("dog" ini)
“fall': ‘spring'}
» “elephant":23, “bear":29)
(@) True () False (¢) Error (d) None
1% What is printed by the following statements ?
OL=("cat:12, “dog" : 6, “elephant":23, “bear”: 20}
Print (25 ini)
(a) True (0) False (© Error (d) None
157, What will be the result of the
following code ?
d= ("abs der 6,"Bhins7)
print(d1[6})
(a) abc (6) 5
(©) Mabers5) (@) Error= UNIT L: PROGRAMMING AND COMPUTATIONAL THINKING 17
138. What will the following code do ?
dict = {"Phy":94, "Che":7@, "Bio" :82,"Eng":95}
dict .update({"Che":72, "Bio" :80})
(a) It will create new dictionary as
dict = {"Che":72,"B10":80} and old dict will be deleted.
(¥) It will throw an error as dictionary cannot be updated,
(6) It sill simply update the dictionary as
dict = {"Phy":94, "Che":72, "Bio":80, "Eng":95}..
(@) It will not throw any error but it will not do any changes in dict.
139. What will be the result of the following code?
dict
dict.update({"Phoebe":2})
print (dict)
(@) {"Jo":1,"Ra":2,"Ph":2} (®) ("Jo":1,"Ra”:2}
(©) ("Jo":1,"Ph":2} (@) Error
140. Which of the following will delete key:value pair for key="tiger" in dictionary?
di={"lion": "wild", "tiger":"wild”, "cat": “domestic”, "dog”:"domestic"}
(a) del dif’tiger”] (®) dif”tiger”].delete( )
(©) delete(di.{”tiger”}) (a) del(di.["tiger”})
141. Which of the following will give error if d1 is as shown below?
di
(2) print(len(d1)) (® print(d1.get(b”))
(© dif’a"}-5 (@) None of these
142. Which of the following Python codes will give the same output if
dict = ("diary":1, "book":3,"novel":5}
(0 dictpop(“book”) (ii) del dict{“book”] (iii) dict.update((“diary”:1,"novel”:5})
(@) @, (i), Gi) &) @, @ (©) @, Gi) (@) Gi, (iii)
143. What will be the output of following Python code ?
di = {"a":10,"b":2,"c":3}
strl-stri+str(di[i])+" "
str2=stri[:-1]
print(str2{::-1])
(3,2 () 3, 2, 10 © 3,2,01 (@) Error
Running the code sorted(my_dictionary, reverse = True) on a dictionary named my_dictionary
will return results sorted in what order ?
(@) Ascending order (A-Z), by key
(©) Descending order (Z-A), by key
144,
(b) Ascending order (A-Z), by value
(@) Descending order (Z-A), by value18 MOVE FAST WITH COMPUTER ScIENCE (Python) = XH
lus. What will be the output of the following code snippet? [TB Q,, Chapter 2 i.
rec = {"Name" 0", "Addr" = "NI", "Country" + #y a dy
id1 = id(rec) "USA"
del rec
rec ={"Name" : "Python", "Age"
id2 = id(rec)
print (idi == id2)
(b) False (1 ae
: "python", "Age"
0", "Addr" :"NJ", "Country" : “usar
(a) True