wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz-4 List

Total questions: 111

Worksheet time: 58mins

Name
Class
Date
1.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

2.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

3.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

4.

nameList = ["John", "Harry", "Jesse", "John", "Marry", "Larry"]

The list will be slice and show Harry and Jesse only. Which piece of code below would do this?

a)

print(nameList[1:3])

b)

print(nameList[0:1])

c)

print(nameList[1:2])

d)

print(nameList["Harry":"Jesse"])

5.

To insert an the string "Pedro" in the first position of a the nameList we use

a)

nameList.append("Pedro, 1")

b)

nameList.insert("Pedro",0)

c)

nameList.insert(1, "Pedro")

d)

nameList.insert(0, "Pedro")

6.

variable.sort() will do what?

a)

Sort the list into alphabetical order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

7.

What is the function of the reverse method for lists?

a)

removes the first occurrence of the information inside the parenthesis

b)

adds the information inside the parenthesis to the end of the list

c)

reverses the order of the elements inside a list

d)

sorts the list (lowest to highest for numbers and alphabetical order for strings)

8.

nameList = ["John", "Harry", "Jesse", "John", "Marry", "Larry"]

del nameList[3]

print(nameList)

What would be the output

a)

['John', 'Harry', 'Jesse', 'Marry', 'Larry']

b)

['John', 'Harry', 'Jesse', 'John', 'Larry']

c)

['John', 'Harry', 'John', 'Marry', 'Larry']

d)

Error

9.

nameList = ["John", "Harry", "Jesse", "John", "Marry", "Larry"]

print(nameList.count("John"))

What would be the output

a)

1

b)

2

c)

3

d)

Error

10.

nameList = ["John", "Harry", "Jesse", "John", "Marry", "Larry"]

nameList[6] ="Susie"

print(nameList)

What would be the output

a)

['John', 'Harry', 'Jesse', 'John', 'Marry', 'Larry', 'Susie']

b)

['Susie', 'John', 'Harry', 'Jesse', 'John', 'Marry', 'Larry']

c)

['Susie']

d)

Error

11.

What will be the output?

var1=['sam', "Pam", 12,44]

var1[3]="Ram"

print(var1)

a)

['sam', 'Pam', 12, 44]

b)

['sam', 'Pam', 12, 'Ram']

c)

It will give an error

d)

['sam', 'Pam', 'Ram',44]

12.

What will be the output?

tuple1=['sam', "Pam", 12,44]

print(type(tuple1))

a)

<class 'list'>

b)

<class 'tuple'>

13.

What will be the output?

list1=['sam', "Pam", 12,44]

print(list1[-1])

a)

12

b)

sam

c)

No such index in the list

d)

44

14.

What will be the output?

list1=["Red","Green","Blue","Yellow"]

list1.append("Black")

print(list1)

a)

<class 'list'>

b)

['Red', 'Green', 'Blue', 'Yellow', 'Black']

c)

['Black','Red', 'Green', 'Blue', 'Yellow' ]

d)

AttributeError: 'tuple' object has no attribute 'append'

15.

Which of the statements are true for the code below:


list1=["Red","Green","Yellow","Orange","Black"]


if "Red" in list1 and "Green" in list1 and "Yellow" in list1:

print("We have all the colors of traffic lights")

a)

Print statement will be executed if the list has red/yellow/Blue

b)

Print statement will be executed if the list has all the three colors

c)

It will give syntax error

d)

None of these

16.

What will be the output?

list1=["Red","Green","Yellow","Orange","Black","Emerald blue"]


print(max(list1))

a)

Emerald blue

b)

Black

c)

Red

d)

Yellow

17.

list1=["Red","Green","Yellow","Orange","Black","Emerald blue"]

list1.sort()

print(list1)

a)

["Red","Green","Yellow","Orange","Black","Emerald blue"]

b)

Not a valid function in Python3

c)

['Black', 'Emerald blue', 'Green', 'Orange', 'Red', 'Yellow']

d)

None

18.

list1 = "a", "b", "c", "d";


print(type(list1))

a)

Syntax not correct

b)

("a", "b", "c", "d")

c)

<class 'tuple'>

d)

<class 'list'>

19.

list1=("Red","Green","Yellow","Orange","Black")

list1.append("Emerald blue")

print(list1)

a)

("Red","Green","Yellow","Orange","Black","Emerald blue")

b)

("Red","Green","Yellow","Orange","Black")

c)

AttributeError: 'tuple' object has no attribute 'append'

d)

None of these

20.

tup1=("Red","Green","Yellow","Orange","Black")

del tup1

print(tup1)

a)

NameError: name 'tup1' is not defined

b)

SyntaxError: invalid syntax no keyword del

c)

("Red","Green","Yellow","Orange","Black")

d)

None of these

21.

Which of these is the best description of a list in Python?

a)

A list is a collection of data that has an order and can be changed

b)

A list is a lot of variables

c)

A list is used for shopping

d)

A list is a collection of data that cannot hold duplicated data and cannot be changed

22.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

23.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

24.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

25.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

26.

Which of these is a list?

a)

fruit = ["pineapples", "mangoes", "bananas"]

b)

fruit = "pineapples", "mangoes", "bananas"

c)

fruit = {"pineapples", "mangoes", "bananas"}

d)

fruit = ("pineapples", "mangoes", "bananas")

27.

If you want to create an empty list called islands, which of the following pieces of code is correct?

a)

islands = { }

b)

islands = ( )

c)

islands = [ ]

d)

islands = < >

28.

Each item in a list has an "address" or index. The first index in a Python list is what?

a)

1

b)

0

c)

a

d)

A

29.

What is the index of the name 'Paula' in the following list:

names = ["Paul","Phillip","Paula","Phillipa"]

a)

0

b)

1

c)

2

d)

3

30.
What is the output when we execute list(“hello”)?
a)
[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
b)
 [‘hello’] 
c)
[‘llo’]
d)
 [‘olleh’]
31.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

del mariana_islands[0]

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Tinian', 'Rota']

c)

['Saipan', 'Tinian']

d)

['Saipan', 'Rota']

32.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.pop()

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Tinian', 'Rota']

c)

['Saipan', 'Tinian']

d)

['Saipan', 'Rota']

33.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.remove('Tinian')

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Tinian', 'Rota']

c)

['Saipan', 'Tinian']

d)

['Saipan', 'Rota']

34.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota', 'Guam']

mariana_islands.sort()

print(mariana_islands)

a)

['Tinian', 'Saipan', 'Rota', 'Guam']

b)

['Guam', 'Tinian', 'Rota', 'Saipan']

c)

['Saipan', 'Rota', 'Guam', 'Tinian']

d)

['Guam', 'Rota', 'Saipan', 'Tinian']

35.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.insert(0, 'Guam')

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

36.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands.append('Guam')

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

37.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands[0] = 'Guam'

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

38.

What is the output of program below?


mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(mariana_islands[-1])

a)

Guam

b)

Saipan

c)

Tinian

d)

Rota

39.

What is the output of program below?


mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(mariana_islands[1])

a)

Guam

b)

Saipan

c)

Tinian

d)

Rota

40.

What is the output of the program below?


mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

cmni = mariana_islands[1:]

len(cmni)

a)

1

b)

2

c)

3

d)

4

41.

What is the output of the following piece of code when executed in Python shell?


>>> a=("Check")*3

>>> a



a)

(‘Check’,’Check’,’Check’)

b)

* Operator not valid for tuples

c)

(‘CheckCheckCheck’)

d)

Syntax error

42.

Is the following piece of code valid?


>>> a=(1,2,3,4)

>>> del a

a)

No because tuple is immutable

b)

Yes, the entire tuple is deleted

c)

No, invalid syntax for del method

d)

Yes, first element in the tuple is deleted

43.

What type of data is: a=[(1,1),(2,4),(3,9)]?

a)

Array of tuples

b)

List of tuples

c)

Tuples of lists

d)

Invalid type

44.

Which of the following is true for a tuple?

a)

Tup = 1,2,3

b)

Tup = (""1,"2)

c)

Tup = (1,2,3,4)

d)

None of the above

45.

Result of the program above is

a)

('1', '2', '3', '4', '5')

b)

(1, 2, 3, 4, 5)

c)

12345

d)

"12345"

46.

Suppose you have the following tuple definition:


t = ('foo', 'bar', 'baz')


Which of the following statements replaces the second element ('bar') with the string 'qux':

a)

t[1] = 'qux'

b)

t(1) = 'qux'

c)

t[1:1] = 'qux'

d)

error

47.

If list=[17,23,41,10] then list.append(32) will result

a)

[32,17,23,41,10]

b)

[17,23,41,10,32]

c)

[10,17,23,32,41]

d)

[41,32,23,17,10]

48.

Suppose list=[12,3,22,"mago","hello"], what is list[-6]

a)

Error

b)

None

c)

mango

d)

12

49.

L_names=['Harsh','Amit','Sahil','Viresh']

min(L_names)

a)

'Harsh'

b)

'Amit'

c)

'Viresh'

d)

None of the above

50.

L_names=['Harsh','Amit','Sahil','Viresh']

L_names.pop()

a)

'Harsh'

b)

'Amit'

c)

'Viresh'

d)

None of the above

51.

If L1=[2,4,8,16], L2=[32,64] what is L1+L2

a)

[2,4,8,16,32,64]

b)

[2,4,8,16][32,64]

c)

[2,4,8,16],[32,64]

d)

None of the above

52.

If L1=[2,4,8,16] What is the result of the following statement

16 in L1

a)

True

b)

False

53.

L=[2,4,8,16,32,64] what is L[:2]

a)

[2,4]

b)

[2,4,8]

c)

2,4

d)

None of the above

54.

T=((1,2,3),(3,4))

what is T[1][1]

a)

4

b)

3

c)

2

d)

1

55.

Which function can be used to convert list to a tuple

a)

tuple

b)

list

c)

to_list

d)

to_tuple

56.

Suppose list1 is [1, 3, 2], What is list1 * 2 ?

a)

[2, 6, 4].

b)

[1, 3, 2, 1, 3]

c)

[1, 3, 2, 1, 3, 2]

d)

[1, 3, 2, 3, 2, 1]

57.

To remove string “hello” from list1, we use which command?

a)

list1.remove(“hello”)

b)

list1.remove(hello)

c)

list.remove(“hello”)

d)

list.remove(hello)

58.

Suppose a tuple T is declared as T=(20,36,34,49), which of the following is incorrect?

a)

print(T[3])

b)

T[3] = 49

c)

print(min(T))

d)

print(T.count(20))

59.

Identify the data type of T:


T = [‘A’, ‘23’, ‘92’, ‘(10,20)’]

a)

List

b)

Dictionary

c)

String

d)

Tuple

60.

What is the output of the code?

a = (33, 55)

a.append(22)

print(a)

a)

33 55 22

b)

33

55

22

c)

33, 55, 22

d)

Error

61.

T/F A list can contain a group.

a)

True

b)

False

62.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

63.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

d)

"John"

64.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

65.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

66.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
67.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
68.

To insert an the string "strawberries" in the first position of a list we use

a)

fruit.append("strawberries, 1")

b)

fruit.insert("strawberries",0)

c)

fruit.insert(1, "strawberries")

d)

fruit.insert(0, "strawberries")

69.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
70.

To print a list called fruitList we use

a)

print(fruitList)

b)

list(print)

c)

fruitList.print()

d)

fruitList(print)

71.

Which colour will be replaced with yellow?

a)

red

b)

green

c)

blue

d)

none, yellow will be added to the list

72.

Which symbols are used to open and close a list?

a)

( ) round brackets

b)

( ) curly brackets

c)

[ ] square brackets

d)

" " speech marks

73.

variable.sort() will do what?

a)

Sort the list into alphabetical order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

74.

What is the function of the reverse method for lists?

a)

removes the first occurrence of the information inside the parenthesis

b)

adds the information inside the parenthesis to the end of the list

c)

reverses the order of the elements inside a list

d)

sorts the list (lowest to highest for numbers and alphabetical order for strings)

75.

If list=[17,23,41,10] then list.append(32) will result

a)

[32,17,23,41,10]

b)

[17,23,41,10,32]

c)

[10,17,23,32,41]

d)

[41,32,23,17,10]

76.

Which of the following python function can be used to add more than one element within an existing list ?

a)

append( )

b)

append_more( )

c)

extend( )

d)

more( )

77.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
78.

What is the output of the following list operation

aList = [10, 20, 30, 40, 50, 60, 70, 80]

print(aList[2:5])

print(aList[:4])

print(aList[3:])

a)

[20, 30, 40, 50]

[10, 20, 30, 40]

[30, 40, 50, 60, 70, 80]

b)

[30, 40, 50]

[10, 20, 30, 40]

[40, 50, 60, 70, 80]

c)

None of these

79.

In Python, list is mutable

a)

False

b)

True

80.

___________method adds a single item to the end of the list.

a)

extend( )

b)

append( )

c)

insert( )

81.

list1=[10, 20, 30, 40] and list2=[15, 25, 35, 45] What is the value of list1 when the statement,

list1+=list2

is executed?

a)

[10, 20, 30, 40]

b)

[25, 45, 65, 85]

c)

[10, 15, 20, 25, 30, 35, 40, 45]

d)

[10, 20, 30, 40, 15, 25, 35, 45]

82.

lista=["a111", "b222", "c333", "d444"]

The statement lista.pop(2) is executed. Which of the following is the correct representation of lista after the statement, lista.pop(2) is executed?

a)

‘b222’

b)

'c333’

c)

['a111', 'b222', 'd444’]

d)

["a111", "b222", "c333", "d444"]

83.

Consider a tuple, fruits= (‘apple’, ‘orange’, ‘watermelon’, ‘grapes’, ‘banana’).

What is the output for the statement print(fruits[-2])?

a)

‘banana’

b)

‘grapes’

c)

‘watermelon’

d)

‘orange’

84.

Which of the following is TRUE about tuples?

a)

Tuples represent elements of the same data type.

b)

The length of a tuple can be changed.

c)

New elements are inserted to tuples using the append() method.

d)

Elements of a tuple cannot be modified.

85.

Consider the list L= [0, 1, 1, 2, 3, 5, 8, 13, 21, 34].What will be output of the statement L [3:6]?

a)

[2, 3, 5]

b)

[0, 1, 1]

c)

[1, 2, 3]

d)

[2, 3, 5, 8]

86.

Choose the correct about Tuples

a)

Collection of items which are ordered

b)

tuples cannot be changed

c)

tuples uses square brackets

d)

values of tuples can be accessed by indexing

87.

Choose the correct syntax of Tuple

a)

tuple=[200,50]

b)

tuple=(200,50)

c)

tuple={200,50}

88.

Which of the following is FALSE about lists?

a)

A list is an ordered collection.

b)

A list is a collection of heterogeneous elements.

c)

A list consists of elements of the same data type only.

d)

A list consists of zero or more elements.

89.

Guess the output:


li = [2, 3, 5]

li.append("Rahul")

print(li)

a)

SyntaxError

b)

[2, 3, 5, 'Rahul']

c)

['Rahul', 2, 3, 5]

90.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
91.

The count() method returns the number of times the specified element appears in the list.

What is the output of this code?

a)

3

b)

2

c)

1

d)

0

92.

Output of this code?

a)

[2,4,6,8,10]

b)

['2','4','6','8','10']

c)

[0,2,4,6,8]

d)

[10,8,6,4,2]

93.

print([i.lower() for i in "HELLO"])

a)

[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]

b)

‘hello’

c)

[‘hello’]

d)

hello

94.

print([[i+j for i in "abc"] for j in "def"])

a)

[‘da’, ‘ea’, ‘fa’, ‘db’, ‘eb’, ‘fb’, ‘dc’, ‘ec’, ‘fc’]

b)

[[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]]

c)

[[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]]

d)

[‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’]

95.

print([if i%2==0: i; else: i+1; for i in range(4)])

a)

[0, 2, 2, 4]

b)

[1, 1, 3, 3]

c)

error

d)

none of the mentioned

96.

Write the list comprehension to pick out only negative integers from a given list ‘a’.

a)

[x<0 in a]

b)

[x for x<0 in a]

c)

[x in a for x<0]

d)

[x for x in a if x<0]

97.

Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9]

a)

[x**3 for x in l]

b)

[x*3 for x in l]

c)

[x**3 in l]

d)

[x^3 in l]

98.

Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]

w="hello"

v=('a', 'e', 'i', 'o', 'u')

a)

[x for w in v if x in v]

b)

[x for x in w if x in v]

c)

[x for x in v if w in v]

d)

[x for v in w for x in w]

99.

Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.

a)

[x in range(1, 1000) if x%3==0]

b)

[x for x in range(1000) if x%3==0]

c)

[x%3 for x in range(1, 1000)]

d)

[x%3=0 for x in range(1, 1000)]

100.

Write a list comprehension equivalent for the Python code shown below.

a)

[i for i in range(1, 100) if int(i*0.5)==(i*0.5)]

b)

[i for i in range(1, 101) if int(i*0.5)==(i*0.5)]

c)

[i for i in range(1, 101) if int(i*0.5)=(i*0.5)]

d)

[i for i in range(1, 100) if int(i*0.5)=(i*0.5)]

101.

Write a list comprehension to produce the list: [1, 2, 4, 8, 16, ..., 1024].

a)

[2**x for x in range(0, 10)]

b)

[2**x for x in range(11)]

c)

[2*x for x in range(0, 11)]

d)

[2*x for x in range(1, 11)]

102.

What will be the output of the following Python code?

a)

[‘good’, ‘oh’, ‘excellent’, ‘450’ ]

b)

[‘good’]

c)

[‘good’, ‘#450’]

d)

[‘oh!’, ‘excellent!’, ‘#450’]

103.

grades = [2.0, 3.0, 4.0]


Which of the following code can be used to iterate over the grades list ?

a)

for grade in grades :

# todo

b)

i = 0

while i < len(grades) :

#todo

i = i + 1

c)

[print ( i ) for i in grades]

d)

for i, grade in enumerate(grades) :

# todo

104.

a = [ 1, 3, 5 ]

b = [ 7, 9, 11 ]


How do you merge these two lists ?

a)

a + b

b)

a.extend(b)

c)

a.merge(b)

105.

numbers = [1, 2, 3, 4, 5]


Which of the following code removes all the elements from the list but retains the list

a)

numbers.clear()

b)

del numbers

c)

delete numbers

d)

numbers.del()

106.

numbers = [1,2, 3, 4, 5, 6, 7, 8, 9, 10]


Which of the following code will give you the output as the array below


[1, 3, 5, 7, 9]

a)

numbers[::2]

b)

numbers[:2]

c)

numbers[0:9:2]

d)

numbers[2:0:9]

107.

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


Which of the following code will give the output as


[4, 6, 8]

a)

[numbers[i] for i in [3, 5,7]]

b)

numbers[4,6,8]

c)

numbers[3,5,7]

108.

names = ["Hyderabad", "New Delhi", "New York"]


What gets printed when you say


names[1][-1]

a)

i

b)

d

c)

k

d)

y

109.

What is the output of the output of the code above ?

a)

1700

b)

1200

c)

800

d)

2400

110.

The output of the code above is

a)

Chennai

b)

Hyderabad

c)

New York

d)

New Delhi

111.

What is the output of the program above

a)

Error

b)

-1

c)

0

d)

None

e)

False