Font size
WorksheetsPython Essentials 119
Total questions: 20
Worksheet time: 11mins
Which of the following is the correct way to print the phrase "Hello, World!" in Python?
print "Hello, World!"
echo "Hello, World!"
printf("Hello, World!")
print("Hello, World!")
What symbol is used to start a comment in Python?
//
/*
#
""
Which of the following is a text-based programming language?
Scratch
Python
Photoshop
Excel
What is the output of the following code snippet? ```python print("Python" + " " + "Rocks!") ```
PythonRocks!
Python Rocks!
Python+Rocks!
"Python" "Rocks!"
How do you write a comment in Python that spans multiple lines?
Using # at the beginning of each line
Using /* at the beginning and */ at the end
Using at the end
Using triple quotes
What is the correct file extension for Python files?
.pyt
.pt
.py
.python
Which of the following is true about the print() function in Python?
It can only print strings.
It sends output to the console.
It is used to read input from the user.
It cannot print variables.
What will be the output of the following code? ```python # This is a comment print("Comments are fun") # This is an inline comment ```
This is a comment Comments are fun
Comments are fun This is an inline comment
Comments are fun
No output, as the code contains comments
whitespace or indentations (tab)
curly braces { ; }
booleans (T or F)
variables (data)
How will the following code look on the screen?
print ("I love programming.")
print ("I love programming.")
"I love programming."
"I love programming."
I love programming.
I love programming.
I love programming. I love programming.
I LOVE PROGRAMMING
I LOVE PROGRAMMING
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
What Python command lets the user enter an answer to a prompt?
