273
94.3k

340+ Data Structure and Algorithms (DSA) Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Electronics and Communication Engineering , Common Topics in Competitive and Entrance exams .

251.

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

A. o(1)
B. o(n)
C. o(n2)
D. none
Answer» B. o(n)
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. o(1)
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. circular doubly linked list
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. ptr=(node*)malloc(sizeof(node));
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. circular linked list
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. in both directions
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. array implementation of linked list
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. it is difficult to traverse the list as the pointer of the last node is now not null
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
C. circular linked list
D. none
Answer» C. circular linked list
260.

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

A. one pointer
B. two pointer
C. three pointer
D. none
Answer» B. two pointer
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. the linked list pointers do not provide an efficient way to search an item in the linked list
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. binary search
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. n
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. the element in the list are sorted in non-decreasing order of data value
265.

Finite sequence S of Zero or more chatacters is called_____

A. array
B. list
C. string
D. block
Answer» C. string
266.

String with zero characters is called____string

A. null
B. binary
C. totalled
D. list
Answer» A. null
267.

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

A. main string
B. substring
C. index
D. block
Answer» B. substring
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. replacement
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. pattern matching
270.

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

A. insertion
B. deletion
C. concatenation
D. replacement
Answer» C. concatenation
271.

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

A. dynamic
B. static
C. semistatistic
D. global
Answer» A. dynamic
272.

NurseryLand.Nursery.Students = 10;

A. the structure students is nested within the structure nursery
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. the structure nursery is nested within the structure nurseryland.
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. fn(x) where x is defined as int *x;
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. char s[5]
275.

The constructed datatype in C is known as

A. string
B. array
C. structure
D. pointer
Answer» C. structure
276.

A structure definition is called as

A. template
B. member
C. both 1 & 2
D. none of these
Answer» A. template
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)

A. 15
B. 6
C. -16
D. -1
Answer» A. 15
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. declared outside the body of every function.
279.

main ( ) is an example of

A. library function
B. user defined function
C. header
D. statement
Answer» A. library function
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. scale factor
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. a is a npointer to a structure in which b is a field
282.

Which of the following best describes sorting ?

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. arranging the data (record) in some given order
283.

A function which calls itself is called as

A. library function
B. directive
C. recursive function
D. none of above
Answer» C. recursive function
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. both(a) and(b).
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. n-1
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. a is a pointer to a structure in which b is a field
287.

Literal means

A. string
B. string constant
C. character
D. alphabet
Answer» B. string constant
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. All of above
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. Pointers store the next data element of a list
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. Sorted linked list
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. Overflow
292.

The situation when in a linked list START=NULL is

A. Underflow
B. Overflow
C. Housefull
D. Saturated
Answer» A. Underflow
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. None of above
294.

The following name does not relate to stacks

A. FIFO lists
B. LIFO list
C. Piles
D. Push-down lists
Answer» A. FIFO lists
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. Thread
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. both B and C are true
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. Complete
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. P contains the address of an element in DATA.
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. Item is the last element in the array or is not there at all
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. When Item is somewhere in the middle of the array

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.