
Python Programming Quiz
Authored by Abdiel Vega
Information Technology (IT)
12th Grade
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
27 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 20 pts
Function reverse characters in a string. Returns new string in reverse order.
Def reverse_name(backward_name)-1
Foward_name = “”
Length = backward_name:
len(back=ward_name)-1
range(0,len(backward_name)-1)
range(len(backward_name)-1,-1,-1)
While length >=0:
Foward_name += backward_name[index]
backward_name[length]
backward_name[length+1]
range(len(backward_name)-1,-1,-1)
backward_name[len(backward_name)-len(foward_name)]
2.
MULTIPLE CHOICE QUESTION
30 sec • 20 pts
You are building a Python program that displays all prime numbers from 2 to 100 (A prime number is any number that is divisible only by itself and 1.) Complete the code by moving the appropriate code segments from the list on the left to the correct location on the right.
continue
p = 2
is_prime = True
break
p = p + 1
3.
MULTIPLE CHOICE QUESTION
30 sec • 20 pts
You write the following code to determine a student's final grade based on their current grade (grade) and rank (rank):
grade = 76 rank = 3
If grade > 80 and rank >=# Grade += 10
elif grade >= 70 and rank >3:
grade += 5
else: grade -= 5 print(grade)
What value will print?
71
76
81
86
4.
MULTIPLE CHOICE QUESTION
30 sec • 20 pts
Review the following code:
x = "oranges"
y = "apples"
z = "bananas"
data = "{1} and {0} and {2}"
print (data.format(z, y, x))
What is the output of the print statement?
apples and bananas and oranges
apples and oranges, and bananas
oranges and apples and bananas
bananas and oranges and apples
5.
MULTIPLE CHOICE QUESTION
30 sec • 20 pts
You are writing a function that increments the player score in a game. The function has the following requirements: If no value is specified for points start at one. If bonus is True, then points must be doubled. You write the following code. Line numbers are included for reference only.
01 def increment_score(score, bonus, points):
02 if bonus == True:
03 points = points * 2
04 score = score + points
05 return score
06 points = 5
07 score = 10 08
new_score = increment_score(score, True, points)
For each statement select True or False.
Note: You will receive partial credit for each correct selection.
To meet the requirements, you must change line 01 to: def increment_score(score, bonus, points = 1):
FIf you do not change line 01 and the function is called with only two parameters, the value of the third parameter will be None.
Line 03 will also modify the value of the variable points declared at line 06.
6.
MULTIPLE CHOICE QUESTION
30 sec • 20 pts
You write the following function to read a data file and print each line of the file. Line numbers are included for reference only.
01 def read_file(file):
02 line = None
03 if os.path.isfile(file):
04 data = open(file, 'r')
05 for data line in data:
06 print(line)
When you run the program, you receive an error on line 03. What is causing the error?
The isfile method does not accept one parameter.
You need to import the os library.
The isfile method does not exist in the path object.
The path method does not exist in the os object.
7.
MULTIPLE SELECT QUESTION
45 sec • 20 pts
You are converting an existing application to Python. You need to correctly code all arithmetic expressions. What is the correct order of operations for the six classes of operations in order of precedence from first to the last.
Parentheses
Exponents
Unary positive, negative, not
Multiplication and Division
Addition and Subtraction
And
Addition and Subtraction → Multiplication and Division → Exponents → Parentheses → Unary positive, negative, not → And
And → Exponents → Parentheses → Addition and Subtraction → Unary positive, negative, not → Multiplication and Division
Exponents
Parentheses
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
30 questions
Kisi-Kisi Seni Rupa
Quiz
•
8th Grade - University
30 questions
Cryptography Methods Quiz
Quiz
•
8th Grade - University
22 questions
Cyber I - 1.1 Quiz 2 - CIA Triad & Authentication
Quiz
•
9th - 12th Grade
23 questions
Soal Latihan Blockly kelas 8
Quiz
•
8th Grade - University
24 questions
Aplication Domain: Social Media and Crowdsourcing
Quiz
•
12th Grade - University
25 questions
Form 2 - Information Technology Quiz
Quiz
•
8th Grade - University
25 questions
Using the Developer Tab in Word
Quiz
•
10th Grade - University
26 questions
Digital Asset Review
Quiz
•
10th Grade - University
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 Information Technology (IT)
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