
Python Functions and File Operations Quiz
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
Arvind Singh
Used 2+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What keyword is used to define a function in Python?
function
def
define
func
2.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What is the purpose of the return statement in a function?
To print output
To define a function
To end a function
To return a value
3.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What does the *args syntax allow in a function definition?
To pass a fixed number of arguments
To define a function
To pass a variable number of arguments
To pass keyword arguments
4.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
Which mode is used to open a file for writing in Python?
x
w
r
a
5.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What does the .readline() method do?
Writes a line to the file
Reads the entire file
Reads a single line from the file
Reads multiple lines from the file
6.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What is the purpose of the global keyword in Python?
To create a local variable
To create a global variable
To delete a variable
To define a function
7.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What does the os.remove() method do?
Deletes a file
Creates a new file
Renames a file
Opens a file
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
19 questions
Informatika Kelas 5 Bab 2
Quiz
•
5th Grade - University
18 questions
Quiz on Misinformation and Bias
Quiz
•
10th Grade - University
18 questions
PRUEBA FINAL COMPUTACION
Quiz
•
1st Grade - University
20 questions
DI (EM24) - Diseño de Contenidos (T8)
Quiz
•
University - Professi...
15 questions
Cuestionario sobre seguridad en línea
Quiz
•
2nd Grade - University
20 questions
COA_QUIZ_UNIT I
Quiz
•
University
21 questions
CPA MS-Office Hotkeys Quiz
Quiz
•
8th Grade - Professio...
16 questions
Algo Quiz
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
