wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python_DS2

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which of this not about linked list ?

a)

A nonlinear collection of data elements

b)

It can be used to implement several other common abstract data types example stack, queue, tree

c)

It use more memory than arrays because of the storage used by their pointers.

d)

Each record of a linked list is often called an 'element' or 'node'

2.

Which the following circular linked list

a)
b)
c)
3.

What advantage does a linked list have over an array?

a)

A linked list can give you the data faster

b)

It is easier to use

c)

A linked list is not of a fixed size

d)

It's better

4.

What is the best and worst-case time complexity for searching for a value in a Linked List?

a)

O(1) and O(log n)

b)

O(1) and O(1)

c)

O(1) and O(n^2)

d)

O(1) and O(n)

5.

Nodes in a linked list contain two things

a)

Direction and a pointer

b)

Data and a pointer

c)

A Pointer and a reference

d)

A pointer and a node

6.

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

a)

Size of the list doesn't need to be mentioned at the beginning of the program

b)

You can add or remove elements from the middle of the list.

c)

The linked list doesn't have a size limit,

d)

Both of these are true.

7.

How to delete node B

a)

head->next=TempPtr; delete TemPtr;

b)

delete TempPtr; head->next=TempPtr->next;

c)

head->next=TempPtr->next; delete TempPtr;

d)

delete head; head->next= TempPtr->next

8.

To display data of the linked list:

a)

LinkedList *ptr; while (ptr!=NULL){ cout<<ptr->data;}

b)

LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;cout<<ptr->Data};

c)

LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;}

d)

LinkedList *ptr; while(ptr!=NULL){ ptr=ptr->Next;cout<<ptr->Next;}

9.

Linked List is a data structure that consists of sequence of nodes

a)

True

b)

False

10.

What does the following function do for a given Linked List with first node as head?

a)

Prints all nodes of linked lists

b)

Prints alternate nodes of Linked List

c)

Prints alternate nodes in reverse order

d)

Prints all nodes of linked list in reverse order