0% found this document useful (0 votes)
16 views11 pages

MCQ Final Upload

The document contains a series of questions and answers related to data structures, specifically focusing on sorting algorithms, search algorithms, stacks, queues, and their implementations. Key topics include insertion sort, linear search disadvantages, stack operations, and queue principles. Each question is followed by the correct answer, providing a comprehensive overview of fundamental data structure concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

MCQ Final Upload

The document contains a series of questions and answers related to data structures, specifically focusing on sorting algorithms, search algorithms, stacks, queues, and their implementations. Key topics include insertion sort, linear search disadvantages, stack operations, and queue principles. Each question is followed by the correct answer, providing a comprehensive overview of fundamental data structure concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

1. Which of the following real time examples is based on insertion sort?

a. Arranging a pack of playing cards


b. Database scenarios and distributes scenarios
c. Arranging books on a library shelf
d. Real-time systems

Ans: a
2. Which of the following is a disadvantage of linear search?
a. Requires more space
b. Requires more time for searching
c. Not easy to understand
d. Not easy to implement
Ans: b
3. The array is as follows: 11,2,30,65,80,100. Given that the number 23 is
to be searched. After how many iterations it tells that there is no such
element?
a. 7
b. 9
c. 20
d. 5
Ans:d
4. A linear search algorithm is also known as a __________.
a. Binary search algorithm
b. Bubble sort algorithm
c. Sequential search algorithm
d. Radix search algorithm
Ans:c
5. What will happen in a Linear search algorithm if no match is found?
a. It continues to search in a never-ending loop.
b. "Item not found" is returned
c. Compile-time error
d. Run-time error
Ans:b
6. What does ‘stack underflow’ refers to?
a. Accessing item from an undefined stack
b. Adding items to a full stack
c. Removing items from an empty stack
d. Index out of bounds exception
Ans:c
7. Array implementation of Stack is not dynamic, which of the following
statements supports this argument?
a. User unable to give the input for stack operations
b. Space allocation for array is fixed and cannot be changed during
run-time
c. Runtime exception halts execution
d. Improper program compilation
Ans:b
8. Which of the following array element will return the top of the stack
element for a stack of size n elements?
a. S[n-1]
b. S[n]
c. S[n-2]
d. S[n+1]
Ans:a
9. Which one of the following is the process of inserting an element in the
stack?
a. Insert
b. Add
c. Push
d. Pop
Ans:c
10. What is the meaning of Top == -1?
a. Stack is empty
b. Overflow condition
c. Underflow condition
d. Stack is full
Ans:a
11. If the size of the stack is 8 and we try to add the 9th element in the stack
then the condition is known as __________.
a. Underflow
b. Garbage collection
c. Overflow
d. Empty
Ans:c
12. If the elements '10', '20', '30' and '40' are added in a stack, so what
would be the order for the removal?
a. 10, 20, 30, 40
b. 20, 10, 30, 40
c. 40, 30, 20, 10
d. 30, 10, 20, 40
Ans:c
13. Stack can be implemented using _________ and _________?
a. Array and Binary Tree
b. Linked List and Graph
c. Array and Linked List
d. Queue and Linked List
Ans:c
14. TOP == NULL represents:
a. Stack is full
b. Stack is empty
c. Overflow condition
d. Underflow condition
Ans:b
15. Statement top = temp->next does what in the Linked List?
a. Make the next node as top
b. Make the current node as top
c. Make the predecessor node as top
d. Pop one element form the linked list
Ans:a
16. A linear collection of data elements where the linear node is given
by means of a pointer is called?
a. linked list
b. node list
c. primitive list
d. Non primitive list
Ans:

17. While evaluating a postfix expression, when an operator is encountered,


what is the correct operation to be performed?
a. Push it directly on to the stack
b. Pop 2 operands, evaluate them and push the result on to the
stack
c. Pop the entire stack
d. Ignore the operator
Ans:b
18. What is the result of the following postfix expression?
ab*cd*+ where a=2, b=2,c=3,d=4.
a. 16
b. 12
c. 14
d. 10
Ans:a
19. What is the other name for a postfix expression?
a. Normal polish Notation
b. Reverse polish Notation
c. Warsaw notation
d. Infix notation
Ans:b
20. Data Structure required to evaluate postfix expression is __________.
a. Heap
b. Stack
c. Pointer
d. Queue
Ans:b
21. What is the term for inserting into a full queue known as?
a. overflow
b. underflow
c. null pointer exception
d. program won’t be compiled
Ans:a
22. What is the need for a circular queue?
a. effective usage of memory
b. easier computations
c. to delete elements based on priority
d. implement LIFO principle in queues
Ans:a
23. What is a dequeue?
a. A queue with insert/delete defined for both front and rear ends of the queue
b. A queue implemented with a doubly linked list
c. A queue implemented with both singly and doubly linked lists
d. A queue with insert/delete defined for front side of the queue
Ans:a

24. How can we describe an array in the best possible way?

a. The Array shows a hierarchical structure.


b. Arrays are immutable.
c. Container that stores the elements of similar types
d. The Array is not a data structure

Ans:c

25. How can we initialize an array in C language?

a. int arr[2]=(10, 20)

a. int arr(2)={10, 20}


b. int arr[2] = {10, 20}
c. int arr(2) = (10, 20)

Ans:b

26. Which of the following highly uses the concept of an array?

a. Binary Search tree


b. Caching
c. Spatial locality
d. Scheduling of Processes

Ans:b

27. Which of the following is the disadvantage of the array?

a. Stack and Queue data structures can be implemented through an array.


b. Index of the first element in an array can be negative
c. Wastage of memory if the elements inserted in an array are lesser than the allocated
Size
d. Elements can be accessed sequentially.
Ans:c

28. What is the output of the below code?

#include <stdio.h>
int main()
{
int arr[5]={10,20,30,40,50};
printf("%d", arr[5]);
return 0;
}
a. Garbage value
b. 10
c. 50
d. 40

Ans:a

29) Which one of the following is the size of int arr[9] assuming that int is of 4 bytes?

a. 9
b. 36
c. 35
d. 40

Ans:b

30) Which one of the following is the process of inserting an element in the stack?

a. Insert
b. Add
c. Push
d. Pop

Ans:c

31) When the user tries to delete the element from the empty stack then the condition is said to be a

____

a. Underflow
b. Garbage collection
c. Overflow
d. Stackfull

Ans:a

32) If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is

known as___

a. Underflow
b. Garbage collection
c. Overflow
d. Empty

Ans:c

33) Which one of the following is not the application of the stack data structure

a. String reversal
b. Recursion
c. Backtracking
d. Asynchronous data transfer

Ans:d

34) Which data structure is mainly used for implementing the recursive algorithm?

a. Queue
b. Stack
c. Binary tree
d. Linked list

Ans:b

35) Which data structure is required to convert the infix to prefix notation?

a. Stack
b. Linked list
c. Binary tree
d. Queue

Ans:a

36) Which of the following is the infix expression?

a. A+B*C
b. +A*BC
c. ABC+*
d. WER+/BH*%

Ans:a

37) Which of the following is the prefix form of A+B*C?

a. A+(BC*)
b. +AB*C
c. ABC+*
d. +A*BC

Ans:b

38) Which of the following is not the correct statement for a stack data structure?

a. Arrays can be used to implement the stack


b. Stack follows FIFO
c. Elements are stored in a sequential manner
d. Top of the stack contains the last inserted element

Ans:b

39) If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the
removal?

a. 1234
b. 2134
c. 4321
d. 4312

Ans:c

40) What is the outcome of the prefix expression +, -, *, 3, 2, /, 8, 4, 1?

a. 12
b. 11
c. 5
d. 4

Ans:b

41) The minimum number of stacks required to implement a stack is __

a. 1
b. 3
c. 2
d. 5

Ans:a

42) Which one of the following node is considered the top of the stack if the stack is implemented
using the linked list?

a. First node
b. Second node
c. Last node
d. Middle node

Ans:a

43) Consider the following stack implemented using stack.

#define SIZE 11
struct STACK
{
int arr[SIZE];
int top=-1;
}

What would be the maximum value of the top that does not cause the overflow of the stack?

a. 8
b. 9
c. 11
d. 10

Ans:d

44) What is another name for the circular queue among the following options?

a. Square buffer
b. Rectangle buffer
c. Ring buffer
d. Triangle buffer

Ans:c

45) If the elements '1', '2', '3' and '4' are inserted in a queue, what would be order for the removal?

a. 1234
b. 4321
c. 3241
d. 4123

Ans:a

46) A list of elements in which enqueue operation takes place from one end, and dequeue operation
takes place from one end is__

a. Binary tree
b. Stack
c. Queue
d. Linked list
Ans:c

47) Which of the following principle does Queue use?

a. LIFO principle
b. FIFO principle
c. Linear tree
d. Ordered array

Ans:b

48) Which one of the following is not the type of the Queue?

a. Linear Queue
b. Circular Queue
c. Double ended Queue
d. Single ended Queue

Ans:d

49) Which one of the following is the overflow condition if linear queue is implemented using an
array with a size MAX_SIZE?

a. rear = front
b. rear = front+1
c. rear=MAX_SIZE -1
d. rear = MAX_SIZE

Ans:d

50) Which one of the following is the overflow condition if a circular queue is implemented using
array having size MAX?

a. rear= MAX-1
b. rear=MAX
c. front=(rear+1) mod max
d. rear = front

Ans:c

51) The time complexity of enqueue operation in Queue is __

a. O(1)
b. O(n)
c. O(logn)
d. O(nlogn)
Ans:a

52) Which of the following that determines the need for the Circular Queue?

a. Avoid wastage of memory


b. Access the Queue using priority
c. Follows the FIFO principle
d. Follows LIFO principle

Ans:a

53) Which one of the following is the correct way to increment the rear end in a circular queue?

a. rear =rear+1
b. (rear+1) % max
c. (rear % max) + 1
d. Front=Front+1

Ans:b

54) In the linked list implementation of queue, where will the new element be inserted?

a. At the middle position of the linked list


b. At the head position of the linked list
c. At the tail position of the linked list
d. At the second position of the linked list

Ans:c

55) How many Queues are required to implement a Stack?

a. 3
b. 2
c. 1
d. 4

Ans:b

56) Which one of the following is not the application of the Queue data structure?

a. Resource shared between various systems


b. Data is transferred asynchronously
c. Load balancing
d. Balancing of symbols

Ans:d

57) Which of the following option is true if implementation of Queue is from the linked list?

a. In enqueue operation, new nodes are inserted from the beginning and in dequeue operation,
nodes are removed from the end.
b. In enqueue operation, new nodes are inserted from the end and in dequeue operation, nodes
are deleted from the beginning.
c. In enqueue operation, new nodes are inserted from the end and in dequeue operation, nodes
are deleted from the end.
d. Both a and b

Ans:b

58) The necessary condition to be checked before deletion from the Queue is__

a. Overflow
b. Underflow
c. Rear value
d. Front value

Ans:b

60) A linear data structure in which insertion and deletion operations can be performed from both
the ends is___

a. Queue
b. Deque
c. Priority queue
d. Circular queue

Ans:b

You might also like