Skip to main content

Data Structures - MCQs from AMIE exams (Winter 2018)

1. Time complexity of insertion sort algorithm in the best case is
(a) O(n)
(b) O(n log2n)
(c) O(n2)
(d) None of the above

2. The prefix equivalent of the following infix expression is:
a/b – c + d * e – a * c
(a) - + - / a b c * d e * a c
(b) - - + / a b c * d e * a c
(c) + - - / a b c * d e * a c
(d) None of the above

3. In linked list representation, a node contains at least
(a) Node address field, data field
(b) Node number, data field
(c) Next address field, information field
(d) None of the above

4. The following sequence of operations is performed on a stack
push(1) push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop.
The sequences of popped out values are
(a) 2, 2, 1, 2, 1
(b) 2, 2, 1, 1, 2
(c) 2, 1, 2, 2, 1
(d) 2, 1, 2, 2, 2

5. For the following statement find the values generated for p and q?
    int p = 0, q = 1;
    p = q++;
    p = ++q;
    p = q--;
    p = --q;
The value of p & q is
(a) 1 1
(b) 0 0
(c) 3 2
(d) 1 2

6. The break statement causes an exit
(a) Only from the innermost loop
(b) Only from the innermost switch
(c) From the innermost loop or the switch
(d) None of the above

7. The && and || operators
(a) Compare two numeric values
(b) Combine two numeric values
(c) Compare two Boolean values
(d) Combine two Boolean values

8. Infix expression can be converted to postfix expression using a data structure called
(a) Stack
(b) Queue
(c) Both Stack and Queue
(d) None of the above

9. The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 5, 13 in ascending order, using bubble sort is
(a) 11
(b) 12
(c) 13
(d) 10

10. An ordered set of items from which items may be deleted at either end and into which items may be inserted at either end is called
(a) Queue 
(b) Stack 
(c) Heap 
(d) Deque

Answer

1. (a)

2. (a)  Algorithm for conversion from prefix to infix:
STEP 1: Start scanning the expression from RHS. Push the operators on the top of the stack by ensuring that only high priority operator can be pushed over a low priority operator.

STEP 2: If a low priority operator is encountered in expression and if the top of the stack is a high priority operator, then pop it and after that push the low priority operator on the top of the stack.

STEP 3: Print each operand.

Given expression is : a/b – c + d * e – a * c
⇒ /ab-c+d*e-a*c
⇒ -/abc+d*e-a*c 
⇒ +-/abcd*e-a*c
⇒ +-/abc*de-a*c
⇒ +-/abc*de-*ac
⇒ -+-/abc*de*ac

3. (c) 

4. (b) The pop sequence can be seen in the following table:

5. (a)

6. (c) 

7. (d) Logical operators are used to combine and evaluating boolean expressions.
&& called Logical AND operator. If both the operands are non-zero, then the condition becomes true.
|| called Logical OR Operator. If any of the two operands are non-zero, then the condition becomes true.

8. (a) The conversion of infix notation to postfix notation is done by using Stack.
Infix Expression is in form <Operand><Operator><Operand>, Eg: A + B
Postfix Expression is in form <Operand><Operand><Operator>, Eg: AB+

9. (d) Bubble sort repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass of the list is repeated until no swaps are needed, which indicates that the list is sorted.

Array elements: 8, 22, 7, 9, 31, 5, 13
1st pass = 8, 7, 9, 22, 5, 13, 31
4 swaps

2nd pass = 7, 8, 9, 5, 13, 22, 31
3 swaps

3rd pass = 7, 8, 5, 9, 13, 22, 31
1 swap

4th pass = 7, 5, 8, 9, 13, 22, 31
1 swap

5th pass = 5, 7, 8, 9, 13, 22, 31
1 swap

Since the array is sorted after the 5th pass
∴ no further swaps are possible.

Total number of swaps = 4 + 3 + 1 + 1 + 1 = 10 

10. (d) A deque (pronounced deck) is an ordered set of items from which items may be deleted at either end and into which items may be inserted at either end.  In a sense, this hybrid linear structure provides all the capabilities of stacks and queues in a single data structure.

It is important to note that even though the deque can assume many of the characteristics of stacks and queues, it does not require the LIFO and FIFO orderings that are enforced by those data structures. It is up to you to make consistent use of the addition and removal operations.

---
  • The study material for AMIE/B Tech/Junior Engineer exams is available at https://amiestudycircle.com
  • If you like the post please share your thoughts in the comment section 


Comments

Popular posts from this blog

Mechanics of Fluids (Solved Numerical Problems)

Numerical The surface Tension of water in contact with air at 20°C is 0.0725 N/m. The pressure inside a droplet of water is to be 0.02 N/cm² greater than the outside pressure. Calculate the diameter of the droplet of water. (7 marks) (AMIE Summer 2023) Solution Surface tension, σ = 0.0725 N/m Pressure intensity, P = 0.02 N/m 2 P = 4σ/d Hence, the Diameter of the dropd = 4 x 0.0725/200 = 1.45 mm Numerical Find the surface tension in a soap bubble of 40 mm diameter when the inside pressure is 2.5 N/m² above atmospheric pressure. (7 marks) (AMIE Summer 2023) Answer: 0.0125 N/m Numerical The pressure outside the droplet of water of diameter 0.04 mm is 10.32 N/cm² (atmospheric pressure). Calculate the pressure within the droplet if surface tension is given as 0.0725 N/m of water. (AMIE Summer 2023, 7 marks) Answer: 0.725 N/cm 2   Numerical An open lank contains water up to a depth of 2 m and above it an oil of specific gravity 0.9 for a depth of 1 m. Find the pressure intensity (i) at t...

Energy Systems (Solved Numerical Problems)

Wind at 1 standard atmospheric pressure and \({15^0}C\) has velocity of 15 m/s, calculate (i) the total power density in the wind stream (ii) the maximum obtainable power density (iii) a reasonably obtainable power density (iv) total power (v) torque and axial thrust Given: turbine diameter = 120 m, and turbine operating speed = 40 rpm at maximum efficiency. Propeller type wind turbine is considered. (AMIE Winter 2023) Solution For air, the value of gas constant is R = 0.287 kJ/kg.K 1 atm = 1.01325 x 105 Pa Air density \(\rho  = \frac{P}{{RT}} = \frac{{1.01325x{{10}^5}}}{{287}}(288) = 1.226\,kg/{m^3}\) Total Power \({P_{total}} = \rho A{V_1}^3/2\) Power density \(\begin{array}{l}\frac{{{P_{total}}}}{A} = \frac{1}{2}\rho {V_1}^3\\ = \frac{1}{2}(1.226){(15)^3}\\ = 2068.87{\mkern 1mu} W/{m^2}\end{array}\) Maximum power density \(\begin{array}{l}\frac{{{P_{\max }}}}{A} = \frac{8}{{27}}\rho A{V^3}_1\\ = \frac{8}{{27}}(1.226){(15)^3}\\ = 1226{\mkern 1mu} W/{m^2}\end{array}\) Assuming eff...

Design of Electrical Systems (Solved Numerical Problems)

Important note There is something wrong with this question paper. It seems that instead of "Design of Electrical Systems" the IEI has given problems from "Electrical Machines". You should raise a complaint to director_eea@ieindia.org in this regard. Numerical A 120 V DC shunt motor draws a current of 200A. The armature resistance is 0.02 ohms and the shunt field resistance is 30 ohms. Find back emf. If the lap wound armature has 90 slots with 4 conductors per slots, at what speed will the motor run when flux per pole is 0.04 Wb?​ (AMIE Summer 2023, 8 marks) Solution The back EMF (E b ) of a DC motor can be calculated using the formula: E b = V - I a R a   Given: V = 120 V I a = 200 A R a = 0.02 ohms Substituting the values into the formula: E b = 120 − 200 × 0.02 = 120 − 4​ = 116 V Now, let's calculate the speed (N) at which the motor will run using the given flux per pole (φ p ). The formula to calculate the speed of a DC motor is: N = 60×E b /(P×φ p ) Wh...