REVIEW QUIZ Basic Python and Console Interaction
Quiz
•
Education
•
12th Grade
•
Practice Problem
•
Easy
Catherine L Hulcher
Used 4+ times
FREE Resource
Enhance your content in a minute
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
input() functions stores that value as a
string
integer
float
Answer explanation
The input() function in Python always returns data as a string, regardless of the type of input provided. Therefore, the correct answer is 'string'.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
On which line will this program call an error in the console?
Line 1
Line 2
Line 3
Line 4
No error will occur
Answer explanation
The program will call an error on Line 2 due to a syntax issue, such as a missing semicolon or incorrect variable declaration. This will prevent the code from executing properly.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following code snippets will result in a type error?
apples = int(input('How many apples? '))
print('Total apples: ' + str(apples + 2))
apples = int(input('How many apples? '))
print(str(apples + 2))
apples = int(input('How many apples? '))
print(apples)
apples = int(input('How many apples? '))
print(2 + ' apples')
Answer explanation
The code snippet 'print(2 + ' apples')' results in a type error because it attempts to add an integer (2) to a string (' apples'), which is not allowed in Python.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following code snippets will not produce an error, assuming the user inputs an integer?
Answer explanation
this answer is correct
adds the dozen which is an integer to 1 which is an integer
then converts answer to a string
and prints
NOTICE THE PARENTHESE ARRANGEMENT
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be printed to the screen when the following code snippet is run?
<class str>
120
1210
<class int>
Answer explanation
The code snippet likely involves a string operation, resulting in a string type. Therefore, the output will indicate the type of the variable, which is
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following cannot be used as a variable name in a Python program?
one_word
oneWord
1word
word1
word_1
Answer explanation
In Python, variable names cannot start with a digit. Therefore, '1word' is invalid, while 'one_word', 'oneWord', 'word1', and 'word_1' are all valid variable names.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following equations will return the lowest value?
print (9 / 6)
print (4 / 2)
print (15.0 / 6.0)
print (8 / 3)
print (9.0 / 4.0)
Answer explanation
The equation print(9 / 6) evaluates to 1.5, which is lower than the other options: 2.0, 2.5, 2.6667, and 2.25. Therefore, print(9 / 6) returns the lowest value.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
22 questions
Penilaian asas kapal terbang kawalan jauh
Quiz
•
12th Grade
20 questions
PCEI-mar24agos24-TeoríasAprendizaje2AB-unidad1
Quiz
•
12th Grade
20 questions
EVALUACION DE PSICOLOGÍA
Quiz
•
9th - 12th Grade
20 questions
Tiết 67-TC7 Ôn tập PL với sự phát triển bền vững của đất nước
Quiz
•
9th - 12th Grade
20 questions
latihan UKBI
Quiz
•
9th - 12th Grade
20 questions
Cine-Escultura- Pintura
Quiz
•
1st - 12th Grade
20 questions
Latihan psaj pkkwu
Quiz
•
12th Grade - University
20 questions
TIK KD 3
Quiz
•
1st - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Education
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
12 questions
Add and Subtract Polynomials
Quiz
•
9th - 12th Grade
13 questions
Model Exponential Growth and Decay Scenarios
Quiz
•
9th - 12th Grade
27 questions
7.2.3 Quadrilateral Properties
Quiz
•
9th - 12th Grade
7 questions
Amoeba Sisters Dihybrid Cross Punnett Square
Interactive video
•
9th - 12th Grade
10 questions
The Holocaust: Historical Overview
Interactive video
•
9th - 12th Grade
10 questions
Key Features of Quadratic Functions
Interactive video
•
8th - 12th Grade
11 questions
Exponent Quotient Rules A1 U7
Quiz
•
9th - 12th Grade
