
Python Programming Quiz
Authored by Shubham Mishra
Computers
University
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
17 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following statement: print(not(10/5//5 or 100 and 0))
100
True
0
False
Answer explanation
The expression evaluates as follows: 10/5//5 is 0, 100 and 0 is 0, so we have not(0 or 0) which simplifies to not(0). Since not(0) is True, the output is True.
2.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which of the following is/are valid identifier?
while
f_name
#code
_size
AD2023
Answer explanation
Valid identifiers must start with a letter or underscore and can contain letters, digits, and underscores. 'f_name', '_size', and 'AD2023' meet these criteria, while 'while' is a reserved keyword and '#code' contains an invalid character.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
(ii) Fill in the blank: _________ is a basic logic gate, whose output is 0 on same inputs.
NOT
AND
OR
XOR
Answer explanation
The XOR (exclusive OR) gate outputs 0 when both inputs are the same (either 0 or 1). In contrast, AND and OR gates output 1 for certain same inputs, making XOR the correct choice for this question.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
ii) Single line comments in python begin with ____ symbol.
&
$
%
#
Answer explanation
Single line comments in Python begin with the '#' symbol. This is the correct choice, as the other options (&, $, %) do not denote comments in Python.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
i) State TRUE/FALSE: Relational operators have less precedence over logical operators
TRUE
FALSE
Answer explanation
FALSE is correct because relational operators (like <, >) have higher precedence than logical operators (like &&, ||). This means relational operations are evaluated before logical operations in expressions.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
(ii) Which keyword(s) is/are used for looping in Python?
while
for
both a & b
if
Answer explanation
In Python, the keywords 'while' and 'for' are used for looping. 'while' creates a loop that continues as long as a condition is true, while 'for' iterates over a sequence. Therefore, the correct answer is 'both a & b'.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The correct operator precedence among Arithmetic (A), Bitwise (B), Logical (L), and Relational (R) is (higher rank appears first):
A B L R
B A R L
B A L R
A B R L
Answer explanation
The correct operator precedence is Bitwise (B) first, followed by Arithmetic (A), then Logical (L), and finally Relational (R). Thus, the order is B A L R.
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
19 questions
Programación Básica Prácticas Tema 2
Quiz
•
University
19 questions
DBMS - Fundamentals
Quiz
•
University
15 questions
PICMAKER
Quiz
•
University
15 questions
Vistacreate
Quiz
•
University
13 questions
PWM y ADC con el MSP430F5529
Quiz
•
University
16 questions
E-Commerce
Quiz
•
University - Professi...
20 questions
Control Structures C#
Quiz
•
University
15 questions
Object Oriented Programming Assessment 1
Quiz
•
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