
PYTHON QUIZ-I

Quiz
•
Computers
•
University
•
Hard
SRINIVASARAO 22PHD7042
Used 1+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
1.What is the output of the following code?
numbers = [1, 2, 3]
for num in numbers:
if num == 2:
break
print(num)
1
12
123
None
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
2.What is the output of the following code?
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is less than or equal to 5")
x is greater than 5
x is less than or equal to 5
Error
None
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
3.Which of the following statements is true about while loops in Python?
The loop executes a fixed number of times.
The loop executes as long as the condition is true.
The loop executes only once.
The loop condition is optional.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
4.What is the output of the following code?
def multiply(a, b=2):
return a * b
print(multiply(3))
6
3
Error
None
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
5.What is the correct way to open a file in write mode?
open('file.txt', 'r')
open('file.txt', 'w')
open('file.txt', 'rw')
open('file.txt')
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
6.Which of the following statements about Python functions is false?
Functions can return multiple values.
Functions can have default parameters.
A function must always have a return statement
Functions can be nested inside other functions.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
7.What will be the output of this code?
x = 5 while x > 0: print(x, end=" ") x -= 1
5 4 3 2 1
5 4 3 2 1 0
5 4 3 2
None
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Python-Lists_Dictionaries

Quiz
•
University
18 questions
CSE 102 Exam 3 Practice

Quiz
•
University
20 questions
COMP177 Module 3 Quiz

Quiz
•
University
20 questions
AI BootCamp: 2024 Edition- Session 1

Quiz
•
University
20 questions
Python Strings

Quiz
•
University
16 questions
Arithmetic Types Declare Initialize Relation Logical Ops

Quiz
•
9th Grade - University
16 questions
Python and data processing test

Quiz
•
University
22 questions
EXCEPTION HANDLING IN PYTHON

Quiz
•
University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade