Computer/mcqs data structures Sample Test,Sample questions

Question:
A function f defined on stacks of integers satisfies the following properties. f(∅) = 0 and f (push (S, i)) = max (f(S), 0) + i for all stacks S and integers i.
If a stack S contains the intege

1.6

2.4

3.5

4.3


Question:
A priority queue Q is used to implement a stack S that stores characters. PUSH(C) is implemented as INSERT(Q, C, K) where K is an appropriate integer key chosen by the implementation. POP is implement

1.Non-increasing order

2.Non-decreasing order

3.strictly increasing order

4.strictly decreasing order


Question:
A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl< top 2) point to the location of the topmost element in

1.(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)

2.top1= top2 -1

3.top1 + top2 = MAXSIZE

4.(top1= MAXSIZE/2) or (top2 = MAXSIZE)


Question:
After insertion the following node in AVL tree what will be the root node ?
10,20,30,40,50,15,5

1.10

2.20

3.15

4.30


Question:
Array is collection of similar data type while structure is collection of:-

1.array

2.Primitive data type

3.Different data type

4.Non primitive data type


Question:
Assume that the operators +, -, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, x , +, -. The postfix expression corresponding to the infix ex

1.abc × + def ^ ^ -

2.abc × - def ^ ^ +

3.abc × + de ^ f ^ -

4.abc + × def ^ ^ -


Question:
Balancing Factor of each node in AVL tree may be:-

1.1

2.-1

3.0

4.All of above


Question:
Balancing Factor of each node in B and B+ tree is

1.1

2.0

3.-1

4.All of the above


Question:
Best Data Structure for Searching?

1.Heap

2.Binary Tree

3.Array

4.Hashing


Question:
Consider n elements that are equally distributed in k stacks. In each stack, elements of it are arranged in ascending order (min is at the top in each of the stack and then increasing downwards). Give

1.O(n logk)

2.O(nk)

3.O(k)

4.O(n)


Question:
Consider the following operations performed on a stack of size 5 : Push (a); Pop() ; Push(b); Push(c); Pop(); Push(d); Pop();Pop(); Push (e) Which of the following statements is correct?

1.Underflow occurs

2.Stack operations are performed smoothly

3.Overflow occurs

4.None of the above


Question:
Consider the following pseudocode that uses a stack
declare a stack of characters
while ( there are more characters in the word to read )
{
   read a character
   push the character on the stack

1.Question

2.iontQues

3.QuesQues

4.noitseuQ


Question:
Consider the following statements:
i.   First-in-first out types of computations are efficiently supported by STACKS.
ii.  Implementing LISTS on linked lists is more efficient than implementing LIST

1.(ii) and (iii) are true

2.(i) and (iii) are true

3.(i) and (ii) are true

4.(ii) and (iv) are true


Question:
Consider the postfix expression 
2 3 2 * 6 / 5 + + 8 / 1 +
Solve this expression by using stack and it give:-

1.2

2.1

3.12

4.34


Question:
Convert the following infix expression into its equivalent post fix expression (A + B^ D) / (E * F) + G

1.ABD^ + EF * / G+

2.ABD+ ^ EF * / G+

3.ABD^ + EF / - G+

4.ABD + EF * / G+ ^


Question:
Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void fun(int n) {     Stack S;  // Say it creates an empty stack S     while 

1.Prints binary representation of n in reverse order

2.Prints binary representation of n

3.Prints the value of Logn

4.Prints the value of Logn in reverse order


Question:
Hashing is a powerful data structure for the:-

1.Sorting

2.Searching

3.Insertion & deletion

4.Storing data in Data base


Question:
If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values

1.2,2,1,1,2

2.2,2,1,2,2

3.2,1,2,1,2

4.2,1,1,2,2


Question:
In circular link list, the last node contain the address of the:-

1.It contain NULL

2.first node

3.Both of the above

4.None of the above


Question:
In max Heap, the cost of finding largest element is :-

1.O(n)

2.O(logn)

3.O(nlogn)

4.O(1)


Question:
In max Heap, the cost of finding smallest number is:-

1.O(logn)

2.O(n)

3.O(nlogn)

4.O(1)


Question:
In min Heap, the cost of finding smallest elements is:-

1.O(n)

2.O(1)

3.O(logn)

4.None of the above


Question:
int func(struct node *ptr)
{
if(ptr==NULL)
return;
func(ptr->left);
func(ptr->right);
printf("%d",ptr->data);
}

The above function computes the :-

1.Postorder of BST

2.Inorder of BST

3.Preorder of BST

4.None of the above


Question:
int func(struct node *ptr)
{
if(ptr==NULL)
return;
func(ptr->left);
printf("%d",ptr->data);
func(ptr->right);
}

The above function computes the :-

1.Postorder of BST

2.Inorder of BST

3.Preorder of BST

4.None of the above


Question:
int func(struct node *ptr)
{
if(ptr==NULL)
return;
printf("%d",ptr->data);
func(ptr->left);
func(ptr->right);
}

The above function computes the :-

1.Postorder of BST

2.Inorder of BST

3.Preorder of BST

4.All of the above


Question:
Let S be a stack of size n >= 1. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform n pop operations. Assume that Push and Pop operation take X se

1.n(X+ Y)

2.3Y + 2X

3.n(X + Y)-X

4.Y + 2X


Question:
Stack A has the entries a, b, c (with a on top). Stack B is empty. An entry popped out of stack A can be printed immediately or pushed to stack B. An entry popped out of the stack B can be only be pri

1.b a c

2.a b c

3.c a b

4.b a c


Question:
Stack is implemented by:-

1.Array

2.Link list

3.Both of the above

4.None of the above


Question:
Suppose a stack is to be implemented with a linked list instead of an array. What would be the effect on the time complexity of the push and pop operations of the stack implemented using linked list (

1.O(1) for insertion and O(n) for deletion

2.O(1) for insertion and O(1) for deletion

3.O(n) for insertion and O(1) for deletion

4.O(n) for insertion and O(n) for deletion


Question:
The best data structure to check whether an arithmetic expression has balanced parenthesis is a

1.Queue

2.Tree

3.Heap

4.Stack


Question:
The cost of construct the Heap is :-

1.O(n)

2.O(nlogn)

3.O(log(logn))

4.None of the above


Question:
The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the 

1.A

2.B

3.C

4.D


Question:
The following node are inserted sequentially in Binary search tree:-
30,3,50,10,5,70,80,75,60,45
what will be the Inorder of above BST?

1.3,5,10,30,45,50,60,70,75,80

2.80,5,10,30,45,50,60,70,75,3

3.30,3,50,10,45,70,5,60,75,80

4.3,5,10,30,45,50,70,60,80,75


Question:
The following node are inserted sequentially in Binary search tree:-
30,3,50,10,5,70,80,75,60,45
what will be the preorder of above BST?

1.30,3,10,5,50,45,60,70,75,80

2.No preorder exist

3.Preorder of every BST is in increasing order of numbers

4.30,3,10,5,50,45,70,60,80,75


Question:
The following postfix expression with single digit operands is evaluated using a stack:
              8 2 3 ^ / 2 3 * + 5 1 * - 
Note that ^ is the exponentiation operator. The top two elements of t

1.7,2

2.1,1

3.6,1

4.Empty


Question:
The minimum number of stacks needed to implement a queue is

1.1

2.3

3.2

4.4


Question:
The result evaluating the postfix expression 10 5 + 60 6 / * 8 – is

1.123

2.142

3.34

4.289


Question:
The seven elements A, B, C, D, E, F and G are pushed onto a stack in reverse order, i.e., starting from G. The stack is popped five times and each element is inserted into a queue.Two elements are del

1.A

2.B

3.F

4.G


Question:
To evaluate an expression without any embedded function calls:

1.One stack is enough

2.Two stacks are needed

3.As many stacks as the height of the expression tree are needed

4.A Turing machine is needed in the general case


Question:
Which of the following are true:

1.Insertion in stack is done at the bottom of the stack

2.Searching an element in link list is performed in O(1)

3.Every binary search tree is binary tree

4.Every binary tree is binary search tree


Question:
Which of the following are true:

1.Stack are the LIFO

2.Queue is FIFO

3.Queue is LILO

4.All of the above


Question:
Which of the following are True?

1.Every Binary Tree is binary search tree

2.Binary search tree is AVL tree

3.Every AVL tree is binary tree

4.No relation between the binary tree and the AVL tree


Question:
Which of the following is not an inherent application of stack?

1.Implementation of recursion

2.Evaluation of a postfix expression

3.Job scheduling

4.Reverse a string


Question:
Which of the following is true about linked list implementation of stack?

1.In push operation, if new nodes are inserted at the beginning of linked lis

2.In push operation, if new nodes are inserted at the end, then in pop operat

3.Both of the above

4.None of the above


Question:
Which of the following permutation can be obtained in the same order using a stack assuming that input is the sequence 5, 6, 7, 8, 9 in that order?

1.7, 8, 9, 5, 6

2.5, 9, 6, 7, 8

3.7, 8, 9, 6, 5

4.9, 8, 7, 5, 6


Question:
Which of the following sorting are the stable sorting:-

1.Insertion Sort

2.Selection Sort

3.Bubble Sort

4.All of the above


Question:
Which of the following tree support the sequential search?

1.AVL tree

2.B tree

3.B+ tree

4.Complete Binary tree


Question:
Which one of the following is an application of Stack Data Structure?

1.Arithmetic expression evaluation

2.Managing function calls

3.The stock span problem

4.All of the above


Question:
Worst Time complexity for searching an element in Binary search tree is:

1.O(logn)

2.O(n)

3.O(1)

4.O(nlogn)


More MCQS

  1. Computer fundamentals
  2. Computer Basic MCQS
  3. CCC MCQ Sample Paper 1
  4. CCC Exams MCQS Sample Paper Test 2
  5. Computer Basics MCQS Paper 1
  6. Computer Basics MCQS Paper 2
  7. FUNDAMENTALS OF COMPUTERS MCQs PART 2
  8. FUNDAMENTALS OF COMPUTERS MCQs PART 1
  9. FUNDAMENTALS OF COMPUTERS MCQs PART 3
  10. Computer mcqs smaple paper 1
  11. Computer mcqs smaple paper 2
  12. Computer mcqs smaple paper 3
  13. Fundamentals of Computers
  14. Fundamentals of Computers (New) Part 1
  15. Fundamentals of Computers (New) Part 2
  16. Computer Networks MCQ Questions
  17. Computer Networks Transition from IPV4 to IPV6
  18. Computer Fundamentals (New) Part 1
  19. Computer Fundamentals (New) Part 2
  20. Computer Fundamentals (New) Part 3
  21. Computer Fundamentals (New) Part 4
  22. Computer Fundamentals (New) Part 5
  23. Computer Fundamentals (New) Part 6
  24. Computer Fundamentals (New) Part 7
  25. Computer Fundamentals (New) Part 8
  26. Operating Systems MCQs Part 1
  27. Operating Systems MCQs Part 2
  28. OS(Computer Operating Systems) Part 1
  29. OS(Computer Operating Systems) Part 2
  30. OS(Computer Operating Systems) Part 3
  31. OS(Computer Operating Systems) Part 4
  32. OS - Computer Operating Systems Part 5
  33. OS - Computer Operating Systems Part 6
  34. OS - Computer Operating Systems Part 7
  35. MS Word MCQ Questions Part 1
  36. MS Word MCQ Questions Part 2
  37. MS Word MCQ Questions Part 3
  38. MS Word MCQ Questions Part 4
  39. MS Word MCQ Questions Part 5
  40. MS Word MCQ Questions Part 7
  41. MS Word MCQ Questions Part 6
  42. Microsoft Excel MCQ Questions Part 1
  43. Microsoft Excel MCQ Questions Part 2
  44. Microsoft Excel MCQ Questions Part 3
  45. Microsoft Excel MCQ Questions Part 4
  46. Microsoft Excel MCQ Questions Part 5
  47. Microsoft Excel MCQ Questions Part 6
  48. Microsoft Excel MCQ Questions Part 7
  49. MS PowerPoint MCQ Questions PART 1
  50. MS PowerPoint MCQ Questions PART 2
  51. MS PowerPoint MCQ Questions PART 3
  52. MS PowerPoint MCQ Questions PART 4
  53. MS PowerPoint MCQ Questions PART 5
  54. MS PowerPoint MCQ Questions PART 6
  55. MS PowerPoint MCQ Questions PART 7
  56. MS Access MCQ Questions Part 1
  57. MS Access MCQ Questions Part 2
  58. MS Access MCQ Questions Part 3
  59. MS Access MCQ Questions Part 4
  60. MS Access MCQ Questions Part 5
  61. MS Access MCQ Questions Part 6
  62. MS Access MCQ Questions Part 7
  63. MS Access MCQ Questions Part 8
  64. Query of MS Access MCQS Part 1
  65. Query of MS Access MCQS Part 2
  66. Computer Communication and Networking Quiz
  67. Computer Graphics MCQ Quiz Questions and Answers
  68. Computer Basics Quiz Questions
  69. Computer Quiz Questions with Answers
  70. Computer Hardware MCQS Quiz
  71. MCQ Computer Organization & Architecture
  72. MCQ Computer Organisation - Input & output Organisation SET1
  73. MCQ Computer Organisation - Input & output Organisation SET2
  74. MCQ Computer Organisation - Input & output Organisation SET3
  75. MCQS on addressing modes SET 1
  76. MCQS on addressing modes SET 2
  77. Software Engineering MCQs SET 1
  78. Software Engineering MCQs SET 2
  79. Software Engineering MCQs Set 3
  80. Software Engineering MCQs Set 4
  81. Software Engineering MCQs Set 5
  82. Software Engineering MCQs Set 6
  83. Software Engineering MCQs Set 7
  84. mcqs data structures
  85. CCC Exam Sample MCQ Paper
  86. Computer MCQ Questions set-1
  87. Computer MCQ Questions set-2
  88. Computer MCQ Questions set-3
  89. Current affairs mcq Database management
  90. Programming arcitecture
  91. Computer Graphics MCQ Questions part 1
  92. Computer Graphics MCQ Questions part 2
  93. Computer Awareness MCQs and Quiz for Banking, IBPS, RRB, RBI, SBI Exams pART 1
  94. Computer Awareness MCQs and Quiz for Banking, IBPS, RRB, RBI, SBI Exams pART 2
  95. Computer Science MCQs
  96. Computer Mcq Question
  97. MCQs based on Fundamentals of Computer 1 set
  98. Computer Mcq Question set 2
  99. MCQ Encoding Schemes
  100. Data Entry and Keyboarding Skills MCQ
  101. Computer Science Number System
  102. Computer Network MCQ
  103. MCQ Questions on Tally
  104. MCQ Questions on Tally Set 2
  105. MCQ Questions on Tally Set 3
  106. MCQ Questions on Tally Set 4
  107. Internet Technology MCQ Questions for Competitive Exams
  108. Computer Software MCQ GK Questions
  109. Computer Organization and Architecture MCQs
  110. Basic Computer GK Questions
  111. Computer Graphics MCQ Set 1
  112. Operating System MCQ Set 1
  113. Operating System MCQ Set 2
  114. Operating System MCQ Set 3
  115. Operating System MCQ Set 4
  116. Operating System MCQ Set 5
  117. Operating System MCQ Set 6
  118. Operating System MCQ Set 7
  119. Operating System MCQ Set 8
  120. Operating System MCQ Set 9
  121. Operating System MCQ Set 10
  122. Operating System MCQ Set 11
  123. Operating System MCQ Set 12
  124. Operating System MCQ Set 13
  125. Operating System MCQ Set 14
  126. Operating System MCQ Set 15
  127. Operating System MCQ Set 16
  128. Operating System MCQ Set 17
  129. Operating System MCQ Set 18
  130. Operating System MCQ Set 19
  131. Operating System MCQ Set 20
  132. Operating System MCQ Set 21
  133. Computer Graphics MCQ Question Set 1
  134. Computer Networks MCQs
  135. Computer Networks MCQs Set-2
  136. Computer Networks MCQs Set-3
  137. Computer Networks MCQs Set-4
  138. Bachelor of Computer Applications MCQs set-1
  139. Bachelor of Computer Applications MCQs set-2
  140. Computer Science Engineering (CSE) .NET Programming
  141. NET Programming MCQ
  142. Artificial Intelligence and Robotics (AIR) Set 1
  143. Artificial Intelligence and Robotics (AIR) Set 2
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!