Python Programming Quiz

Python Programming Quiz

University

15 Qs

quiz-placeholder

Similar activities

Code-101

Code-101

University

20 Qs

Python - Year 8

Python - Year 8

3rd Grade - University

10 Qs

CSE 102 Exam 2 Practice

CSE 102 Exam 2 Practice

University

15 Qs

Python_2R

Python_2R

KG - Professional Development

20 Qs

Day 6 - ONLINE TEST - PL03 PYTHON PROGRAMMING

Day 6 - ONLINE TEST - PL03 PYTHON PROGRAMMING

University

20 Qs

CodeVerse_Quizz_Round_01

CodeVerse_Quizz_Round_01

University

15 Qs

Python Basics

Python Basics

12th Grade - University

10 Qs

Technical Quiz - Round 2

Technical Quiz - Round 2

University

15 Qs

Python Programming Quiz

Python Programming Quiz

Assessment

Quiz

Computers

University

Hard

Created by

SUBBURAJ S

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of variables in Python programming?

The purpose of variables in Python programming is to store and manipulate data.

The purpose of variables in Python programming is to handle exceptions.

The purpose of variables in Python programming is to display output.

The purpose of variables in Python programming is to create loops.

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is a valid data type in Python? a) Integer b) Float c) String d) All of the above

c) String

b) Float

a) Integer

d) All of the above.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code snippet? x = 5 y = 2 print(x % y)

3

1

2

0

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which control flow statement is used to execute a block of code repeatedly as long as a certain condition is true?

for

if

while

switch

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code snippet? numbers = [1, 2, 3, 4, 5] for num in numbers: print(num)

1 2 3 4

1 2 3 4 5

1 2 3 4 5 6

1 2 3 4 5

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which file mode is used to open a file for reading?

w

a

x

r

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code snippet? file = open('data.txt', 'r') print(file.read()) file.close()

The output of the code snippet will be the file object.

The output of the code snippet will be the contents of the 'data.txt' file.

The code will throw an error because the file 'data.txt' does not exist.

The output of the code snippet will be an empty string.

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?