PYTHON QUIZ-I

PYTHON QUIZ-I

University

20 Qs

quiz-placeholder

Similar activities

COMP177 Mod 8 - Lists & Dictionaries

COMP177 Mod 8 - Lists & Dictionaries

University

16 Qs

Py-Hackathon - Week 2 - Day 2

Py-Hackathon - Week 2 - Day 2

University

15 Qs

CodeHS Basic Data Structures in Python

CodeHS Basic Data Structures in Python

University

20 Qs

Python-Day-3

Python-Day-3

12th Grade - University

15 Qs

Python basic 2

Python basic 2

University

15 Qs

Python Lists

Python Lists

University

20 Qs

Java Programming

Java Programming

University

20 Qs

Day 6 - ONLINE TEST - PL03 PYTHON PROGRAMMING

Day 6 - ONLINE TEST - PL03 PYTHON PROGRAMMING

University

20 Qs

PYTHON QUIZ-I

PYTHON QUIZ-I

Assessment

Quiz

Computers

University

Hard

Created by

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

  1. 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

  1. 4.What is the output of the following code?

  2. def multiply(a, b=2):

  3. return a * b

  4. print(multiply(3))

6

3

Error

None

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

  1. 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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?