Question 1. _______Is used to create an object in python
Class
constructor
Both A & B
none
Explanation:-
Answer: Option B. -> constructor
Question 2. What will be the output of the following python
name
coder
throw error
none of the above
Explanation:-
Answer: Option B. -> coder
Question 3. If you want to create an empty list called colours in Python, which of the following is correct?
colours = [ ]
colours = ( )
colours = { }
colours =
Explanation:-
Answer: Option A. -> colours = [ ]
Question 4. What will the output be from the following code?print("Hello" + str(2) + "world!")
Hello world! Hello world!
Hello2world!
Hello Hello world! world!
SyntaxError
Explanation:-
Answer: Option B. -> Hello2world!
Question 5. The correct way to write a variable in Python?
my_variable = 10
my variable = 10
my_variable is 10
my_variable: 10
Explanation:-
Answer: Option A. -> my_variable = 10
Question 6. What will the output be from the following code?print(Hello world!)
Hello world!
SyntaxError
Hello world
print(Hello world!)
Explanation:-
Answer: Option B. -> SyntaxError
Question 7. Consider this dictionary:d = {'foo': 100, 'bar': 200, 'baz': 300}What is the result of this statement:d['bar':'baz']
It raises an exception
(200, 300)
200 300
[200, 300]
Explanation:-
Answer: Option A. -> It raises an exception
Question 8. Suppose x is defined as follows:x = [ 'a', 'b', { 'foo': 1, 'bar': { 'x' : 10, 'y' : 20, 'z' : 30 }, 'baz': 3 }, 'c', 'd']What is the expression involving x that accesses the value 30?
x[2]["bar"]["z"]
x[2]["bar"]
x["bar"]["z"]
x[2]["bar"]["z"][3]
Explanation:-
Answer: Option A. -> x[2]["bar"]["z"]
Question 9. A location in memory used to store data that can be changed
Constant
Value
Variable
Iteration
Explanation:-
Answer: Option C. -> Variable
Question 10. What data type would be used for storing someone's telephone numbers?