
Python Functions and File Operations Quiz

Quiz
•
Computers
•
University
•
Medium
Arvind Singh
Used 2+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
TechnoFuzzle

Quiz
•
University
15 questions
Quiz No. 1 - Operating System Basics

Quiz
•
University
20 questions
Linux Directory Structures

Quiz
•
10th Grade - University
15 questions
Python Programming Intermediate-1

Quiz
•
University
15 questions
Five pillar of information security

Quiz
•
University
20 questions
Web Systems and Technologies

Quiz
•
University
20 questions
KV5004 Week 2

Quiz
•
University
20 questions
Sistemas Operativos - CLI

Quiz
•
University
Popular Resources on Wayground
15 questions
Hersheys' Travels Quiz (AM)

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
30 questions
Lufkin Road Middle School Student Handbook & Policies Assessment

Quiz
•
7th Grade
20 questions
Multiplication Facts

Quiz
•
3rd Grade
17 questions
MIXED Factoring Review

Quiz
•
KG - University
10 questions
Laws of Exponents

Quiz
•
9th Grade
10 questions
Characterization

Quiz
•
3rd - 7th Grade
10 questions
Multiply Fractions

Quiz
•
6th Grade