Python

Python Quiz with answers – Part 4

Practical questions to test your knowledge of Python programming – Part 4

Which of the following keywords is a placeholder for the body of a function?
break
continue
body
pass

Correct!

Wrong!

Let a = [1,2,3,4,5], which of the following statements is correct?
print(a[:100]) #Affiche [1,2,3,4,5]
print(a[:]) #Affiche [1,2,3,4]
print(a[0:]) #Affiche [2,3,4,5]
print(a[-1:]) #Affiche [1,2]

Correct!

Wrong!

What will be the output of the following code?
def getLen():
d = {}
d["python"] = 22
d["java"] = 27
d["php"] = 53
d["c"] = 87
return len(d)
print(getLen())
3
8
5
4

Correct!

Wrong!

Who created the python language?
Denis Ritchie
Guido Van Rossum
James Gosling
Tom Cruise

Correct!

Wrong!

Can the "return" statement in python return multiple values?
Yes
No

Correct!

Wrong!

What is the code below for:
if __name__ == "__main__":
myFunction()
Create a new module
Run the python module as the main program
Create new objects
Defines a generator

Correct!

Wrong!

In python, we use "try" and "catch" for exception handling?
Yes
No

Correct!

Wrong!

Which module is used in python to create graphics?
Graphics
Turtle
Canvas
Tkinter

Correct!

Wrong!

Select the valid code to link a canvas with a key event p
Canvas.entered(Enter, p)
Canvas.bind(key,p)
Canvas.bind('',p)
Canvas.entered(' ',p)

Correct!

Wrong!

Which function overloads the operator >>?
move()
gt()
more()
None of these answers is true.

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Python Quiz – Part 4

I got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button