WorksheetsData Structure Quiz1
Total questions: 20
Worksheet time: 11mins
Example of linear data structure except
array
tree
queue
stack
It use pointer to link nodes.
Variable
Link List
Pointer
Trees
int nums[ ] =
{2, 3, 5, 8, 9, 11};
How would you access the fourth element in nums
nums[8]
nums[3]
nums(4)
nums(3)
circular linked list
linked list
doubly circular linked list
doubly linked list
int is __________ data type.
user defined
derived
primary
all of above
Array is ___________ data type.
user defined
primary
derived
all of above
In ____________ data structure, the data items are arranged in a linear sequence.
linear
non linear
both a and b
all of above
In ___________ data structure data items are not in sequence.
non linear
linear
non-homogeneous
all of above
A function calls itself is called ___________.
queue
recursion
function
none of above
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
What do you call a collection of items stored at contiguous memory locations?
Linked List
Linear List
Array
Data Structure
A (a) is a linear data structure, in which elements are not stored at contiguous memory locations.
(a) is defined as a mathematical model with a collection of operations defined on that model.
Routine to delete element in an array implementation of List
for(i=pos-1;i<n-1;i++)
list[i]=list[i-1];
for(i=pos-1;i<n-1;i++)
list[i]=list[i*1];
for(i=pos-1;i<n-1;i++)
list[i]=list[i+1];
for(i=pos-1;i<n-1;i++)
list[i]=list[i+2];
Give syntax to create a node for Single linked list?
newnode=(struct node *)malloc(sizeof(struct node*));
newnode=(struct node )malloc(sizeof(struct node));
newnode=(struct node *)malloc(sizeof(struct node));
newnode=(struct node )malloc(sizeof(struct node*));
How to insert a node after a position P in singly linked list?
Newnode -> data = P ;
Newnode -> next = p ->next ;
P -> next = newnode ;
Newnode -> data = x ;
Newnode -> next = p ->next ;
P -> next = L ;
Newnode -> data = x ;
Newnode -> next = p ->node ;
P -> nextnode = next ;
Newnode -> data = x ;
Newnode -> next = p ->next ;
P -> next = newnode ;
D.S . stands for
Digital Society
Digital Standards
Deputy Supreme
Data structure
This structure uses a pointer to link nodes.
Variable
Link List
Pointer
Trees
