0% found this document useful (0 votes)
13 views

Data-Structure-And-Algorithms (Set 3)

dsa mcq

Uploaded by

Surya A
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Data-Structure-And-Algorithms (Set 3)

dsa mcq

Uploaded by

Surya A
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Data Structure and Algorithms (DSA)

3 of 4 sets

201. _______ refers to situation where one wants to delete data form a data
structure that is empty.
A. free storage
B. underflow
C. overflow
D. compaction
Answer:B

202. ________ is an organization that provides faster request and return time
response.
o m
A. stack
. c
B. queue
te
C. buddy system
a
D. recursion

q M
Answer:C
c
M of fragmentation by moving all the allocated
203. _______ attacks the problem
blocks to one end of memory, thus combining all the holes.
A. garbage collection
B. garbage compaction
C. buddy system
D. queue
Answer:B

204. 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.
A. one way
B. linear array
C. two way
D. header
Answer:C

205. _________ header list combines the advantages of a two-way list and a
circular header list.
A. one way
B. two way circular
C. two way
D. header
Answer:B

206. In linked list,a node contain


A. node,adrees field and data field
B. node number and data field
C. next adress field and information field
D. none of the above
Answer:C

207. In linked list,the logical order of elements


A. is same as their physical arrangement
B. is not necessarily equivalent to their physical arrangement
C. is determined by their physical arrangement
D. none of the above
Answer:B

208. Null pointer is used to tell


A. end of linked list
B. empty pointer field of a structure
C. the linked list is empty
D. all of the above
Answer:D

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


A. following node in the first
B. current node in the first
C. first node in the first
D. none of the above

View all MCQ's at McqMate.com


Answer:C

210. Because of linear structure of linked list having linear ordering,there is


similarity between linked list and array in
A. insertion of a node
B. deletion of a node
C. traversal of elements of list
D. none of the above
Answer:C

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


A. in stored order only
B. in any order
C. without underflow condition
D. none of the above
Answer:B

212. A circular list can be used to represent


A. a stack
B. a queue
C. a tree
D. both a and b
Answer:D

213. To insert a node in a circular list at rear end it should be inserted at …...of the
queue
A. front position
B. front-1position
C. rear position
D. rear-1 position
Answer:C

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


modifications of
A. no pointer
B. 1 pointer

View all MCQ's at McqMate.com


C. 2 pointer
D. 3 pointer
Answer:B

215. What is true about linked kist?


A. it is a linked structure,where each data gives the address of the next data
B. it is a dynamic data structure
C. it is a static data structure
D. both (a) and (b)
Answer:A

216. A node of linked list contains_______


A. data field
B. a self referential pointer
C. both (a)and(b)
D. only b
Answer:C

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


A. first node
B. middle node
C. last node
D. both (a) and (b)
Answer:C

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


A. underflow
B. overflow
C. run time error
D. all of the above
Answer:A

219. Insertion in a linked list requires modification of____pointers


A. 1
B. 2

View all MCQ's at McqMate.com


C. 3
D. 4
Answer:B

220. Deletion in a linked list requeries modification of______pointers


A. 1
B. 2
C. 3
D. 4
Answer:A

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


A. 0(n)
B. 0(1)
C. 0(n2)
D. 0(log n)
Answer:A

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


A. address of the first node
B. address of the last node
C. both (a)and(b)
D. none of these
Answer:A

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


A. 0(n)
B. 0(log n)
C. 0(n2)
D. 0(n log n)
Answer:A

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


A. 0(n)
B. 0(log n)

View all MCQ's at McqMate.com


C. o(n2)
D. 0(n log n)
Answer:A

225. Time required to delete a node with given address in a linked list is____
A. 0(n)
B. 0(log n)
C. 0(1)
D. 0(n log n)
Answer:A

226. Select the set of instructions to insert a node pointed by q after a node pointed
by p
A. q->next=p->next; p->next=q;
B. p->next=q; q->next=p->next
C. both (a)and(b)
D. none of these
Answer:A

227. select the set of operations to insert a node pointed by q at the beginning of the
linked list
A. q->next=head; head=q;
B. head=q;q ->next=head;
C. both (a)and(b)
D. none of these
Answer:A

228. Select the set of operations to delete the first node from a linked list
A. p=head;head=head->next;free(p);
B. free(head)
C. head=head->next;p=head;free(p)
D. none of these
Answer:A

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

View all MCQ's at McqMate.com


A. p->next->next!=null
B. p->next=null
C. p!=null
D. none of these
Answer:A

230. If address of the 8th element in a linked list of integers is1022,then address of
the 9th element is
A. 1024
B. 1026
C. 1023
D. unknown
Answer:D

231. The advantages of linked list over an array for representing a list is________
A. space used is less
B. deletion is easier
C. insertion is easier
D. both (a) and (b)
Answer:D

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


A. malloc returns integers pointer
B. malloc returns void pointer
C. malloc returns an integer value
D. none of these
Answer:B

233. Which function returns a void pointers?


A. malloc returns integers pointer
B. calloc
C. both (a)and(b)
D. none of these
Answer:C

234. Select the correct statement

View all MCQ's at McqMate.com


A. free is used to release memory allocated by malloc
B. free is used to release memory allocated by calloc
C. both (a)and(b)
D. only(a)but not(b)
Answer:C

235. The____linked list can be processed in either direction.


A. singly
B. singly circular
C. doublyly
D. none of these
Answer:C

236. A polynominal in single variable should be handled using__


A. an array of structure
B. singly linked list
C. gll
D. both (a) and (b)
Answer:D

237. A node of doubly linked contains


A. pointer to predecessor
B. pointer to sucessor
C. both (a)and(b)
D. only(a)
Answer:C

238. Each node in a linear list contains an item called____which points to the next
node in the list.
A. node
B. link
C. variable
D. null
Answer:B

239. Which is not dynamic memory allocation function?

View all MCQ's at McqMate.com


A. malloc returns integers pointer
B. calloc
C. alloc
D. free
Answer:C

240. The function that allocates requested size of bytes and returns a pointer to the
first byte of the allocated space is
A. realloc
B. malloc
C. free
D. none of these
Answer:B

241. NULL link is not present in…


A. singly linked list
B. doubly linked list
C. circular linked list
D. none of these
Answer:C

242. In a circular linked list


A. components are all linked together in some sequential manner.
B. there is no beginning and no end.
C. components are arranged hierarchically.
D. forward and backward traversal within the list is permitted.
Answer:B

243. A linear collection of data elements where the linear node is given by means of
pointer is called?
A. linked list
B. node list
C. primitive list
D. none
Answer:A

View all MCQ's at McqMate.com


244. 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
Answer:A

245. 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
A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii and iv
Answer:C

246. 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
A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii and iv
Answer:B

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

View all MCQ's at McqMate.com


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
A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii,iii and iv
Answer:D

248. 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
Answer:C

249. 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?
A. o(1)
B. o(n)
C. ? (n)
D. ? (1)
Answer:C

250. What would be the asymptotic time complexity to add an element in the linked
list?
A. o(1)
B. o(n)
C. o(n2)
D. none
Answer:B

251. What would be the asymptotic time complexity to find an element in the
linked list?
A. o(1)

View all MCQ's at McqMate.com


B. o(n)
C. o(n2)
D. none
Answer:B

252. What would be the asymptotic time complexity to insert an element at the
second position in the linked list?
A. o(1)
B. o(n)
C. o(n2)
D. none
Answer:A

253. The concatenation of two list can performed in O(1) time. Which of the
following variation of linked list can be used?
A. singly linked list
B. doubly linked list
C. circular doubly linked list
D. array implementation of list
Answer:C

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


A. ptr=(node*)malloc(sizeof(node));
B. ptr=(node*)malloc(node);
C. ptr=(node*)malloc(sizeof(node*));
D. ptr=(node)malloc(sizeof(node));
Answer:A

View all MCQ's at McqMate.com


255. A variant of linked list in which last node of the list points to the first node of
the list is?
A. singly linked list
B. doubly linked list
C. circular linked list
D. multiply linked list
Answer:C

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


A. only in forward direction
B. only in reverse direction
C. in both directions
D. none
Answer:C

257. What kind of linked list is best to answer question like “What is the item at
position n?”
A. singly linked list
B. doubly linked list
C. circular linked list
D. array implementation of linked list
Answer:D

258. 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?
A. it waste memory space since the pointer head already points to the first node and thus the list
node does not need to point to the first node.
B. it is not possible to add a node at the end of the list.
C. it is difficult to traverse the list as the pointer of the last node is now not null
D. all of above
Answer:C

259. A variant of the linked list in which none of the node contains NULL pointer
is?
A. singly linked list
B. doubly linked list

View all MCQ's at McqMate.com


C. circular linked list
D. none
Answer:C

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


A. one pointer
B. two pointer
C. three pointer
D. none
Answer:B

261. Which of the following statements about linked list data structure is/are
TRUE?
A. addition and deletion of an item to/ from the linked list require modification of the existing
pointers
B. the linked list pointers do not provide an efficient way to search an item in the linked list
C. linked list pointers always maintain the list in ascending order
D. the linked list data structure provides an efficient way to find kth element in the list
Answer:B

262. Linked lists are not suitable to for the implementation of?
A. insertion sort
B. radix sort
C. polynomial manipulation
D. binary search
Answer:D

263. In worst case, the number of comparison need to search a singly linked list of
length n for a given element is
A. log n
B. n/2
C. log2n-1
D. n
Answer:D

View all MCQ's at McqMate.com


264. 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


A. the list is empty or has exactly one element
B. the element in the list are sorted in non-decreasing order of data value
C. the element in the list are sorted in non-increasing order of data value
D. not all element in the list have the same data value
Answer:B

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


A. array
B. list
C. string
D. block
Answer:C

266. String with zero characters is called____string


A. null
B. binary
C. totalled
D. list
Answer:A

267. Groups of consecutive element in a string.Such as words,phrase and sentences


are called___
A. main string
B. substring

View all MCQ's at McqMate.com


C. index
D. block
Answer:B

268. _____operation of word processing invovles replacing one string in the text by
another.
A. insertion
B. deletion is easier
C. searching
D. replacement
Answer:D

269. _____is the problem of deciding whether or not a given string problem p
appears in a text T.
A. pattern matching
B. searching
C. sorting
D. deletion
Answer:A

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


A. insertion
B. deletion
C. concatenation
D. replacement
Answer:C

271. ____is a variable whose length may vary during the execution of a program.
A. dynamic
B. static
C. semistatistic
D. global
Answer:A

272. NurseryLand.Nursery.Students = 10;


A. the structure students is nested within the structure nursery

View all MCQ's at McqMate.com


B. the structure nurseryland is nested within the structure nursery.
C. the structure nursery is nested within the structure nurseryland.
D. the structure nursery is nested within the structure students
Answer:C

273. If a function is declared as void fn(int *p), then which of the following
statements is valid to call function fn?
A. fn(x) where x is defined as int x;
B. fn(x) where x is defined as int *x;
C. fn(&x) where x is defined as int *x;
D. fn(*x) where x is defined as int *x;
Answer:B

274. To declare an array S that holds a 5-character string, you would write
A. char s[5]
B. char s[6]
C. string s[5]
D. stringchar s[5]
Answer:A

275. The constructed datatype in C is known as


A. string
B. array
C. structure
D. pointer
Answer:C

276. A structure definition is called as


A. template
B. member
C. both 1 & 2
D. none of these
Answer:A

277. 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)

View all MCQ's at McqMate.com


A. 15
B. 6
C. -16
D. -1
Answer:A

278. A global variable is a variable


A. declared in the main ( ) function
B. declared in any function other than the main ( ) function
C. declared outside the body of every function.
D. declared any where in the c program.
Answer:C

279. main ( ) is an example of


A. library function
B. user defined function
C. header
D. statement
Answer:A

280. While incrementing a pointer, its value gets increased by the length of the data
type to which it points. This length is called
A. scale factor
B. length factor
C. pointer factor
D. increment factor
Answer:A

281. a->b is systematically correct if_____


A. a is a npointer to a structure in which b is a field
B. a and b are structure
C. a is a structure and b is a pointer to a structure
D. a is a pointer to a structure and b is a structure
Answer:A

282. Which of the following best describes sorting ?

View all MCQ's at McqMate.com


A. accessing and processing each record exactly once
B. finding the location of the record with a given key
C. arranging the data (record) in some given order
D. adding a new record to the data structure
Answer:C

283. A function which calls itself is called as


A. library function
B. directive
C. recursive function
D. none of above
Answer:C

284. Where do we use the operator -> ?


A. to access a member of structure
B. to access member of union
C. to access an array
D. both(a) and(b).
Answer:D

285. In selection sort of n elements,how many times is the swap function called in
the complete execution of the algorithm?
A. 1
B. n-1
C. n(n-1)/2
D. none of these
Answer:B

286. a->b is systematically correct if_____


A. a is a pointer to a structure in which b is a field
B. a and b are structure
C. a is a structure and b is a pointer to a structure
D. a is a pointer to a structure and b is a structure
Answer:A

287. Literal means

View all MCQ's at McqMate.com


A. string
B. string constant
C. character
D. alphabet
Answer:B

288. Each data item in a record may be a group item composed of sub-items; those
items which are indecomposable are called
A. Elementary items
B. Atoms
C. Scalars
D. All of above
Answer:D

289. Which of the following statement is false ?


A. Arrays are dense lists and static data structure
B. Data elements in linked list need not be stored in adjacent space in memory
C. Pointers store the next data element of a list
D. Linked lists are collection of the nodes that contain information part and next pointer
Answer:C

290. Binary search algorithm cannot be applied to


A. Sorted binary trees
B. Sorted linear array
C. Pointer array
D. Sorted linked list
Answer:D

291. When new data are to be inserted into a data structure, but there is no
available space; this situation is usually called
A. Housefull
B. Saturated
C. Underflow
D. Overflow
Answer:D

View all MCQ's at McqMate.com


292. The situation when in a linked list START=NULL is
A. Underflow
B. Overflow
C. Housefull
D. Saturated
Answer:A

293. The following is two-way list


A. Grounded header list
B. Circular header list
C. Linked list with header and trailer nodes
D. None of above
Answer:D

294. The following name does not relate to stacks


A. FIFO lists
B. LIFO list
C. Piles
D. Push-down lists
Answer:A

295. 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
A. Leaf
B. Branch
C. Path
D. Thread
Answer:D

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


A. e begins at u and ends at v
B. u is processor and v is successor
C. both B and C are true
D. none is true
Answer:C

View all MCQ's at McqMate.com


297. If every node u in G is adjacent to every other node v in G, A graph is said to
be
A. Isolated
B. Complete
C. Finite
D. Strongly connected
Answer:B

298. A variable P is called pointer if


A. P points to the address of first element in DATA
B. P can store only memory addresses
C. P contain the DATA and the address of DATA
D. P contains the address of an element in DATA.
Answer:D

299. The Worst case occur in linear search algo- rithm when
A. Item is not in the array at all
B. Item is the last element in the array
C. Item is the last element in the array or is not there at all
D. None of above
Answer:C

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


A. When Item is somewhere in the middle of the array
B. When Item is not in the array at all
C. When Item is the last element in the ar- ray
D. All the above
Answer:A

View all MCQ's at McqMate.com

You might also like