Python Programming Quiz

Python Programming Quiz

12th Grade

10 Qs

quiz-placeholder

Similar activities

12 chap cs 14

12 chap cs 14

12th Grade

10 Qs

Javascript

Javascript

10th - 12th Grade

15 Qs

PCEP Section 1A: Understand fundamental terms and definitions

PCEP Section 1A: Understand fundamental terms and definitions

12th Grade

15 Qs

Chapter 4 Command Line Interface

Chapter 4 Command Line Interface

9th - 12th Grade

5 Qs

Mastering Text File Handling in Python

Mastering Text File Handling in Python

12th Grade

10 Qs

LUA Test

LUA Test

9th Grade - University

10 Qs

Writing files in python

Writing files in python

9th - 12th Grade

13 Qs

Quiz Input Python

Quiz Input Python

12th Grade

12 Qs

Python Programming Quiz

Python Programming Quiz

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Janaki Sivakumar

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax to create a function in Python?

function myFunction():

def myFunction[]:

def myFunction():

create function myFunction():

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? x = [1, 2, 3] print(x * 2)

[1, 2, 3, 1, 2, 3]

[2, 4, 6]

[[1, 2, 3], [1, 2, 3]]

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to read a file in Python?

file = open("filename.txt", "r")

file = open("filename.txt")

file = open("filename.txt", "read")

file = open("filename.txt", "w")

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? my_list = [2, 4, 6, 8] my_list.append(10) print(my_list)

[2, 4, 6, 8]

[2, 4, 6, 8, 10]

[10, 2, 4, 6, 8]

None of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following data structures does Python's set type represent?

Ordered collection of unique elements

Unordered collection of unique elements

Ordered collection with duplicate elements

Unordered collection with duplicate elements

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a list and a tuple in Python?

Lists are immutable, tuples are mutable

Tuples are immutable, lists are mutable

Lists are faster to iterate over

Tuples allow duplicate values while lists do not

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? x = 5 y = 10 x, y = y, x print(x, y)

5 10

10 5

None None

Error

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?