• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 167 pages
Exam (elaborations)

Python Syntax Updated Exam Questions And Correct Answers

Document preview thumbnail
Preview 4 out of 167 pages

Python Syntax Updated Exam Questions And Correct Answers

Content preview

PYTHON SYNTAX UPDATED EXAM QUESTIONS AND
CORRECT ANSWERS
Question 1
What is the value of total_cost that gets printed

Total_cost = 5
Total_cost += 10
Print (total cost)
Correct Answer
15



Question 2
What is the output of the following code
Cool_number = 12 + 30
Cool_number *5
Print (cool_number)
Correct Answer
42



Question 3
What happens when running the following code
Message = what a cool message !
Print (message)
Correct Answer
Python throws a syntax error because the string is not surrounded by quotes



Question 4
What number is saved to exponented_variable in the following expression
2 ** 4
Correct Answer
16



Question 5
This produces a SyntaxError

Correct Answer
Answer= "is this an error'




Page 1 of 167

,Question 6
How does one define a multi-line string in python
Correct Answer
"""
Like this
"""



Question 7
What character begins a comment in python

Correct Answer
#



Question 8
What is python syntax for creating a variable and setting it equal to the number 10
Correct Answer
Variable_name = 10



Question 9
What function outputs text to the terminal
Correct Answer
Print ()



Question 10
How do you combine two strings
Correct Answer
String1 + string2



Question 11
What is the difference between float and an int

Correct Answer
A float represents decimal quantities. An int represents whole numbers



Question 12
What is the value of modulo_variable in the following expression
Modulo_variable = 14%4
Correct Answer
2




Page 2 of 167

,Question 13
This defined variable is a string
Correct Answer
Cool_variable_3 = "important message!"



Question 1
In Python the way to get the computer to speak is by using the _____ statement
Correct Answer
print ststement



Question 2
There are two different Python versions Python 2 and Python. The most significant difference between the two is
how you write a PRINT statement. In Python 3, print has ?
Correct Answer
() parentheses example : print("Hello World!")



Question 3
A string in Python is
Correct Answer
a series of letters, numbers, or symbols connected in order



Question 4
A string can be defined in two ways but it needs to be closed by the same type of quote mark
Correct Answer
(''),(') double quotes and single quotes



Question 5
We can combine multiple strings by using the

Correct Answer
+ plus like so : print "This is " + "a good string"



Question 6
Try adding your name to the print statement with the + operator so that this Python program prints "Hello
[your_name]"
Correct Answer
print "Hello " + "Rico "




Page 3 of 167

, Question 7
Mismatched quotes will cause what error
example: print "Mismatched quotes will cause a'
Correct Answer
SyntaxError: EOL while scanning a string literal. This mean that the string wasn't closed with the same quote-
character that staryed it



Question 8
Without quotes will cause a

Correct Answer
NameError This means that Python found what it thinks is a command, but doesn't know what it means because
it's not defined anywhere



Question 9
Python uses what to define things that are subject to change.
Correct Answer
Variables



Question 10
Create a variable called 'todays_date" and assign a value that will represent today's date to that variable.
Correct Answer
todays_date = "12/14/2021"



Question 11
Example of Python Arithmetic
Correct Answer
mirthful_addition = 12381 + 91817
amazing_subtraction = 981 -312
trippy_multiplication = 38 * 902
happy_division =
sassy_combinations = 129 * 1345 + -12



Question 12
Python also offers a companion to division called the modulo operator. The modulo operator is indicated by _____
and returns the remainder after division is performed.
Correct Answer
% percentage sign



Question 13
Multiply two numbers together and assign the results to a variable called product
Correct Answer
product = 2 * 2




Page 4 of 167

Document information

Uploaded on
October 29, 2026
Number of pages
167
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$17.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TutorExpert
3.7
(81)
Sold
626
Followers
315
Items
11476
Last sold
1 day ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions