Which keyword is used to handle exceptions in Python?
Anonymous Quiz
7%
catch
59%
except
4%
throw
31%
handle
What is the output of the following code?
x = [1, 2, 3]
x.append(4) print(x)
x = [1, 2, 3]
x.append(4) print(x)
Anonymous Quiz
84%
[1, 2, 3, 4]
8%
[1, 2, 3]
3%
[4, 1, 2, 3]
4%
[1, 2, 3, [4]]
Which function is used to get the data type of an object?
Anonymous Quiz
80%
type()
8%
id()
4%
data()
8%
class()
😢4
How do you create a dictionary in Python?
Anonymous Quiz
18%
dict = [key1: value1, key2: value2]
69%
dict = {key1: value1, key2: value2}
8%
dict = (key1: value1, key2: value2)
6%
dict = <key1: value1, key2: value2>
Which method removes the last item from a list?
Anonymous Quiz
45%
pop()
39%
remove()
11%
delete()
4%
discard()
What does the split() method do?
Anonymous Quiz
9%
Joins a list into a string
59%
Splits a string into a list
15%
Converts string to uppercase
16%
Replaces parts of a string
Which of the following is not a valid Python variable name?
Anonymous Quiz
9%
variable_name
13%
VariableName
51%
variable-name
27%
_variableName
❤1
What is the default return value of a function that does not explicitly return a value?
Anonymous Quiz
12%
0
56%
None
26%
(empty string)
7%
False
Which keyword is used to define a class in Python?
Anonymous Quiz
84%
class
16%
def
0%
new
0%
create
How do you check if a key exists in a dictionary?
Anonymous Quiz
27%
key in dict
17%
dict.has_key(key)
22%
dict.contains(key)
34%
key.exists(dict)
The continue statement skips the current iteration of a loop and proceeds to the next iteration.
Anonymous Quiz
85%
True
15%
False
What is the output of following code?
result = 9 // 2
print(result)
result = 9 // 2
print(result)
Anonymous Quiz
8%
4.5
85%
4
3%
Error
4%
None of above
What is the output of following code?
result = -14 // 4
print(result)
result = -14 // 4
print(result)
Anonymous Quiz
53%
-3
33%
-4
9%
-3.5
6%
3