Python Programming Quiz

Python Programming Quiz

University

58 Qs

quiz-placeholder

Similar activities

ICTU LẬP TRÌNH HĐT - BÀI 2

ICTU LẬP TRÌNH HĐT - BÀI 2

University

63 Qs

Latihan AAS Ganjil kls 8

Latihan AAS Ganjil kls 8

8th Grade - University

60 Qs

 COMPUTER SYSYTEMS SERVICING

COMPUTER SYSYTEMS SERVICING

10th Grade - University

55 Qs

Challenge Fullstack : Évaluez Vos Fondamentaux

Challenge Fullstack : Évaluez Vos Fondamentaux

2nd Grade - University

55 Qs

PRELIM EXAM_INTERNET RESEARCH FOR BUSINESS

PRELIM EXAM_INTERNET RESEARCH FOR BUSINESS

University

55 Qs

Creación de BD, PostgreSQL y Normalización

Creación de BD, PostgreSQL y Normalización

University

53 Qs

Chương 2 - Ứng dụng phân tán

Chương 2 - Ứng dụng phân tán

University

54 Qs

Introduction to Web Technology and CSS

Introduction to Web Technology and CSS

University

60 Qs

Python Programming Quiz

Python Programming Quiz

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Hard

Created by

Ms.ROOP R

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

58 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is the correct syntax for defining a function in Python?

function my_function():

def my_function:

def my_function():

function: my_function()

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you create a new list with elements from another list, doubled?

[x * 2 for x in my_list]

[2 * x for x in my_list]

[2 + x for x in my_list]

list([2 * x for x in my_list])

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is the correct syntax to open a file for reading in Python?

open('file.txt', 'r')

file.open('file.txt', 'read')

open.read('file.txt')

open('file.txt')

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How would you write a lambda function to return the square of a number x?

lambda x: x * x

lambda x: x^2

square(x) = x * x

def square(x): return x * x

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is a correct way to catch an exception in Python?

try except Exception as e:

try: except Exception:

try: raise Exception

try: catch:

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the correct syntax for importing the math module in Python?

import math

from math import *

include math

use math

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which statement is used to end a loop or function in Python?

break

exit

end

return

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?