wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Numpy to User-defined Data Structures in Python Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is a linked list in Python?

a)

A. A built-in data type for storing key-value pairs

b)

B. A sequence of nodes where each node contains data and a reference to the next node

c)

C. A collection of elements stored in contiguous memory locations

d)

D. A data structure that allows random access to elements

2.

In a singly linked list, what does each node contain?

a)

A. Only the data value

b)

B. Data and references to both previous and next nodes

c)

C. Data and a reference to the next node

d)

D. Data and a unique identifier

3.

What is the primary advantage of using a linked list over an array?

a)

A. Faster access to elements by index

b)

B. Dynamic memory allocation allowing efficient insertions and deletions

c)

C. Requires less memory for storage

d)

D. Simplified sorting algorithms

4.

How do you insert a new node at the beginning of a singly linked list in Python?

a)

A. Create a new node and set its next reference to the current head, then update the head to the new node

b)

B. Traverse to the end of the list and add the new node there

c)

C. Replace the data in the head node with the new data

d)

D. Use the insert() method provided by Python lists

5.

What happens when you delete a node from a singly linked list?

a)

A. The entire list is restructured automatically

b)

B. The node is removed, and the previous node’s next reference is updated to skip the deleted node

c)

C. The node’s data is set to None, but the node remains in the list

d)

D. Python’s garbage collector automatically removes the node without any need for reference updates

6.

In Python, a class is defined using the (a)   keyword.

7.

The (a)   method is a special method in Python classes that is automatically called when a new object is created.

8.

In Python, (a)   refers to the instance of the class and is used to access variables and methods associated with the object.

9.

An object is an instance of a (a)   .

10.

Attributes that are specific to an instance of a class are called (a)   attributes.

11.

The four main built-in data structures in Python are list, tuple, set, and (a)   .

12.

A (a)   is an ordered, mutable collection that allows duplicate elements.

13.

A (a)   is an unordered collection of unique elements in Python.

14.

In a dictionary, data is stored in (a)   pairs.

15.

Unlike lists, a (a)   is immutable and cannot be changed after creation.

16.

What is the primary data structure in Pandas used for representing tabular data?

a)

List

b)

DataFrame

c)

Tuple

d)

Dictionary

17.

Which function is used to read a CSV file into a DataFrame in Pandas?

a)

pd.read_excel()

b)

pd.read_json()

c)

pd.read_csv()

d)

pd.read_sql()

18.

Which method is used to view the first few rows of a DataFrame?

a)

df.column_name

b)

df[“column_name”]

c)

df.select(“column_name”)

d)

Both A and B

19.

Which method is used to view the first few rows of a DataFrame?

a)

df.column_name

b)

df[“column_name”]

c)

df.select(“column_name”)

d)

Both A and B

20.

Which function is used to drop missing values from a DataFrame in Pandas?

a)

df.remove_na()

b)

df.dropna()

c)

df.clean()

d)

df.fillna()