Professional Documents
Culture Documents
Python Online Quiz
Python Online Quiz
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
44% Correct:
Question 1:
What is a correct syntax to output "Hello World" in Python?
echo("Hello World");
p("Hello World")
Question 2:
How do you insert COMMENTS in Python code?
/*This is a comment*/
//This is a comment
Tutorials
Question 3:
Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
Which one is NOT a legal variable name?
my_var
Myvar
Question 4:
How do you create a variable with the numeric value 5?
x = int(5)
Question 5:
What is the correct file extension for Python files?
.pyt
.pt
.pyth
Question 6:
Tutorials Exercises Services Sign Up Log in
How do CSS
HTML you create a variable with the
JAVASCRIPT SQLfloating number 2.8?
PYTHON JAVA PHP HOW TO W3.CSS C
x = float(2.8)
Question 7:
What is the correct syntax to output the type of a variable or object in Python?
print(typeof x)
print(typeOf(x))
Question 8:
What is the correct way to create a function in Python?
function myfunction():
Question 9:
In Python, 'Hello', is the same as "Hello"
False
Tutorials Exercises Services Your
Sign Upanswer
Log in
HTML
True
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOWCorrect
TO answer
W3.CSS C
Question 10:
What is a correct syntax to return the first character in a string?
x = sub("Hello", 0, 1)
Question 11:
Which method can be used to remove any whitespace from both the beginning and the end of a
string?
len()
trim()
Question 12:
Which method can be used to return a string in upper case letters?
upperCase()
toUpperCase()
Tutorials Exercises Services Sign Up Log in
HTML
upper()
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOWCorrect
TO answer
W3.CSS C
Question 13:
Which method can be used to replace parts of a string?
repl()
switch()
Question 14:
Which operator is used to multiply numbers?
* Your answer
Question 15:
Which operator can be used to compare two values?
=
<>Tutorials Exercises Services Sign Up Log in
HTML
==CSS JAVASCRIPT SQL PYTHON JAVA PHP HOWCorrect
TO answer
W3.CSS C
Question 16:
Which of these collections defines a LIST?
Question 17:
Which of these collections defines a TUPLE?
Question 18:
Which of these collections defines a SET?
HTML
("apple",
CSS "banana", "cherry")
JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
Question 19:
Which of these collections defines a DICTIONARY?
Question 20:
Which collection is ordered, changeable, and allows duplicate members?
SET
TUPLE
DICTIONARY
Question 21:
Which collection does not allow duplicate members?
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
Question 22:
How do you start writing an if statement in Python?
if x > y then:
if (x > y)
Question 23:
How do you start writing a while loop in Python?
x > y while {
while (x > y)
while x > y {
Question 24:
How do you start writing a for loop in Python?
for x > y:
for each x in y:
Question 25:
Tutorials Exercises Services Sign Up Log in
Which statement
HTML CSS is used to stop a SQL
JAVASCRIPT loop? PYTHON JAVA PHP HOW TO W3.CSS C
return
stop
I
20
2
FI
ED
.
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
W3schools Pathfinder
Track your progress - it's free! Sign Up Log in
ADVERTISEMENT
COLOR PICKER
ADVERTISEMENT
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C