Deck 1: Python Programming: Output and Data Types

Full screen (f)
exit full mode
Question
What is the output of the following code :
Print 9//2

A)4.5
B)4.0
C)4
D)Error
Use Space or
up arrow
down arrow
to flip the card.
Question
Which function overloads the >> operator?

A)more()
B)gt()
C)ge()
D)rshift()
Question
What is the output of the following program :
I = 0
While i < 3:
Print i
Print i+1

A)0 2 1 3 2 4
B)0 1 2 3 4 5
C)0 1 1 2 2 3
D)1 0 2 4 3 5
Question
Which module in Python supports regular expressions?

A)re
B)regex
C)pyregex
D)None of the above
Question
What is the output of the following program :
Print 0.1 + 0.2 == 0.3

A)True
B)False
C)Machine dependent
D)Error
Question
Which of these is not a core data type?

A)Lists
B)Dictionary
C)Tuples
D)Class
Question
What data type is the object below?
L = [1, 23, „hello?, 1]

A)List
B)Dictionary
C)Tuple
D)Array
Question
What is the output of the following program :
Def myfunc(a):
A = a + 2
A = a * 2
Return a
Print myfunc(2)

A)8
B)16
C)Indentation Error
D)Runtime Error
Question
What is the output of the expression : 3*1**3

A)27
B)9
C)3
D)1
Question
What is the output of the following program :
Print '{0:.2}'.format(1.0 / 3)

A)0.333333
B)0.33
C)0.333333:-2
D)Error
Question
What is the output of the following program :
Print '{0:-2%}'.format(1.0 / 3)

A)0.33
B)0.33%
C)33.33%
D)33%
Question
What is the output of the following program :
I = 0
While i < 3:
Print I
I += 1
Else:
Print 0

A)0 1 2 3 0
B)0 1 2 0
C)0 1 2
D)Error
Question
What is the output of the following program :
I = 0
While i < 5:
Print(i)
I += 1
If i == 3:
Break
Else:
Print(0)

A)0 1 2 0
B)0 1 2
C)Error
D)None of the above
Question
What is the output of the following program :
Print 'cd'.partition('cd')

A)(„cd?)
B)(")
C)(„cd?, ", ")
D)(", „cd?, ")
Question
What is the output of the following program :
Print 'abcefd'.replace('cd', '12')

A)ab1ef2
B)abcefd
C)ab1efd
D)ab12ed2
Question
What will be displayed by the following code?
Def f(value, values):
V = 1
Values[0] = 44
T = 3
V = [1, 2, 3]
F(t, v)
Print(t, v[0])

A)1 1
B)1 44
C)3 1
D)3 44
Question
Predict the output of following python programs
Dictionary1 = {'Google' : 1,'Facebook' : 2,'Microsoft' : 3}
Dictionary2 = {'GFG' : 1,'Microsoft' : 2,'Youtube' : 3}
Dictionary1.update(dictionary2);
For key, values in dictionary1.items():
Print(key, values)

A)Compilation error
B)Runtime error
C)(„Google?, 1)
(„Facebook?, 2)
(„Youtube?, 3)
(„Microsoft?, 2)
(„GFG?, 1)
D)None of these
Question
What is the output of the following program?
Dictionary1 = {'GFG' : 1,'Google' : 2,'GFG' : 3}
Print(dictionary1['GFG']);

A)Compilation error due to duplicate keys
B)Runtime time error due to duplicate keys
C)3
D)1
Question
What is the output of the following program?
Temp = dict()
Temp['key1'] = {'key1' : 44, 'key2' : 566}
Temp['key2'] = [1, 2, 3, 4]
For (key, values) in temp.items():
Print(values, end = "")

A)Compilation error
B){„key1?: 44, „key2?: 566}[1, 2, 3, 4]
C)Runtime error
D)None of the above
Question
What is the output of the following program?
Data = [2, 3, 9]
Temp = [[x for x in[data]]
For x in range(3)]
Print (temp)

A)[[[2, 3, 9]], [[2, 3, 9]], [[2, 3, 9]]]
B)[[2, 3, 9], [2, 3, 9], [2, 3, 9]]
C)[[[2, 3, 9]], [[2, 3, 9]]]
D)None of these
Question
What is the output of the following program?
Data = [x for x in range(5)]
Temp = [x for x in range(7) if x in data and x%2==0]
Print(temp)

A)[0, 2, 4, 6]
B)[0, 2, 4]
C)[0, 1, 2, 3, 4, 5]
D)Runtime error
Question
What is the output of the following program?
L1 = [1, 2, 3, 4]
L2 = L1
L3 = L1.copy()
L4 = list(L1)
L1[0] = [5]
Print(L1, L2, L3, L4)

A)[5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]
B)[[5], 2, 3, 4] [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4]
C)[5, 2, 3, 4] [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4]
D)[[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]
Question
What is the output of the following program?
Import sys
L1 = tuple()
Print(sys.getsizeof(L1), end = " ")
L1 = (1, 2)print(sys.getsizeof(L1), end = " ")
L1 = (1, 3, (4, 5))
Print(sys.getsizeof(L1), end = " ")
L1 = (1, 2, 3, 4, 5, [3, 4], 'p', '8', 9.777, (1, 3))
Print(sys.getsizeof(L1))

A)0 2 3 10
B)32 34 35 42
C)48 64 72 128
D)48 144 192 480
Question
What is the output of the following program?
T = (1, 2, 3, 4, 5, 6, 7, 8)
Print(T[T.index(5)], end = " ")
Print(T[T[T[6]-3]-6])

A)4 0
B)5 8
C)5 IndexError
D)4 1
Question
What is the output of the following program?
L = [1, 3, 5, 7, 9]
Print(L.pop(-3), end = ' ')
Print(L.remove(L[0]), end = ' ')
Print(L)

A)5 None [3, 7, 9]
B)5 1 [3, 7, 9]
C)5 1 [3, 7, 9].
D)5 None [1, 3, 7, 9]
Question
What is the output of the following program?
Def REVERSE(L):
(L)reverse()
Return(L)
Def YKNJS(L):
List = list()
List.extend(REVERSE(L))
Print(List)
L = [1, 3.1, 5.31, 7.531]
YKNJS(L )

A)[1, 3.1, 5.31, 7.531]
B)[7.531, 5.31, 3.1, 1]
C)IndexError
D)AttributeError: „NoneType? object has no attribute „REVERSE?
Question
What is the output of the following program?
From math import sqrt
L1 = [x**2
For x in range(10)].pop()
L1 + = 19print(sqrt(L1), end = " ")
L1 = [x**2 for x in reversed(range(10))].pop()
L1 + = 16
Print(int(sqrt(L1)))

A)10.0 4.0
B)4.3588 4
C)10 .0 4
D)10.0 0
Question
What is the output of the following program?
D = dict()
For x in enumerate(range(2)):
D[x[0]] = x[1]
D[x[1]+7] = x[0]
Print(D)

A)KeyError
B){0: 1, 7: 0, 1: 1, 8: 0}
C){0: 0, 7: 0, 1: 1, 8: 1}
D){1: 1, 7: 2, 0: 1, 8: 1}
Question
What is the output of the following program?
D = {1 : 1, 2 : '2', '1' : 1, '2' : 3}
D['1'] = 2
Print(D[D[D[str(D[1])]]])

A)2
B)3
C)„2?
D)KeyError
Question
What is the output of the following program?
D = dict()
For i in range (3):
For j in range(2):
D[i] = j
Print(D)

A){0: 0, 1: 0, 2: 0}
B){0: 1, 1: 1, 2: 1}
C){0: 0, 1: 0, 2: 0, 0: 1, 1: 1, 2: 1}
D)TypeError: Immutable object
Question
What is the output of the following program?
From math import *
A = 2.13b = 3.7777
C = -3.12
Print(int(a), floor(b), ceil(c), fabs(c))

A)2 3 -4 3
B)2 3 -3 3.12
C)2 4 -3 3
D)2 3 -4 3.12
Question
What is the output of the following program?
Import string
Line1 = "And Then There Were None"
Line2 = "Famous In Love"
Line3 = "Famous Were The Kol And Klaus"
Line4 = Line1 + Line2 + Line3
Print(string.find(Line1, 'Were'), string.count((Line4), 'And'))

A)True 1
B)15 2
C)(15, 2)
D)True 2
Question
What is the output of the following program?line = "What will have so will"L = line.split('a')for i in L:print(i, end=' ')

A)[„What?, „will?, „have?, „so?, „will?]
B)Wh t will h ve so will
C)What will have so will
D)[„Wh?, „t will h?, „ve so will?]
Question
What is the type of each element in sys.argv?

A)set
B)list
C)tuple
D)string
Question
What is the length of sys.argv?

A)number of arguments
B)number of arguments + 1
C)number of arguments - 1
D)none of the mentioned
Question
What is the output of the following code?
Def foo(k):
K[0] = 1
Q = [0]
Foo(q)
Print(q)

A)[0].
B)[1].
C)[1, 0].
D)[0, 1].
Question
What is the output of the following code?
Def foo(fname, val):
Print(fname(val))
Foo(max, [1, 2, 3])
Foo(min, [1, 2, 3])

A)3 1
B)1 3
C)error
D)none of the mentioned
Question
What is the output of the following?
Elements = [0, 1, 2]
Def incr(x):
Return x+1
Print(list(map(elements, incr)))

A)[1, 2, 3].
B)[0, 1, 2].
C)error
D)none of the mentioned
Question
What is the output of the following?
Elements = [0, 1, 2]
Def incr(x):
Return x+1
Print(list(map(incr, elements)))

A)[1, 2, 3].
B)[0, 1, 2].
C)error
D)none of the mentioned
Question
What is the output of the following?
Def to_upper(k):
Return k.upper()
X = ['ab', 'cd']
Print(list(map(to_upper, x)))

A)[„AB?, „CD?].
B)[„ab?, „cd?].
C)none of the mentioned
D)error
Question
What is the output of the following?
X = ['ab', 'cd']
Print(len(list(map(list, x))))

A)2
B)4
C)error
D)none of the mentioned
Question
Program code making use of a given module is called a ______ of the module.

A)Client
B)Docstring
C)Interface
D)Modularity
Question
What is the output of the following piece of code?
#mod1
Def change(a):
B=[x*2 for x in a]
Print(b)
#mod2
Def change(a):
B=[x*x for x in a]
Print(b)
From mod1 import change
From mod2 import change
#mains=[1,2,3]
Change(s)

A)[2,4,6].
B)[1,4,9].
C)[2,4,6]
D)There is a name clash
Question
What is the output of the following program?
Tday=datetime.date.today()
Print(tday.month())

A)August
B)Aug
C)08
D)8
Question
Which of the following formatting options can be used in order to add „n? blank spaces after a given string „S??

A)print("-ns"%S)
B)print("-ns"%S).
C)print("%ns"%S)
D)print("%-ns"%S)
Question
What is the output of the following program?
F = None
For i in range (5):
With open("data.txt", "w") as f:
If i > 2:break
Print(f.closed)

A)True
B)False
C)None
D)Error
Question
To read the entire remaining contents of the file as a string from a file object infile, we use

A)infile.read(2)
B)infile.read()
C)infile.readline()
D)infile.readlines()
Question
Suppose t = (1, 2, 4, 3), which of the following is incorrect?

A)print(t[3])
B)t[3] = 45
C)print(max(t))
D)print(len(t))
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/48
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 1: Python Programming: Output and Data Types
1
What is the output of the following code :
Print 9//2

A)4.5
B)4.0
C)4
D)Error
4
2
Which function overloads the >> operator?

A)more()
B)gt()
C)ge()
D)rshift()
rshift()
3
What is the output of the following program :
I = 0
While i < 3:
Print i
Print i+1

A)0 2 1 3 2 4
B)0 1 2 3 4 5
C)0 1 1 2 2 3
D)1 0 2 4 3 5
0 1 1 2 2 3
4
Which module in Python supports regular expressions?

A)re
B)regex
C)pyregex
D)None of the above
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
5
What is the output of the following program :
Print 0.1 + 0.2 == 0.3

A)True
B)False
C)Machine dependent
D)Error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
6
Which of these is not a core data type?

A)Lists
B)Dictionary
C)Tuples
D)Class
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
7
What data type is the object below?
L = [1, 23, „hello?, 1]

A)List
B)Dictionary
C)Tuple
D)Array
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
8
What is the output of the following program :
Def myfunc(a):
A = a + 2
A = a * 2
Return a
Print myfunc(2)

A)8
B)16
C)Indentation Error
D)Runtime Error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
9
What is the output of the expression : 3*1**3

A)27
B)9
C)3
D)1
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
10
What is the output of the following program :
Print '{0:.2}'.format(1.0 / 3)

A)0.333333
B)0.33
C)0.333333:-2
D)Error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
11
What is the output of the following program :
Print '{0:-2%}'.format(1.0 / 3)

A)0.33
B)0.33%
C)33.33%
D)33%
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
12
What is the output of the following program :
I = 0
While i < 3:
Print I
I += 1
Else:
Print 0

A)0 1 2 3 0
B)0 1 2 0
C)0 1 2
D)Error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
13
What is the output of the following program :
I = 0
While i < 5:
Print(i)
I += 1
If i == 3:
Break
Else:
Print(0)

A)0 1 2 0
B)0 1 2
C)Error
D)None of the above
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
14
What is the output of the following program :
Print 'cd'.partition('cd')

A)(„cd?)
B)(")
C)(„cd?, ", ")
D)(", „cd?, ")
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
15
What is the output of the following program :
Print 'abcefd'.replace('cd', '12')

A)ab1ef2
B)abcefd
C)ab1efd
D)ab12ed2
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
16
What will be displayed by the following code?
Def f(value, values):
V = 1
Values[0] = 44
T = 3
V = [1, 2, 3]
F(t, v)
Print(t, v[0])

A)1 1
B)1 44
C)3 1
D)3 44
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
17
Predict the output of following python programs
Dictionary1 = {'Google' : 1,'Facebook' : 2,'Microsoft' : 3}
Dictionary2 = {'GFG' : 1,'Microsoft' : 2,'Youtube' : 3}
Dictionary1.update(dictionary2);
For key, values in dictionary1.items():
Print(key, values)

A)Compilation error
B)Runtime error
C)(„Google?, 1)
(„Facebook?, 2)
(„Youtube?, 3)
(„Microsoft?, 2)
(„GFG?, 1)
D)None of these
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
18
What is the output of the following program?
Dictionary1 = {'GFG' : 1,'Google' : 2,'GFG' : 3}
Print(dictionary1['GFG']);

A)Compilation error due to duplicate keys
B)Runtime time error due to duplicate keys
C)3
D)1
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
19
What is the output of the following program?
Temp = dict()
Temp['key1'] = {'key1' : 44, 'key2' : 566}
Temp['key2'] = [1, 2, 3, 4]
For (key, values) in temp.items():
Print(values, end = "")

A)Compilation error
B){„key1?: 44, „key2?: 566}[1, 2, 3, 4]
C)Runtime error
D)None of the above
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
20
What is the output of the following program?
Data = [2, 3, 9]
Temp = [[x for x in[data]]
For x in range(3)]
Print (temp)

A)[[[2, 3, 9]], [[2, 3, 9]], [[2, 3, 9]]]
B)[[2, 3, 9], [2, 3, 9], [2, 3, 9]]
C)[[[2, 3, 9]], [[2, 3, 9]]]
D)None of these
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
21
What is the output of the following program?
Data = [x for x in range(5)]
Temp = [x for x in range(7) if x in data and x%2==0]
Print(temp)

A)[0, 2, 4, 6]
B)[0, 2, 4]
C)[0, 1, 2, 3, 4, 5]
D)Runtime error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
22
What is the output of the following program?
L1 = [1, 2, 3, 4]
L2 = L1
L3 = L1.copy()
L4 = list(L1)
L1[0] = [5]
Print(L1, L2, L3, L4)

A)[5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]
B)[[5], 2, 3, 4] [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4]
C)[5, 2, 3, 4] [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4]
D)[[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
23
What is the output of the following program?
Import sys
L1 = tuple()
Print(sys.getsizeof(L1), end = " ")
L1 = (1, 2)print(sys.getsizeof(L1), end = " ")
L1 = (1, 3, (4, 5))
Print(sys.getsizeof(L1), end = " ")
L1 = (1, 2, 3, 4, 5, [3, 4], 'p', '8', 9.777, (1, 3))
Print(sys.getsizeof(L1))

A)0 2 3 10
B)32 34 35 42
C)48 64 72 128
D)48 144 192 480
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
24
What is the output of the following program?
T = (1, 2, 3, 4, 5, 6, 7, 8)
Print(T[T.index(5)], end = " ")
Print(T[T[T[6]-3]-6])

A)4 0
B)5 8
C)5 IndexError
D)4 1
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
25
What is the output of the following program?
L = [1, 3, 5, 7, 9]
Print(L.pop(-3), end = ' ')
Print(L.remove(L[0]), end = ' ')
Print(L)

A)5 None [3, 7, 9]
B)5 1 [3, 7, 9]
C)5 1 [3, 7, 9].
D)5 None [1, 3, 7, 9]
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
26
What is the output of the following program?
Def REVERSE(L):
(L)reverse()
Return(L)
Def YKNJS(L):
List = list()
List.extend(REVERSE(L))
Print(List)
L = [1, 3.1, 5.31, 7.531]
YKNJS(L )

A)[1, 3.1, 5.31, 7.531]
B)[7.531, 5.31, 3.1, 1]
C)IndexError
D)AttributeError: „NoneType? object has no attribute „REVERSE?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
27
What is the output of the following program?
From math import sqrt
L1 = [x**2
For x in range(10)].pop()
L1 + = 19print(sqrt(L1), end = " ")
L1 = [x**2 for x in reversed(range(10))].pop()
L1 + = 16
Print(int(sqrt(L1)))

A)10.0 4.0
B)4.3588 4
C)10 .0 4
D)10.0 0
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
28
What is the output of the following program?
D = dict()
For x in enumerate(range(2)):
D[x[0]] = x[1]
D[x[1]+7] = x[0]
Print(D)

A)KeyError
B){0: 1, 7: 0, 1: 1, 8: 0}
C){0: 0, 7: 0, 1: 1, 8: 1}
D){1: 1, 7: 2, 0: 1, 8: 1}
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
29
What is the output of the following program?
D = {1 : 1, 2 : '2', '1' : 1, '2' : 3}
D['1'] = 2
Print(D[D[D[str(D[1])]]])

A)2
B)3
C)„2?
D)KeyError
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
30
What is the output of the following program?
D = dict()
For i in range (3):
For j in range(2):
D[i] = j
Print(D)

A){0: 0, 1: 0, 2: 0}
B){0: 1, 1: 1, 2: 1}
C){0: 0, 1: 0, 2: 0, 0: 1, 1: 1, 2: 1}
D)TypeError: Immutable object
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
31
What is the output of the following program?
From math import *
A = 2.13b = 3.7777
C = -3.12
Print(int(a), floor(b), ceil(c), fabs(c))

A)2 3 -4 3
B)2 3 -3 3.12
C)2 4 -3 3
D)2 3 -4 3.12
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
32
What is the output of the following program?
Import string
Line1 = "And Then There Were None"
Line2 = "Famous In Love"
Line3 = "Famous Were The Kol And Klaus"
Line4 = Line1 + Line2 + Line3
Print(string.find(Line1, 'Were'), string.count((Line4), 'And'))

A)True 1
B)15 2
C)(15, 2)
D)True 2
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
33
What is the output of the following program?line = "What will have so will"L = line.split('a')for i in L:print(i, end=' ')

A)[„What?, „will?, „have?, „so?, „will?]
B)Wh t will h ve so will
C)What will have so will
D)[„Wh?, „t will h?, „ve so will?]
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
34
What is the type of each element in sys.argv?

A)set
B)list
C)tuple
D)string
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
35
What is the length of sys.argv?

A)number of arguments
B)number of arguments + 1
C)number of arguments - 1
D)none of the mentioned
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
36
What is the output of the following code?
Def foo(k):
K[0] = 1
Q = [0]
Foo(q)
Print(q)

A)[0].
B)[1].
C)[1, 0].
D)[0, 1].
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
37
What is the output of the following code?
Def foo(fname, val):
Print(fname(val))
Foo(max, [1, 2, 3])
Foo(min, [1, 2, 3])

A)3 1
B)1 3
C)error
D)none of the mentioned
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
38
What is the output of the following?
Elements = [0, 1, 2]
Def incr(x):
Return x+1
Print(list(map(elements, incr)))

A)[1, 2, 3].
B)[0, 1, 2].
C)error
D)none of the mentioned
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
39
What is the output of the following?
Elements = [0, 1, 2]
Def incr(x):
Return x+1
Print(list(map(incr, elements)))

A)[1, 2, 3].
B)[0, 1, 2].
C)error
D)none of the mentioned
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
40
What is the output of the following?
Def to_upper(k):
Return k.upper()
X = ['ab', 'cd']
Print(list(map(to_upper, x)))

A)[„AB?, „CD?].
B)[„ab?, „cd?].
C)none of the mentioned
D)error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
41
What is the output of the following?
X = ['ab', 'cd']
Print(len(list(map(list, x))))

A)2
B)4
C)error
D)none of the mentioned
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
42
Program code making use of a given module is called a ______ of the module.

A)Client
B)Docstring
C)Interface
D)Modularity
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
43
What is the output of the following piece of code?
#mod1
Def change(a):
B=[x*2 for x in a]
Print(b)
#mod2
Def change(a):
B=[x*x for x in a]
Print(b)
From mod1 import change
From mod2 import change
#mains=[1,2,3]
Change(s)

A)[2,4,6].
B)[1,4,9].
C)[2,4,6]
D)There is a name clash
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
44
What is the output of the following program?
Tday=datetime.date.today()
Print(tday.month())

A)August
B)Aug
C)08
D)8
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
45
Which of the following formatting options can be used in order to add „n? blank spaces after a given string „S??

A)print("-ns"%S)
B)print("-ns"%S).
C)print("%ns"%S)
D)print("%-ns"%S)
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
46
What is the output of the following program?
F = None
For i in range (5):
With open("data.txt", "w") as f:
If i > 2:break
Print(f.closed)

A)True
B)False
C)None
D)Error
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
47
To read the entire remaining contents of the file as a string from a file object infile, we use

A)infile.read(2)
B)infile.read()
C)infile.readline()
D)infile.readlines()
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
48
Suppose t = (1, 2, 4, 3), which of the following is incorrect?

A)print(t[3])
B)t[3] = 45
C)print(max(t))
D)print(len(t))
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 48 flashcards in this deck.