Which of the following is not a sequence data-type in Python?
Dictionary
List
Tuples
String
For a given list called new_list, which of the following options will work:
new_list = [1,2,3,4]
Select all that apply.
new_list[4] = 10
new_list.extend(new_list)
new_list.insert(0, 0)
new_list.append(5)
Which of the following is not a type of variable scope in Python?
Local
Global
Enclosing
Package
Which of the following is a built-in data structure in Python?
Queue
Set
LinkedList
Tree
For a given file called ‘names.txt’, which of the following is NOT a valid syntax for opening a file:
with open('names.txt', 'r') as file:
print(type(file))
with open('names.txt', 'w') as file:
print(type(file))
with open('names.txt', 'rb') as file:
print(type(file))
with open('names.txt', 'rw') as file:
print(type(file))
Which among the following is not a valid Exception in Python?
ZeroDivisionException
FileNotFoundError
IndexError
LoopError
For a file called name.txt containing the lines below:
First line Second line And another !
What will be the output of the following code:
print(lines) with open('names.txt', 'r') as file: lines = file.readlines()
'First line'
[‘First line\n’,
‘Second line\n’,
‘And another !’]
['First line']
'First line'
'Second line'
'And another !'
State TRUE or FALSE:
*args passed to the functions can accept the key-value pair.
True
False