
Python Programming Quiz

Quiz
•
Information Technology (IT)
•
University
•
Hard
Ms.ROOP R
Used 4+ times
FREE Resource
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
Similar Resources on Wayground
62 questions
BỔ TRỢ THIẾT KẾ WEB BÀI 1

Quiz
•
University
60 questions
Python 1

Quiz
•
University
60 questions
IMC413 Test 2 20244

Quiz
•
University
55 questions
Chapter 6 - Chapter 8 Python

Quiz
•
University
60 questions
Data Structure UTS

Quiz
•
University
61 questions
Test Quiz

Quiz
•
University
60 questions
Presja Czasu INF.03

Quiz
•
11th Grade - University
58 questions
Computer Fundamentals Quiz

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University