Font size
WorksheetsNumpy to User-defined Data Structures in Python Quiz
Total questions: 20
Worksheet time: 10mins
What is a linked list in Python?
A. A built-in data type for storing key-value pairs
B. A sequence of nodes where each node contains data and a reference to the next node
C. A collection of elements stored in contiguous memory locations
D. A data structure that allows random access to elements
In a singly linked list, what does each node contain?
A. Only the data value
B. Data and references to both previous and next nodes
C. Data and a reference to the next node
D. Data and a unique identifier
What is the primary advantage of using a linked list over an array?
A. Faster access to elements by index
B. Dynamic memory allocation allowing efficient insertions and deletions
C. Requires less memory for storage
D. Simplified sorting algorithms
How do you insert a new node at the beginning of a singly linked list in Python?
A. Create a new node and set its next reference to the current head, then update the head to the new node
B. Traverse to the end of the list and add the new node there
C. Replace the data in the head node with the new data
D. Use the insert() method provided by Python lists
What happens when you delete a node from a singly linked list?
A. The entire list is restructured automatically
B. The node is removed, and the previous node’s next reference is updated to skip the deleted node
C. The node’s data is set to None, but the node remains in the list
D. Python’s garbage collector automatically removes the node without any need for reference updates
In Python, a class is defined using the (a) keyword.
The (a) method is a special method in Python classes that is automatically called when a new object is created.
In Python, (a) refers to the instance of the class and is used to access variables and methods associated with the object.
An object is an instance of a (a) .
Attributes that are specific to an instance of a class are called (a) attributes.
The four main built-in data structures in Python are list, tuple, set, and (a) .
A (a) is an ordered, mutable collection that allows duplicate elements.
A (a) is an unordered collection of unique elements in Python.
In a dictionary, data is stored in (a) pairs.
Unlike lists, a (a) is immutable and cannot be changed after creation.
What is the primary data structure in Pandas used for representing tabular data?
List
DataFrame
Tuple
Dictionary
Which function is used to read a CSV file into a DataFrame in Pandas?
pd.read_excel()
pd.read_json()
pd.read_csv()
pd.read_sql()
Which method is used to view the first few rows of a DataFrame?
df.column_name
df[“column_name”]
df.select(“column_name”)
Both A and B
Which method is used to view the first few rows of a DataFrame?
df.column_name
df[“column_name”]
df.select(“column_name”)
Both A and B
Which function is used to drop missing values from a DataFrame in Pandas?
df.remove_na()
df.dropna()
df.clean()
df.fillna()
