wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AI Beginners level 3

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which one is correct for giving [5] as output in list [1,2,3,4,5]?

a)

[4:]

b)

[-1:]

c)

Both

d)

None

2.

Which one is correct for giving [3] as output in list [1,2,3,4,5]?

a)

[0]

b)

[1]

c)

[2]

d)

[3]

3.

Can positive indexing be used on tuples?

a)
Yes, positive indexing can be used on tuples
b)
No, positive indexing cannot be used on tuples
c)
Only negative indexing can be used on tuples
d)
Tuples do not support indexing
4.

How to define a function with variable arguments

a)

def myfunc()

b)

def myfunc:

c)

def myfunc(*args)

d)

def myfunc(x,y)

5.

Can lists be manipulated?

a)

yes

b)

no

c)

sometimes

d)

none

6.

Which functions can be performed on dictionary

a)

Add

b)

Delete

c)

Replace

d)

All

7.

Which one of following is known as Higher Order Function

a)

map

b)

filter

c)

lambda

d)

both map & filter

8.

Tick the correct syntax to update key values in dictionary:-

a)

Dictionary[‘key’] = value

b)

Dictionary.update({‘key’:value})

c)

Both

d)

None

9.

A list, tuple, dictionary are enclosed in

a)

( ),[ ],{ }

b)

[ ], { }, ( )

c)

[ ], ( ), { }

d)

None

10.

What is output of following code:
def function_name(firstname, lastname):
return lastname,firstname
function_name('John','Keats')

a)

John Keats

b)

Keats John

c)

Both

d)

None