NEW
Font size
WorksheetsPython
Total questions: 10
Worksheet time: 5mins
In a Python program, a control structure:
Defines program-specific data structures
Directs the order of execution of the statements in the program
Manages the input and output of control characters
Dictates what happens before the program starts and after it terminates
Syntax error in python is detected by _________at _______
interpreter/ run time
compiler/ compile time
compiler/ run time
interpreter/ compile time
Which one of the following if statements will not execute successfully:
if (1, 2):
print('foo')
if (1, 2):
print('foo')
if (1, 2):
print('foo')
if (1, 2): print('foo')
if (1, 2):
print('foo')
Which among them will produce {'a', 'b', 'c'}?
Tuple(''abc'')
Set(''abac'')
List(''abc'')
None of the above.
Which among them is incorrect for set s={100,101,102,103}
Max(s)
Sum(s)
Len(s)
Print(s[3])
What signifies the end of a statement block or suite in Python?
A comment
end
A line that is indented less than the previous line
}
What is the output for −
S = [['him', 'sell'], [90, 28, 43]]
S[0][1][1]
'e'
'i'
'90'
'h'
The following if/elif/else statement will raise a KeyError exception:
d = {'a': 0, 'b': 1, 'c': 0}
2
3if d['a'] > 0:
4 print('ok')
5elif d['b'] > 0:
6 print('ok')
7elif d['c'] > 0:
8 print('ok')
9elif d['d'] > 0:
10 print('ok')
11else:
12 print('not ok')
TRUE
FALSE
What is the output of the following
l = [None] * 10
print(len(l))
10
0
Syntax Error
Select all the correct options to copy a list
aList = ['a', 'b', 'c', 'd']
newList = copy(aList)
newList = aList.copy()
newList.copy(aList)
newList = list(aList)
