What is the output of the following code?
print(type([1,2]))
print(type([1,2]))
Anonymous Quiz
16%
<class 'tuple'>
10%
<class 'int'>
6%
<class 'set'>
3%
<class 'complex'>
64%
<class 'list'>
👍2
Which of the following codes raises an exception?
Anonymous Quiz
23%
# test
47%
a = {1, 2, \ #comment 3, 4}
30%
a = {1, 2, #comment 3, 4}
Which function could be used to list every file and folder in the current directory?
Anonymous Quiz
12%
os.dirnames(‘.’)
40%
os.listdir(‘.’)
30%
os.listdir(‘/’)
18%
os.ls()
👍1
What function do you use to read a string?
Anonymous Quiz
63%
input(«Enter a string»)
15%
eval(input(«Enter a string»))
6%
enter(«Enter a string»)
16%
print(enter(«Enter a string»))
How to check whether an object x is an instance of class A?
Anonymous Quiz
40%
x.instance(A)
19%
A.instance(x)
32%
isinstance(x, A)
8%
isinstance(A, x)
👍1
In Python, what is the default maximum level of recursion?
Anonymous Quiz
7%
500
17%
1000
15%
10000
61%
There is no default maximum level
Which code snippet below will not return True?
Anonymous Quiz
13%
1 in [1,0]
26%
1 in [1,0] == True
47%
(1 in [1,0]) == True
13%
1 in [1, 2, 3]
print('hello'.partition('e'))
Anonymous Quiz
6%
('hello')
55%
('h', 'e', 'llo')
22%
('he', 'llo')
17%
Name error
What is the output of the following code?
eval(''1 + 3 * 2'')
eval(''1 + 3 * 2'')
Anonymous Quiz
10%
‘1+6’
9%
‘4*2’
31%
‘1+3*2’
50%
7
👍1
How do you create a variable with the numeric value 5?
Anonymous Quiz
21%
x = int(5)
31%
x = 5
48%
Both the other are correct
Which collection is ordered, changeable, and allows duplicate members?
Anonymous Quiz
10%
SET
67%
LIST
14%
TUPLE
10%
DICTIONARY
If b is a dictionary, what does any(b) do?
Anonymous Quiz
45%
Returns True if any key of the dictionary is true
26%
Returns False if dictionary is empty
20%
Returns True if all keys of the dictionary are true
9%
Returns True if all keys of the dictionary are true
Which method can be used to return a string in upper case letters?
Anonymous Quiz
58%
upper()
18%
upperCase()
18%
uppercase()
7%
ToUpperCase()
What is the correct syntax to output the type of a variable or object in Python?
Anonymous Quiz
9%
print(typeOf(x))
77%
print(type(x))
5%
print(typeof x)
9%
print(typeof(x))
The `minsplit` parameter to split() specifies the minimum number of splits to make to the input string.
Anonymous Quiz
75%
True
25%
False
🤯4