InfyTQ Functions (Python) Quiz 1

Question 1

Time: 00:00:00
Which of the following statements is true?

Functions are used to create objects in Python.

Functions are used to create objects in Python.

Functions make your program run faster.

Functions make your program run faster.

A function is a piece of code that performs a specific task

A function is a piece of code that performs a specific task

All of the above

All of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
When a function is defined inside a class, what is called?

Class

Class

Modules

Modules

Another Function

Another Function

Method

Method

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00

def hope(text):
print(text, 'is awesome.')
hope('Prepinsta')


Predict output.

Prepinsta

Prepinsta

Prepinsta is awesome.

Prepinsta is awesome.

The text is awesome.

The text is awesome.

is awesome.

is awesome.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
 If return statement is not used inside the function, the function will return:

None object

None object

An arbitrary integer

An arbitrary integer

Error

Error

Function must return something

Function must return something

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is a recursive function?

A function that calls all the functions in the program.

A function that calls all the functions in the program.

A function that calls itself.

A function that calls itself.

A function that calls all the functions in the program except itself.

A function that calls all the functions in the program except itself.

There is no such thing as a recursive function in Python.

There is no such thing as a recursive function in Python.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
The output of the following code will be:

output = lambda var: var * var

print(output(5))

10

10

5

5

25

25

5*5

5*5

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00

numbers = [1, 3, 6]
newNumbers = list(map(lambda x: x , numbers))
print(newNumbers)


Predict the output

[1, 3, 6]

[1, 3, 6]

[0, 1, 2]

[0, 1, 2]

1, 3, 6

1, 3, 6

0, 1, 2

0, 1, 2

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00

My_String = "Prep Insta"
My_String = My_String.split()
k = [(z.upper(), len(z)) for z in My_String]
print(k)

[(‘P’, 1), (‘r’, 1), (‘e’, 1), (‘p’, 1), (‘ ‘, 1), (‘I’, 1), (‘n’, 1), (‘s’, 1), (‘t’, 1), (‘a’, 1)]

[(‘P’, 1), (‘r’, 1), (‘e’, 1), (‘p’, 1), (‘ ‘, 1), (‘I’, 1), (‘n’, 1), (‘s’, 1), (‘t’, 1), (‘a’, 1)]

[('PREP', 4), ('INSTA', 6)]

[('PREP', 4), ('INSTA', 6)]

[('PREP', 4), (‘ ’, 1), ('INSTA', 5)]

[('PREP', 4), (‘ ’, 1), ('INSTA', 5)]

[('PREP', 4), ('INSTA', 5)]

[('PREP', 4), ('INSTA', 5)]

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What will be the output of the following Python code snippet?

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

['h', 'e', 'l', 'l', 'o']

['h', 'e', 'l', 'l', 'o']

hello

hello

Hello

Hello

hELLO

hELLO

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00

a = lambda i,j : i+j
print(a(5, 6))


What will be the output of the above code?

Error

Error

11

11

00

00

5,6

5,6

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%

Comments