NEW
Font size
WorksheetsDATA STRUCTUIR Quiz1 (AIML)
Total questions: 20
Worksheet time: 15mins
What is the value of the postfix expression 6 3 2 4 + – *:
1
14
74
-18
If the insertion and deletion happens from both the ends then the queue is called a______Queue
a) Deque
b) Header
c) Queue
d) Circular Queue
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
If for an algorithm time complexity is given by O(n) then complexityof it is:
A. constant
B. linear
C. exponential
D. none of the mentioned
The number of elements in the adjacency matrix of a graph having 7 vertices is
7
14
49
34
What is the number of moves required to solve Tower of Hanoi problem for k disks?
a) 2k – 1
b) 2k + 1
c) 2k + 1
d) 2k – 1
In linked list implementation of a queue, where does a new element be inserted?
a) At the head of link list
b) At the tail of the link list
c) At the centre position in the link list
d) None
Consider the following definition in c programming language.
struct node { int data; struct node next; }
typedef struct node NODE;
NODE *ptr;
Which of the following c code is used to create new node?
ptr = (NODE*)malloc(sizeof(NODE));
ptr = (NODE*)malloc(NODE);
ptr = (NODE*)malloc(sizeof(NODE*));
ptr = (NODE)malloc(sizeof(NODE));
What is the way to increment the rear end of a circular queue?
(Rear+1) mod MAX
Rear mod MAX
(Front+1) mod MAX
(Rear-1) mod MAX
The algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order
A. Insertion sort
B. Quick sort
C. Selection sort
D. Bubble sort
Recognize the algorithm that does not divide the list.
Merge sort
Binary Search
Linear Search
Quick sort
In the ....... traversal we process all of a vertex’s descendants before we move to an adjacent vertex.
A. Depth Limited
B. Breadth First
C. Width First
D. Depth First
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be the slowest?
union
membership
cardinality
union, intersection
Which of the following algorithms is not feasible to implement in a linked list?
Insertion Sort
Quick Sort
Heap Sort
Binary Search
Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?
Deleting a node whose location is given
Searching an unsorted list for a given item
Inserting a node after the node with a given location
Traversing the list to process each node
Consider a singly linked list of the form where F is a pointer to the first element in the linked list and L is the pointer to the last element in the list. The time of which of the following operations depends on the length of the list?
Delete the last element of the list
Delete the first element of the list
Add an element after the last element of the list
Interchange the first two elements of the list
Assume that the operators +,-, X are left associative and ^ is right associative.
The order of precedence (from highest to lowest) is ^, X, +, -.
The postfix expression for the infix expression
a + b X c – d ^ e ^ f is?
abc X+ def ^^ –
abc X+ def ^^ –
ab+c Xd – e ^f^
-+aXbc^ ^def
Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst-case time complexity of the best known algorithm to delete the node x from the list?
O(n)
O(log2 n)
O(logn)
O(1)
Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the no of element present on stack are
1
3
2
4
When a collision occurs with a hashing function, what is one method for dealing with the collisions?
creating a new linked list at that index
creating a new array
creating a new hash table
creating a new binary tree
