NEW
Font size
WorksheetsPython Training Day-2 Quiz-2
Total questions: 10
Worksheet time: 5mins
What will be the output of the following Python code?
>>>str="hello"
>>>str[:2]
>>>
he
lo
olleh
hello
What error occurs when you execute the following Python code snippet?
apple = mango
SyntaxError
NameError
ValueError
TypeError
In order to store values in terms of key and value we use what core data type.
list
tuple
class
dictionary
The following is displayed by a print function call. Select all of the function calls that result in this output.
tom
dick
harry
print('''tom
\ndick
\nharry''')
print(”’tomdickharry”’)
print(‘tom\ndick\nharry’)
print('tom
dick
harry')
Select all options that print.
hello-how-are-you
print(‘hello’, ‘how’, ‘are’, ‘you’)
print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
print(‘hello-‘ + ‘how-are-you’)
print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
Which statement is correct?
List is immutable && Tuple is mutable
List is mutable && Tuple is immutable
List & Tuple are mutable
List & Tuple are immutable
How to get last element of list in python? Suppose we have list with name arr, contains 5 elements.
arr[0]
arr[5]
arr[last]
arr[-1]
Which is the correct operator for power(xy)?
X^y
X**y
X^^y
None of the mentioned
What will be the output of the following code?
arr = [1,2,3,4,5,6]
print(a[::2])
[1,3,5]
[2,4,6]
[1,2]
[5,6]
Which of these about a dictionary is false?
The values of a dictionary can be accessed using keys
The keys of a dictionary can be accessed using values
Dictionaries aren't ordered
Dictionaries are mutable
