WorksheetsPython libraries: Random, PIL, Wave
Total questions: 14
Worksheet time: 7mins
What does the function random() return?
A random float number between 0 and 1
A random element from a list
A list of unique elements
A random integer between 0 and 10
Which function would you use to select a random item from a list?
randint(a, b)
sample(population, k)
shuffle(x)
choice(seq)
What is the RGB code for the color Green?
(255, 255, 0)
(0, 0, 255)
(0, 255, 0)
(255, 0, 0)
Which method is used to create a new image in PIL?
Image.open()
Image.save()
Image.create()
Image.new()
What does the function wave.open() do?
Writes frames to a WAV file
Reads frames from a WAV file
Creates a new WAV file
Opens a WAV file
Which function would you use to shuffle a list in Python?
randomize(x)
shuffle(x)
sort(x)
mix(x)
What is the purpose of the ImageDraw module in PIL?
To manipulate image colors
To open image files
To draw on images
To save images
Which function is used to resize an image in PIL?
Image.resize()
Image.change_size()
Image.scale()
Image.size()
What does the function sample(population, k) return?
A shuffled list
A random integer
A list of k unique elements from the population
A random float
Which of the following is NOT a standard color in RGB?
Red
Purple
Green
Blue
What does the method getparams() return in the wave module?
The audio duration
The file path
The number of frames
Audio file parameters
Which function is used to apply a filter to an image in PIL?
Image.apply_filter()
Image.use_filter()
Image.add_filter()
Image.filter()
What is the purpose of the function readframes(n) in the wave module?
To get audio parameters
To open a WAV file
To read n frames from the file
To write frames to a WAV file
Which function would you use to save an image in PIL?
Image.save()
Image.write()
Image.export()
Image.store()
