
Python Quiz
Authored by Bytes Coders
Computers
12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is a valid variable name in Python?
2value
value_2
value-2
value 2
Answer explanation
In Python, variable names must start with a letter or underscore, and can contain letters, numbers, and underscores. 'value_2' is valid, while '2value' starts with a number, 'value-2' contains a hyphen, and 'value 2' has a space.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of these is not a keyword in Python?
lambda
global
eval
yield
Answer explanation
In Python, 'lambda', 'global', and 'yield' are all keywords used for specific functionalities. However, 'eval' is a built-in function, not a keyword, making it the correct choice for this question.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the result of 3 + 4 * 2?
14
11
10
7
Answer explanation
According to the order of operations (PEMDAS/BODMAS), we first multiply 4 by 2, which gives 8. Then, we add 3, resulting in 11. Therefore, the correct answer is 11.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of 10 // 3?
3.33
4
3
3.0
Answer explanation
The expression 10 // 3 performs integer division, which returns the largest integer less than or equal to the division result. Thus, 10 divided by 3 equals 3 with a remainder, so the output is 3.
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following functions is used to convert a string to integer?
str()
int()
float()
input()
Answer explanation
The function int() is used to convert a string representation of a number into an integer. The other options serve different purposes: str() converts to a string, float() converts to a float, and input() takes user input as a string.
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What does the expression 9 % 4 evaluate to?
2
1
0
3
Answer explanation
The expression 9 % 4 calculates the remainder of 9 divided by 4. When 9 is divided by 4, it goes 2 times (8), leaving a remainder of 1. Therefore, 9 % 4 evaluates to 1.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which operator is used for exponentiation (power) in Python?
^
**
^^
exp()
Answer explanation
In Python, the operator for exponentiation (raising to a power) is '**'. For example, '2 ** 3' equals 8. The other options are incorrect: '^' is a bitwise XOR, '^^' is not valid, and 'exp()' is a function for exponentials.
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
21 questions
Lecture Exercise Topic 1.3
Quiz
•
12th Grade
20 questions
Format File Gambar
Quiz
•
12th Grade
20 questions
Quiz ASJ
Quiz
•
12th Grade
15 questions
4.6.4 Logic Gates
Quiz
•
10th Grade - Professi...
15 questions
หน่วยที่ 1 ความรู้พื้นฐานการจัดการ ข้อมูลขนาดใหญ่ (Big Data)
Quiz
•
9th - 12th Grade
17 questions
Quiz 01 Keamanan Jaringan
Quiz
•
12th Grade
15 questions
ONLINE Quiz - Computer Hardware Basics (COMSYS 1)
Quiz
•
12th Grade
20 questions
Quiz
•
7th - 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