Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 16

Hope Foundation’s

International Institute of Information Technology, Pune

Department of Computer Engineering

Semester - I (AY 2020 - 21)

Online Test MCQs

Class: SE (Comp. Engg.) Subject: Fundamentals of Data Structures

Unit-IV

Q.1 Linked lists, at any point in the list in constant time, does not allow __________. (1M)
A) Random access.
B) Insertion
C) Deletion
D) Insertion at end

Q.2. Consider a linked list of n element which is pointed by an external pointer. What is the time
taken to delete the element which is successor of the element pointed to by a given pointer? (2M)
A)O(1)
B)O(log2 n)
C)O(n)
D)O(n log2 n)

Q.3. Consider a linked list of n elements. What is the time taken to insert an element after an
element pointed by some pointer ? (2M)
A) O(1)
B) O(log2n)
C) O(n)
D) O(n log2 n)

Q.4. A linear collection of data element the linear node is given by means of pointer is called (1M)
A) Linked list
B) Node list
C) Primitive list
D)None of these
Q.5 Given 2 sorted list of size 'm' and 'n' respectively. Number of comparison needed in the worst
case by the merge sort algorithm will be (2M)
A) mn
B) max(m,n)
C) min(m,n)
D) m+n-1

Q.6. Assume ILAST points to the last node in a singly linked list whose top (i.e front)is TOP1.Assume
TOP2 points to the first node in another singly linked list(which resides in the same physical arrays
DATA and LINK).which statement will append list 2 to the end of list 1(i.e make them one linked list
with list 1's elements before list 2 (2M)
A) TOP2:=ILAST;
B) ILAST:=TOP2;
C) LINK[TOP2]:=ILAST;
D) LINK[ILAST]:=TOP 2;

Q.7. Which of the following operations is performed more efficiently by doubly linked list than by
linear linked list? (1M)
A) Deleting a node whose location is given
B) Searching an unsorted list for a given item
C) Inserting anode after the node with a given location
D)Both A& C

Q.8. Consider a linked list implementation of a queue with two pointers: front and rear. The time
needed to insert element in a queue of length n is (1M)
A) O(1)
B) O(log2 n)
C) O(n)
D) None of these

Q.9. The linked list implementation of sparse matrices is superior to the generalized dope vector
method because it is (1M)
A) Conceptually easier and completely dynamic
B) Efficient if the spars matrix is a band matrix
C) Efficient in accessing an entry
D) All of these

Q.10. In a circular linked list organization, insertion of a record involves the modification of (1M)
A) No pointer
B) 4 pointers
C) 2 pointers
D) 3 pointers

Q.11. Which of the following lines of code will delete two successive nodes of a singly linked linear
list (WITH MORE THAN TWO NODES)? Assume this code is in the main program, not a
subprocedure? (2M)
A) LINK[X]:=LINK [LINK[X]];
B) X:=LINK[LINK[X+1]];
C) LINK [LINK[X]]: =X;
D)LINK[X]:=LINK [LINK [LINK[X]]];

Q.12. Given two statements (1M)


(i)Insertion of an element should be done at the last node in a circular list.
(ii)Deletion of an element should be done at the last node of the circular list.
Codes
A) Both are True
B) Both are False
C) First is true and second is false
D) First is false and second is true

Q.13. To insert a node in a circular list at rear position, it should be inserted at _________ of the queue
A) Front position (1M)
B) Front -1 position
C) Rear position
D) Rear +1 position

Q.14. To free which of the following list traversing through the entire list is not necessary. (1M)
A) Priority list
B) Singly linked list
C) Double linked list
D)Both B and C

Q.15. Which of the following statement(s) is/are true regarding insertion of node in a linear linked
list? (1M)
A) Setting the field of the new node means allocating memory to newly created node
B) If node precedes all others in the list, then insert it at the front and return its address
C) Creating a new node depends upon free memory space
D) All of these

Q.16. Which of the following statement(s) are true about a doubly linked list? (1M)
A) It may be either linear or circular
B) It must contain a header node
C) It will occupy same memory space as that of linear list, both having same number of nodes
D) None of these

Q.17. Identify the steps to be taken when a first node is to be deleted from linear linked list. (2M)
I. Set link to start pointer to the second node in the list
II. Free the space associated with the first node.
III.Obtain the address of the second node in the list
IV.Count the number of the nodes in the list.
A) I and II
B) I, II, and III
C) II and III
D)I, II, III, and IV

Q.18. The concatenation of two lists is to be performed in O(1) time. Which of the following (1M)
implementations of a list should be used ?
A) Singly linked list
B) Doubly linked list
C)Circular doubly linked list
D) None of these

Q.19. Consider the following algorithm. (2M)


(i) An empty node is created.
(ii) The node’s information field is initialized to an integer e1.
(iii) The node is being included at the end of the list, and the next field is set to null.
(iv) The node is now included in the list by making the next field of the last node of the list a
reference to the newly created node.
(v) The new node follows all the nodes of the list, but this fact has to be reflected in the value of the
tail, which now becomes the reference to the new node.
Which of the following does the above algorithm describe?
A) The process of adding a new node to the last node of the tree
B) The process of adding a new node to any location of the list
C) The process of adding a new node to the end of the list
D) The process of deleting a node from the end of the list
E) The process of deleting a node from the beginning of the list

Q.20. Consider the following operations. (2M)


(i) Append an element to the end of a list.
(ii) Concatenate two lists.
(iii) Free all the nodes in a list.
(iv)Reverse a list, so that the last element becomes the first and so-on.
(v) Delete the last element from a list.
(vi)Delete the nth element from a list with at least n elements.
(vii) Combine two ordered lists into a single ordered list.
Which of the above are valid operations in singly linked lists?
A) (i), (ii), (iii), (v), (vi) & (vii)
B) (iii), (iv), (v), (vi) & (vii)
C) (i), (ii), (iii), (iv), (vi) & (vii)
D) (i), (ii), (iii), (iv), (v), (vi) & (vii)

Q.21. The header node of a linked list (1M)


A) Simplifies deletion
B) Simplifies insertion
C) Points to null
D) Both (a), (b)

Q.24. Linked lists are not suitable for implementing (1M)


A) insertion sort
B) binary search
C) radix sort
D) polynomial manipulation

Q.25. In Linked list implementation, a node carries information regarding _______. (1M)
A) Link
B) Data
C) Data and Link

Q.26. A linked list in which the last node of Linked list points to the first is called a _________. (1M)
A) Circular Linked List
B) Singly Linked List
C) None of these
D) Doubly Linked List

Q.27. A doubly linked list performs traversal in _________) (1M)


A) Either direction
B) Any direction
C) Circular direction

Q.28. Linked list data structure usage offers considerable saving in (1M)
A) Space utilization & computational time
B) Space utilization
C) Computational time

Q.29. Consider linked list is used to implement the Stack then which of the following node is
considered as Top of the Stack ? (1M)
A) Any Node
B) Middle Node
C) First Node
D) Last Node

Q.30. The link field in the last node of the linked list contains _________. (1M)
A) Pointer to the next element location
B) Link to the first node
C) Zero value

Q. 31. When new element is added in the middle of singly linked list then ________. (1M)
A) No need to move element
B) Only elements that appear after the new element and before need to be moved
C) Only elements that appear after the new element need to be moved
D) Only elements that appear before the new element need to be moved

Q.32. Which of the following operation is performed more efficiently in doubly linked list ? (1M)
A) None of these
B) Searching a node at given position
C) Deleting a node at given position
D) Inserting a node at given position

Q.33. If in a linked list address of first node is 1020 then what will be the address of node at 5th
position ? (1M)
A) 1028
B) 1038
C) None of these
D) 1036

Q.34. In Circular Linked List insertion of a node involves the modification of ____ links. (1M)
A) 3
B) 1
C) 2
D) 4

Q.35. ………………. is not an operation performed on linear list (1M)


a) Insertion b) Deletion c) Retrieval d) Traversal
A) only a,b and c
B) only a and b
C) All of the above
D) None of the above

Q.36. Which of the following statement is true? (1M)


i) Using singly linked lists and circular list, it is not possible to traverse the list backwards.
ii) To find the predecessor, it is required to traverse the list from the first node in case of singly
linked list.
A) i-only
B) ii-only
C) Both i and ii
D) None of both

Q.37. The advantage of …………….. is that they solve the problem if sequential storage (1M)
representation. But disadvantage in that is they are sequential lists.
A) Lists
B) Linked Lists
C) Trees
D) Queues

Q.38. There is an extra element at the head of the list called a ………. (1M)
A) Antinel
B) Sentinel
C) List header
D) List head
Q.39. The situation in linked list START=NULL is called ? (1M)
A) Overflow
B) Underflow
C) Both of above
D) None of Above

Q.40. The operation of processing element is called ? (1M)


A) Traversing
B) Inserting
C) Deleting
D) Searching

Q.41. Linked lists are suitable for which of the following problems? (1M)
A) Insertion sort
B) Binary search
C) Radix sort
D) Polynomial manipulation

Q.42. A linear collection of data elements where the linear node is given by means of pointer is
Called (1M)
A) linked list
B) node list
C) primitive list
D) None of these

Q.43. An ADT is defined to be a mathematical model of a user-defined type along with the (1M)
collection of all ____________ operations on that model.
A) Cardinality
B) Assignment
C) Primitive
D) Structured

Q.44. The pointer, in case of a circular linked list, pointing to the whole list is usually called
the___________. (1M)
A) Double pointer
B) List pointer
C) Circular pointer
D) End pointer

Q.45. Which of the following is two way list? (1M)


A) grounded header list
B) circular header list
C) linked list with header and trailer nodes
D) none of above

Q.46. Suppose cursor points to a node in a linked list (using the node definition with member
functions called data and link). What statement changes cursor so that it points to the next node?
A) cursor++; (1M)
B) cursor = link;
C) cursor += link;
D) cursor = cursor->link;

Q.47. Suppose cursor points to a node in a linked list (using the node definition with member
functions called data and link). What Boolean expression will be true when cursor points to the tail
node of the list? (2M)
A) (cursor == NULL)
B) (cursor->link == NULL)
C) (cursor->data == NULL)
D) (cursor->data == 0.0)
E) None of the above.

Q.48. Suppose that p is a pointer variable that contains the NULL pointer. What happens if your
program tries to read or write *p? (2M)
A) A syntax error always occurs at compilation time.
B) A run-time error always occurs when *p is evaluated.
C) A run-time error always occurs when the program finishes.
D) The results are unpredictable.

Q.49. Suppose that f is a function with a prototype like this: (2M)


void f(________ head_ptr);
// Precondition: head_ptr is a head pointer for a linked list.
// Postcondition: The function f has done some computation with
// the linked list, but the list itself is unchanged.
What is the best data type for head_ptr in this function?
A) node
B) const node
C) node*
D) const node*

Q.50. Suppose that f is a function with a prototype like this: (2M)


void f(________ head_ptr);
// Precondition: head_ptr is a head pointer for a linked list.
// Postcondition: The function f has done some computation with
// the linked list, and the list might now have a new head node.
What is the best data type for head_ptr in this function?
A) node
B) node&
C) node*
D) node*&

Q.51. What kind of list is best to answer questions such as "What is the item at position n?" (1M)
A) Lists implemented with an array.
B)Doubly-linked lists.
C) Singly-linked lists.
D) Doubly-linked or singly-linked lists are equally best

Q.52. Which of the following data structure is not linear data structure? (1M)
A) Arrays
B) Linked lists
C) Both of above
D) None of above

Q.53. Finding the location of the element with a given value is: (1M)
A) Traversal
B) Search
C) Sort
D) None of above

Q.54. Linked lists are best suited (1M)


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

Q.55. A self-referential structure contains a pointer member that points to a structure of the same
structure type. For example, the following definition of structure node. (1M)

struct node {

int data;

struct node *nextPtr;

};
A) True
B) False

Q.56. Function malloc returns a pointer of type void * to the memory it allocates. If it is unable to
allocate memory, it returns a NULL pointer. (1M)
A) True
B) False

Q.57. A linked list is a linear collection of self-referential structures, called nodes, connected by
pointer links—hence, the term "linked" list. (1M)
A) True
B) False

Q.58 In a______________, each node has two links, similarly to doubly-linked list, except that previous
link of the first node points to the last node and the next link of the last node points to the first
node. (1M)
A) Doubly-circularly-linked list
B) Doubly linked list
C) Singly-circularly-linked list
D) Two way linked list

Q.59. Linked list is a sequential collection of data items. (1M)


A) True
B) False

Q.60.The functions used for dynamic memory allocation are: (1M)


A) delete and free
B) free and realloc
C)malloc and free
D) malloc and calloc

Q61.The function used in C to de-allocate a memory block is: (1M)


A) delete
B) free
C) malloc
D) realloc

Q62.A one-way list is called: (1M)


A) circular linked list
B) array
C) queue
D) single linked list

Q63. What operation is supported in constant time by the doubly linked list, but not by the singly
linked list? (1M)
A) Advance
B) Move back
C) First
D) Retrieve
E) All of the above are always constant time

Q64.A ____ pointer can point to any data-type: (1M)


A) NULL pointer
B) void pointer
C) dangling pointer
D) such a pointer does not exist

Q65.A linked list can be represented using two ways which are: (1M)
A) single and double
B) single and circular
C) static and dynamic
D) any of the above

Q66. A linked list is a linear collection of homogeneous elements called: (1M)


A) structures
B) nodes
C) data
D) none of the above

Q67.Insertion in a linked list can be done from: (1M)


A) beginning
B) end
C) middle
D) all of the above
Q68.The traversal directions possible in a double-linked list are: (1M)
a. forward b. backward
c. forward and backward d. right

Q69.A node in a double linked list comprises of: (1M)


A) information field
B) information field and next pointer
C) information field, next pointer , previous pointer
D) information field , previous pointer and thread field

Q70.The situation in which the user tries to delete a node from an empty linked list is called: (1M)
A) empty
B) free
C) overflow
D) underflow

Q.71. In a ______________, each node has one link, similarly to an ordinary singly-linked list, except that
the next link of the last node points back to the first node. (1M)
A) Doubly linked list
B) Singly-circularly-linked list
C) Doubly circular linked list
D) Two way linked list

Q72. The situation in which memory is not available for the allocation of a new node: (1M)
A) empty
B) free
C) overflow
D) underflow

Q73.What is the return value of malloc() function (1M)


A) void pointer
B) integer pointer
C) integer value
D) character pointer

Q74. To traverse a___________, you begin at any node and follow the list in either direction until you
return to the original node. (1M)
A) Doubly linked list
B) Two way linked list
C) Circular linked list
D) Singly linked list

Q.75. Garbage collection is related to memory management. (1M)


A)True
B) False

Q.76. Linear order linked list is provided through _________ (1M)


A) variables
B)arrays
C) Pointer
D) strings

Q.77.In a Single Link List_________ node contains no links. (1M)


A) First
B) Last
C) last but one
D) middle
Q.78. In Single Linked List a node contain minimum how many fields(assuming one for data). (1M)
A) 2
B) 3
C) 1
D) None

Q79 Insertion of a node into a doubly linked list requires how many changes to various Next and
Prev pointers? (1M)
A) No changes
B) 1 Next, 1 Prev
C) 2 Next, 2 Prev
D) 3 Next, 3 Prev
E) None of the above

Q.80. Null pointer is used to tell (1M)


1) End of the linked list
2) Empty pointer field of a structure
3) The linked list is empty
A) 1
B)2 and 3
C)1 and 3
D) All

Q.81.Single link list performs which of the following methods (1M)


1) Insertion
2) Modification
3) Searching
A) 1 and 2
B) 2 and 3
C) 1 and 3
D) All

Q.82.The list with no node is called as (1M)


1) Empty list
2) Null list
3) Zero list
A) 1 and 2
B) 2 and 3
C) 1 and 3
D) All

Q.83. An application that make use of Multilinked Structures Is_________? (1M)


A) Sparse matrix
B) Linked list
C) Tree
D) Stack

Q.84.Given a arbitrary pointer to an element in a singly linked list, the time complexity for its
deletion ___________. (2M)
A) O(n/2)
B) O(n*n)
C) O(n)
D) O(n*n/2)

Q.85.In C language to implement the heterogeneous linked list__________ pointer is used. (1M)
A) Void
B) Null
C) Int
D) Structure

Q.86. Searching a linked list requires linked list be created (1M)


A) In sorted order only
B) In any order
C) Without under flow condition
D) None
Q.87.In linked list the logical order of elements – (1M)
A) Is same as their physical arrangement
B) Is not necessarily equivalent to their physical arrangement
C) Is determined by their logical arrangement
D) None

Q.88. Implementation of a list in a dynamic fashion is (1M)


A) To call upon the system to allocate and free storage may not be time consuming
B) A set of nodes not reserved in advance for use
C) The address computation is complex
D) None

Q.89.If you are using C language to implement a heterogeneous linked list, the pointer type u will
prefer is ________ (1M)
A) int*
B)Null
C) void*
D) float*

Q.90. Which of the following statement is true (1M)


A) The next address field of the node can be empty
B) A list can exist with no nodes
C) In a singly linked list the starting address of the list is stored in the address field of the last node
D)All of the above

Q.91. Type of storage is used to represent Lists (1M)


A) Random
B) Sequential
C) Dynamic
D) Logical

Q.92. The node in a singly linked list can be deleted, (1M)


A) Without traversing the list
B) By traversing the list from the head
C) By traversing the list from the tail
D)All of the above

Q.93. Which of the following operations is not efficiently supported by a singly-linked list? (1M)
A) accessing the element in the current position
B) insertion after the current position
C) insertion before the current position
D)moving to the position immediately following the current position
Q.94. What is an ordered list (1M)
A) where the address is ordered
B) where the smaller items precede the larger ones
C) both a and b
D) none

Q.96. According to Access strategies Linked list is a (1M)


A) Nonlinear
B) Linear
C) Sequential
D)dynamic

Q.97. How many nodes are accessed, on the average, in inserting a new element into an ordered list
with n nodes (1M)
A) (n+1)/2
B) n/2
C) 1/(n+1)
D) None

Q.98. The advantage of lists over an array for implementing a priority queue is (1M)
A) Extra space should be left empty in the end to achieve this
B) Lists will take less time compared to arrays
C) No shifting of elements or gaps are necessary in a list
D) Lists don’t have direct access

Q.99. An extra node at the front of the list, which does not represent an item in the list is Called
(1M)
A) header node
B) List node
C) List header
D) Both a and c

Q.100. A __________is a self-referential data type because it contains a pointer or link to another data
of the same type. (1M)
A) Stack
B) Linked list
C) Queue
D) Priority queue

You might also like