Quiznetik

Data Structure and Algorithms (DSA) | Set 3

1. _______ refers to situation where one wants to delete data form a data structure that is empty.

Correct : B. underflow

2. ________ is an organization that provides faster request and return time response.

Correct : C. buddy system

3. _______ attacks the problem of fragmentation by moving all the allocated blocks to one end of memory, thus combining all the holes.

Correct : B. garbage compaction

4. A _______ list structure can be traversed in two directions-- in the forward direction from beginning of the list to end, or in the backward direction, from the end of the list to the beginning.

Correct : C. two way

5. _________ header list combines the advantages of a two-way list and a circular header list.

Correct : B. two way circular

6. In linked list,a node contain

Correct : C. next adress field and information field

7. In linked list,the logical order of elements

Correct : B. is not necessarily equivalent to their physical arrangement

8. Null pointer is used to tell

Correct : D. all of the above

9. List pointer variable in linked list contains address of the

Correct : C. first node in the first

10. Because of linear structure of linked list having linear ordering,there is similarity between linked list and array in

Correct : C. traversal of elements of list

11. Searching of linked list requires linked list to be created

Correct : B. in any order

12. A circular list can be used to represent

Correct : D. both a and b

13. To insert a node in a circular list at rear end it should be inserted at …...of the queue

Correct : C. rear position

14. In a circularly linked list organisation ,insertion of a record involves the modifications of

Correct : B. 1 pointer

15. What is true about linked kist?

Correct : A. it is a linked structure,where each data gives the address of the next data

16. A node of linked list contains_______

Correct : C. both (a)and(b)

17. Which nodes contains a null pointer in a linked list?

Correct : C. last node

18. Deletion of a node from an empty linked list will cause________

Correct : A. underflow

19. Insertion in a linked list requires modification of____pointers

Correct : B. 2

20. Deletion in a linked list requeries modification of______pointers

Correct : A. 1

21. Accessing time of nth node in a linked list is______

Correct : A. 0(n)

22. An array is referenced by its name.Similarly,a linked list is referenced by____

Correct : A. address of the first node

23. Time required to search an element in a linked list is____

Correct : A. 0(n)

24. Time required to search an element in a sorted linked list is______

Correct : A. 0(n)

25. Time required to delete a node with given address in a linked list is____

Correct : A. 0(n)

26. Select the set of instructions to insert a node pointed by q after a node pointed by p

Correct : A. q->next=p->next; p->next=q;

27. select the set of operations to insert a node pointed by q at the beginning of the linked list

Correct : A. q->next=head; head=q;

28. Select the set of operations to delete the first node from a linked list

Correct : A. p=head;head=head->next;free(p);

29. Select the correct looping condition for positioning apointer p on the second last in a linked list.Assume p=head,initially.

Correct : A. p->next->next!=null

30. If address of the 8th element in a linked list of integers is1022,then address of the 9th element is

Correct : D. unknown

31. The advantages of linked list over an array for representing a list is________

Correct : D. both (a) and (b)

32. The address returned by malloc()is type casted because

Correct : B. malloc returns void pointer

33. Which function returns a void pointers?

Correct : C. both (a)and(b)

34. Select the correct statement

Correct : C. both (a)and(b)

35. The____linked list can be processed in either direction.

Correct : C. doublyly

36. A polynominal in single variable should be handled using__

Correct : D. both (a) and (b)

37. A node of doubly linked contains

Correct : C. both (a)and(b)

38. Each node in a linear list contains an item called____which points to the next node in the list.

Correct : B. link

39. Which is not dynamic memory allocation function?

Correct : C. alloc

40. The function that allocates requested size of bytes and returns a pointer to the first byte of the allocated space is

Correct : B. malloc

41. NULL link is not present in…

Correct : C. circular linked list

42. In a circular linked list

Correct : B. there is no beginning and no end.

43. A linear collection of data elements where the linear node is given by means of pointer is called?

Correct : A. linked list

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

Correct : A. deleting a node whose location in given

45. Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked lis

Correct : C. i,ii and iii

46. Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list

Correct : B. i and iii

47. Consider an implementation of unsorted doubly linked list. Suppose it has its representation with a head pointer and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the end node of the linked list

Correct : D. i,ii,iii and iv

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

Correct : C. pointer to node

49. What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?

Correct : C. θ (n)

50. What would be the asymptotic time complexity to add an element in the linked list?

Correct : B. o(n)

51. What would be the asymptotic time complexity to find an element in the linked list?

Correct : B. o(n)

52. What would be the asymptotic time complexity to insert an element at the second position in the linked list?

Correct : A. o(1)

53. The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?

Correct : C. circular doubly linked list

54. 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?

Correct : A. ptr=(node*)malloc(sizeof(node));

55. A variant of linked list in which last node of the list points to the first node of the list is?

Correct : C. circular linked list

56. In doubly linked lists, traversal can be performed?

Correct : C. in both directions

57. What kind of linked list is best to answer question like “What is the item at position n?”

Correct : D. array implementation of linked list

58. A variation of linked list is circular linked list, in which the last node in the list points to first node of the list. One problem with this type of list is?

Correct : C. it is difficult to traverse the list as the pointer of the last node is now not null

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

Correct : C. circular linked list

60. In circular linked list, insertion of node requires modification of?

Correct : B. two pointer

61. Which of the following statements about linked list data structure is/are TRUE?

Correct : B. the linked list pointers do not provide an efficient way to search an item in the linked list

62. Linked lists are not suitable to for the implementation of?

Correct : D. binary search

63. In worst case, the number of comparison need to search a singly linked list of length n for a given element is

Correct : D. n

64. consider the function f defined here: struct item { int data; struct item * next; }; int f (struct item *p) { return((p==NULL) ||((p->next==NULL)||(p->data<=p->next->data) && (p->next))); } For a given linked list p, the function f returns 1 if and only if

Correct : B. the element in the list are sorted in non-decreasing order of data value

65. Finite sequence S of Zero or more chatacters is called_____

Correct : C. string

66. String with zero characters is called____string

Correct : A. null

67. Groups of consecutive element in a string.Such as words,phrase and sentences are called___

Correct : B. substring

68. _____operation of word processing invovles replacing one string in the text by another.

Correct : D. replacement

69. _____is the problem of deciding whether or not a given string problem p appears in a text T.

Correct : A. pattern matching

70. If string1=john,and string2=Rivers are merged,the process is called

Correct : C. concatenation

71. ____is a variable whose length may vary during the execution of a program.

Correct : A. dynamic

72. NurseryLand.Nursery.Students = 10;

Correct : C. the structure nursery is nested within the structure nurseryland.

73. If a function is declared as void fn(int *p), then which of the following statements is valid to call function fn?

Correct : B. fn(x) where x is defined as int *x;

74. To declare an array S that holds a 5-character string, you would write

Correct : A. char s[5]

75. The constructed datatype in C is known as

Correct : C. structure

76. A structure definition is called as

Correct : A. template

77. If a, b and c are integer variables with the values a=8, b=3 and c=-5. Then what is the value of the arithmetic expression: 2 * b + 3 * (a-c)

Correct : A. 15

78. A global variable is a variable

Correct : C. declared outside the body of every function.

79. main ( ) is an example of

Correct : A. library function

80. While incrementing a pointer, its value gets increased by the length of the data type to which it points. This length is called

Correct : A. scale factor

81. a->b is systematically correct if_____

Correct : A. a is a npointer to a structure in which b is a field

82. Which of the following best describes sorting ?

Correct : C. arranging the data (record) in some given order

83. A function which calls itself is called as

Correct : C. recursive function

84. Where do we use the operator -> ?

Correct : D. both(a) and(b).

85. In selection sort of n elements,how many times is the swap function called in the complete execution of the algorithm?

Correct : B. n-1

86. a->b is systematically correct if_____

Correct : A. a is a pointer to a structure in which b is a field

87. Literal means

Correct : B. string constant

88. Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called

Correct : D. All of above

89. Which of the following statement is false ?

Correct : C. Pointers store the next data element of a list

90. Binary search algorithm cannot be applied to

Correct : D. Sorted linked list

91. When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

Correct : D. Overflow

92. The situation when in a linked list START=NULL is

Correct : A. Underflow

93. The following is two-way list

Correct : D. None of above

94. The following name does not relate to stacks

Correct : A. FIFO lists

95. In a binary tree, certain null entries are re- placed by special pointers which point to nodes higher in tree for efficiency. These special pointers are called

Correct : D. Thread

96. In a graph if e=(u, v) means

Correct : C. both B and C are true

97. If every node u in G is adjacent to every other node v in G, A graph is said to be

Correct : B. Complete

98. A variable P is called pointer if

Correct : D. P contains the address of an element in DATA.

99. The Worst case occur in linear search algo- rithm when

Correct : C. Item is the last element in the array or is not there at all

100. The Average case occur in linear search al- gorithm

Correct : A. When Item is somewhere in the middle of the array