NEW
Font size
WorksheetsPython Workshop Day - 2
Total questions: 15
Worksheet time: 3mins
What method in Python is used to add an element at the end of a list?
add()
extend()
insert()
append()
How are tuples different from lists in Python?
Tuples are immutable, while lists are mutable.
Tuples are mutable, while lists are immutable.
Tuples are ordered, while lists are unordered.
Tuples use square brackets, while lists use parentheses.
Which of the following methods is used to concatenate two tuples in Python?
merge()
append()
The '+' operator
extend()
How is a single-element tuple defined in Python?
(element)
(element,)
[element]
element,
What is the primary characteristic of a set in Python?
Does not allow duplicate elements
Allows duplicate elements
Maintains elements in order of insertion
Stores elements in key-value pairs
In a list, what method is used to remove the last element?
remove()
pop()
discard()
delete()
What is the primary difference between a set and a list in Python?
Sets allow duplicate elements, whereas lists do not.
Lists are unordered, while sets are ordered.
Lists are immutable, while sets are mutable.
Sets do not allow duplicate elements, whereas lists do.
What does the 'difference()' method do in sets in Python?
Returns the symmetric difference of two sets
Returns the intersection of two sets
Returns the difference of two sets
Returns the union of two sets
In NumPy, what does the shape of an array represent?
Number of elements in the array
Number of dimensions and size along each dimension
Data type of the array
Total size of the array
What is the primary data structure in pandas for one-dimensional labelled data?
DataFrame
Series
Array
List
In pandas, what is the purpose of the df.head() method?
Display the last few rows of the DataFrame
Display the first 10 rows of the DataFrame
Display the first 5 rows of the DataFrame
Sort the DataFrame in ascending order
How can you check for missing values in a pandas DataFrame?
df.check_missing()
df.has_null()
df.isnull()
df.missing_values()
What is the purpose of the pd.read_csv function in pandas?
Write data to a CSV file
Read data from a CSV file into a DataFrame
Calculate summary statistics for a CSV file
Convert a DataFrame to a CSV file
Which of the following statements is true about the pyplot module in Matplotlib?
It is not a part of Matplotlib.
It is used for creating complex, interactive visualizations.
It provides a MATLAB-like interface for creating simple plots.
It is specifically designed for handling pandas DataFrames.
How can you create a line plot in Matplotlib using the pyplot module?
pyplot.line()
pyplot.plot_line()
pyplot.create_line()
pyplot.plot()
