Exam 1: Python Programming: Output and Data Types
Exam 1: Python Programming: Output and Data Types48 Questions
Select questions type
What is the output of the following program :
I = 0
While i < 3:
Print I
I += 1
Else:
Print 0
(Multiple Choice)
4.8/5
(27)
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])]]])
(Multiple Choice)
5.0/5
(43)
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)
(Multiple Choice)
4.8/5
(30)
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=' ')
(Multiple Choice)
4.8/5
(45)
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)
(Multiple Choice)
5.0/5
(22)
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 = "")
(Multiple Choice)
4.9/5
(43)
What is the output of the following program?
Tday=datetime.date.today()
Print(tday.month())
(Multiple Choice)
4.9/5
(39)
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'))
(Multiple Choice)
4.9/5
(29)
What is the output of the following program :
Def myfunc(a):
A = a + 2
A = a * 2
Return a
Print myfunc(2)
(Multiple Choice)
4.9/5
(41)
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)
(Multiple Choice)
4.9/5
(45)
What is the output of the following?
Elements = [0, 1, 2]
Def incr(x):
Return x+1
Print(list(map(incr, elements)))
(Multiple Choice)
4.9/5
(33)
Program code making use of a given module is called a ______ of the module.
(Multiple Choice)
5.0/5
(31)
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 )
(Multiple Choice)
4.9/5
(38)
What is the output of the following program :
I = 0
While i < 5:
Print(i)
I += 1
If i == 3:
Break
Else:
Print(0)
(Multiple Choice)
4.8/5
(29)
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])
(Multiple Choice)
4.9/5
(31)
What is the output of the following?
Def to_upper(k):
Return k.upper()
X = ['ab', 'cd']
Print(list(map(to_upper, x)))
(Multiple Choice)
4.8/5
(37)
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))
(Multiple Choice)
4.8/5
(26)
Showing 21 - 40 of 48
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)