
Python Programming Quiz

Quiz
•
Computers
•
University
•
Medium
Shubham Mishra
Used 2+ times
FREE Resource
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.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Technical Quiz R1

Quiz
•
University
15 questions
Quiz on Car Automation

Quiz
•
University
20 questions
[Python For All] Quiz 2 - Rewind.py

Quiz
•
University
13 questions
Principles of Programming

Quiz
•
KG - University
15 questions
Python Variables

Quiz
•
University
20 questions
Grade 7 Python Programming Quiz

Quiz
•
7th Grade - University
20 questions
Python Data Types Quiz

Quiz
•
10th Grade - University
15 questions
Python Basics

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University