wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DS QUIZ 1

Total questions: 85

Worksheet time: 51mins

Name
Class
Date
1.

The situation when in a linked list START=NULL is

a)

underflow

b)

overflow

c)

housefull

d)

saturated

2.

Each node in a linked list has two pairs of ………….. and ……………….

a)

Link field and information field

b)

Link field and avail field

c)

Avail field and information field

d)

Address field and link field

3.

A linear list in which each node has pointers to point to the predecessor and successors nodes is called as

a)

Singly Linked List

b)

Circular Linked List

c)

Doubly Linked List

d)

Linear Linked List

4.

Linked lists are best suited

a)

for relatively permanent collections of data

b)

for the size of the structure and the data in the structure are constantly changing

c)

for both of above situation

d)

for none of above situation

5.

Arrays are best suited

a)

for relatively permanent collections of data

b)

for the size of the structure and the data in the structure are constantly changing

c)

for both of above situation

d)

for none of above situation

6.

Which of the following data structure is linear type?

a)

List

b)

Tree

c)

Graph

d)

All of the above

7.

Which of these best describes an array?

a)

A data structure that shows a hierarchical behavior

b)

Container of objects of similar types

c)

Arrays are immutable once initialized

d)

Array is not a data structure

8.

To create a linked list, we can allocate space and make something point to it, by


writing:


struct-name *pointer-variable;


Which of the following statement will correctly allocate the space

a)

pointer-variable= malloc(sizeof(*struct-name));

b)

pointer-variable = malloc(sizeof(struct struct-name));

c)

pointer-variable = alloc(sizeof(struct struct-name));

d)

pointer-variable = alloc(sizeof(*struct-name));

9.

The situation when in a linked list HEAD=NULL is

a)

Underflow

b)

Overflow

c)

Housefull

d)

Saturated

10.

What does a linked list use to store it's data?

a)

Node

b)

Step

c)

Array

d)

Module

11.

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

void fun1(struct node* head)

{

if(head == NULL)

return;

fun1(head->next);

printf("%d ", head->data);

}

a)

Prints all nodes of linked lists

b)

Prints all nodes of linked list in reverse order

c)

Prints alternate nodes of Linked List

d)

Prints alternate nodes in reverse order

12.

How many pointers are necessarily changed for the insertion in a Linked List?

a)

1

b)

2

c)

3

d)

5

13.

Stack is also called as

a)

Last in first out

b)

First in last out

c)

Last in last out

d)

First in first out

14.

Which of the following is not the part of ADT description?

a)

Data

b)

Operations

c)

Both of the above

d)

None of the above

15.

Which of the following data structure is non linear type?

a)

string

b)

List

c)

stack

d)

graph

16.

Identify the data structure which allows deletions at both ends of the list but insertion at only one end.

a)

Input restricted dequeue

b)

Output restricted dequeue

c)

Priority queues

d)

Linear queue

17.

Which of the following data structure can’t store the non-homogeneous data elements?

a)

Arrays

b)

Records

c)

pointer

d)

stack

18.

Which data structure allows deleting data elements front and inserting at rear?

a)

stack

b)

queue

c)

deque

d)

Array

19.

………… is very useful in situation when data have to stored and then retrieved in reverse order

a)

stack

b)

queue

c)

deque

d)

array

20.

Inserting an item into the stack when stack is not full is called …………. Operation and deletion of item form the stack, when stack is not empty is called ………..operation.

a)

push, pop

b)

pop, push

c)

insert, pop

d)

push, delete

21.

. …………… is not the component of the data structure

a)

operation

b)

Storage Structures

c)

Algorithm

d)

Non of the above

22.

Stack Full condition

a)

TOP==-1

b)

TOP==0

c)

TOP==MAX

d)

TOP==MAX-1

23.

Stack Empty condition

a)

TOP==-1

b)

TOP==0

c)

TOP==MAX

d)

TOP==MAX-1

24.

Linear queue full condition

a)

REAR==MAX

b)

REAR==MAX-1

c)

FRONT==MAX

d)

FRONT==MAX-1

25.

Linear queue contains one elements, when---------

a)

REAR==-1

b)

REAR==FRONT

c)

FRONT==1

d)

REAR==1 && FRONT==-1

26.

Circular queue is empty

a)

REAR==FRONT

b)

REAR==0

c)

REAR==-1

d)

FRONT==0

27.

circular queue is full condition

a)

REAR==MAX-1 && FRONT==1

b)

REAR==0 && FRONT==MAX-1

c)

REAR==MAX-1 && FRONT==MAX-1

d)

REAR==MAX-1 && FRONT==0

28.

Which of the following is an infix expression?

a)

ab+c*

b)

abc+*

c)

(a+b)*(c+d)

d)

+a+bc

29.

What is the postfix expression for the corresponding infix expression?

a+b*c+(d*e)

a)

abc*+de*+

b)

abc+*de*+

c)

a+bc*de+*

d)

abc*+(de)*+

30.
What is a data structure?
a)
A method of arranging data
b)
A way of keeping data without an order?
c)
A "stack" only
d)
There is no formal definition for "Data Structure"
31.
 In computing, What is FILO?
a)
First In First Out
b)
First In Last out
c)
Last Out Lowest Order
d)
A very thin unleavened dough used for making pastries such as baklava and börek in Middle Eastern and Balkan cuisines.
32.
What would a dynamic data structure entail?
a)
Memory is allocated to the data structure as the program executes.
b)
Memory is allocated to the data structure at compile time.
c)
The size of the structure is fixed
d)
The data structure can also double as TNT
33.
Which of these sorting methods uses "divide and conquer"?
a)
Bubble Sort
b)
Quick Sort
c)
Cocktail Sort
d)
Selection Sort
34.
A strength of Linear searches is that they can be performed without sorting the list before hand... 
a)
True
b)
False
35.
A Binary search requires the data it is searching to be ordered in some way...
a)
True
b)
False
36.
For a ordered list of 11 items, how many comparisons will a linear search need before it knows that a value in NOT in the list?
a)
12
b)
11
c)
6
d)
4
37.
For a ordered list of 11 items, how many comparisons will a Binary search need before it knows that a value in NOT in the list?
a)
12
b)
11
c)
6
d)
4
38.
For a linked list, what meta-data will need to be stored with each data entry?
a)
The Name of the list
b)
The address of the current data entry
c)
The address of the next data entry in the list
d)
The meaning of life
39.

Which of the following points is/are true about Linked List data structure when it is compared with array

a)

Arrays have better cache locality that can make them better in terms of performance.

b)

It is easy to insert and delete elements in Linked List

c)

Random access is not allowed in a typical implementation of Linked Lists

d)

The size of array has to be pre-decided, linked lists can change their size any time.

e)

All of the above

40.

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


void fun1(struct node* head)

{

if(head == NULL)

return;

fun1(head->next);

printf("%d ", head->data);

}

a)

Prints all nodes of linked lists

b)

Prints all nodes of linked list in reverse order

c)

Prints alternate nodes of Linked List

d)

Prints alternate nodes in reverse order

41.

Which of the following is not a disadvantage to the usage of array?

a)

Fixed size

b)

There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

c)

Insertion based on position

d)

Accessing elements at specified positions

42.

Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?

a)

Deleting a node whose location in given

b)

Searching of an unsorted list for a given item

c)

Inverting a node after the node with given location

d)

Traversing a list to process each node

43.

In linked list each node contain minimum of two fields. One field is data field to store the data second field is?

a)

Pointer to character

b)

Pointer to integer

c)

Pointer to node

d)

Node

44.

Linked lists are not suitable to for the implementation of?

a)

Insertion sort

b)

Radix sort

c)

Polynomial manipulation

d)

Binary search

45.

Linked list is considered as an example of ___________ type of memory allocation.

a)

Dynamic

b)

Static

c)

Compile time

d)

None of the mentioned

46.

Under which data structure category does the Stack fall?

a)

Homogeneous

b)

Built-in

c)

Non linear

d)

Linear

47.

The data structure which expands and shrinks as per demand is called:

a)

Array

b)

Dynamic

c)

Linked list

d)

Non-linear

48.

The operation to arrange all elements in required order is called:

a)

Search

b)

Insertion

c)

Sorting

d)

Merging

49.

Identify the correct statement:

a)

Stack is FIFO and Queue is LIFO

b)

Stack is LIFO and Queue is FIFO

c)

Stack and Queue are both LIFO

d)

Stack and Queue are both FIFO

50.

Given a prefix and a postfix notation what are the difference between them?

a)

The postfix equation is solved starting from the right whereas the prefix notation is solved from the left

b)

The postfix equation is solved starting from the left whereas the prefix notation is solved from the right

c)

The postfix equation is solved starting from the left whereas the prefix notation is solved from the right

d)

The postfix equation is solved starting from the left whereas the prefix notation is solved from the left

51.

Consider the following pseudocode that uses a stack

declare a stack of characters

while ( there are more characters in the word to read ){

{

read a character

push the character on the stack

}

while ( the stack is not empty )

{ pop a character off the stack

write the character to the screen

}

What is output for input "computer"?

a)

computer

b)

computercomputer

c)

retupmocretupmoc

d)

retupmoc

52.

In __________ notation, the operator is placed between the operands.

a)

infix

b)

prefix

c)

postfix

d)

none of

above

53.

_________ is any node with an out-degree of zero.

a)

root

b)

internal node

c)

parent

d)

leaf

54.

A node that is not a root or a leaf is known as __________ node because it is found in the middle portion of a tree.

a)

root

b)

leaf

c)

internal node

d)

tree

55.

A node is a __________ if it has successor nodes - that is, if it has an out-degree greater than zero.

a)

child

b)

parent

c)

siblings

d)

none of above

56.

If the tree is not empty, then the first node is called ________.

a)

leaf

b)

internal node

c)

root

d)

none of above

57.

A node is a __________ if it has successor nodes - that is, if it has an out-degree greater than zero.

a)

child

b)

parent

c)

siblings

d)

none of above

58.

A node with a predecessor is a ______ . It has an in-degree of one.

a)

child

b)

parent

c)

siblings

d)

none of above

59.

Two or more nodes with the same parent are _______.

a)

child

b)

parent

c)

siblings

d)

none of above

60.

An _________ is any node in the path from root to the node.

a)

Ancestor

b)

Descendent

c)

tree

d)

none of above

61.

A binary tree in which every node other than leaf nodes has two children is called ________.

a)

full binary tree

b)

complete binary tree

c)

half binary tree

d)

complete half binary tree

62.

____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.

a)

linear

b)

homogeneous

c)

static

d)

dynamic

63.

Any two nodes which are connected by an edge in a graph are called _________ nodes.

a)

Adjacent

b)

Proper

c)

Node

d)

None of above

64.

. An edge of a graph which joins a node to itself is called ________.

a)

node

b)

loop

c)

tree

d)

none of above

65.

Distinct edges which connect the same end points are called _________ edges.

a)

parallel

b)

level

c)

both a and b

d)

none of above

66.

In a graph, a node which is not adjacent to any other node is called _______ node

a)

multi

b)

single

c)

isolated

d)

none of above

67.

The no. of edges appearing in the sequence of a path is called the _______of the path.

a)

length

b)

width

c)

height

d)

none of above

68.

The path is a __________ if it begins and ends at the same vertex.

a)

wheel

b)

circuit

c)

length

d)

none of above

69.
What is the significance of the back pointer in the array representation of a queue?
a)
Holds the location of the next available space in the queue
b)
Last item in the list
c)
Used for backtracking
d)
First item in the list
70.

Why do we need to organize data in a computer? Check all possible answers.

a)

You will easily direct someone to access a file for you.

b)

You will easily update back-ups or switch computers.

c)

You will always know where to find what you need.

d)

You will never waste time where to save anything.

71.

How do you call this special function that is used to map a given value with a particular key for faster access of elements?

a)

merge

b)

sorted array

c)

hash

d)

bubble

72.

State the meaning of "void" keyword:

a)

No statement

b)

No function

c)

No program

d)

No value

73.

Which of the following operator can be used to access value at address stored in a pointer variable?

a)

*

b)

&

c)

->

d)

.

74.

What is the output of the below code snippet?

a)

Infinite loop

b)

Prints “Hello” once

c)

No output

d)

Compile error

75.

To create a linked list, we can allocate space and make something point to it, by


writing:


struct-name *pointer-variable;


Which of the following statement will correctly allocate the space

a)

pointer-variable= malloc(sizeof(*struct-name));

b)

pointer-variable = malloc(sizeof(struct struct-name));

c)

pointer-variable = alloc(sizeof(struct struct-name));

d)

pointer-variable = alloc(sizeof(*struct-name));

76.

Which type of linked list comprises a node containing a pointer to predecessor as well as successor?

a)

Singly linked list

b)

Doubly Linked List

c)

Circular Linked List

d)

None of the above

77.

Applications of Linked list

a)

Polynomial Arithmetic

b)

Multi lists

c)

Radix Sort

d)

All the above

78.

What is the output of following function for start pointing to first node of following linked list? 1->2->3->4->5->6

void fun(struct node* start)

{

if(start == NULL)

return;

printf("%d ", start->data);

if(start->next != NULL )

fun(start->next->next);

printf("%d ", start->data);

}

a)

1 4 6 6 4 1

b)

1 3 5 1 3 5

c)

1 2 3 5

d)

1 3 5 5 3 1

79.

Linked list is considered as an example of ___________ type of memory allocation.

a)

Static

b)

Dynamic

c)

Compile time

d)

None of the mentioned

80.

Which of the following points is/are true about Linked List data structure when it is compared with array

a)

Arrays have better cache locality that can make them better in terms of performance

b)

It is easy to insert and delete elements in Linked List

c)

Random access is not allowed in a typical implementation of Linked Lists

d)

All of the mentioned

81.

Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?

a)

Deleting a node whose location in given

b)

Searching of an unsorted list for a given item

c)

Inverting a node after the node with given location

d)

Traversing a list to process each node

82.

A variant of the linked list in which none of the node contains NULL pointer is?

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

None of the above

83.

If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?

a)

a) ABCD

b)

b) DCBA

c)

c) DCAB

d)

d) ABDC

84.

how to insert a node at the end of Doubly Linked list?

a)

while(p->next!=NULL)

p=p->next;

newnode->next=NULL;

p->next=newnode;

newnode->prev=p;

b)

while(p->!=NULL)

p=p->next;

newnode->next=NULL;

p->next=newnode;

c)

while(p->next!=NULL)

p=p->next;

newnode->next=NULL;

newnode->prev=p;

d)

while(p->next!=NULL)

p=p->next;

newnode->next=NULL;

p->next=newnode;

newnode->prev=NULL;

85.

While evaluating the postfix expression, what would be pushed into the stack?

a)

operands

b)

operators

c)

operators and opening symbols

d)

operators and operands

e)

stack is not used for this evaluation