Aspirant Academy

MCQ

Algorithms MCQ - Practice Questions with Answers

Solve 13 Algorithms questions for RAS/RPSC preparation.

Practice questions

Q1One term is wrong in the following series. Find that wrong term – 4, 15, 64, 5, 25, 125, 6, 36, 216

A 64
B 25
C 36
D 15
Explanation

The intended pattern is groups of n, n squared, and n cubed for 4, 5, and 6. For 4 the middle term should be 4 squared = 16, while 64 is 4 cubed. The given 15 breaks the pattern, so option D is correct.

Q2The postfix form of the expression (A+B)*(C*D-E)*F/G , is -

A AB+CD*E-FG/**
B AB+CD*E-F**G/
C AB+CD*E-*F*G/
D AB+CDE*-*F*G/
Explanation

Option C is correct because postfix places each operator after its operands. Here (A+B) becomes AB+, (C*D−E) becomes CD*E−, then multiplying by F and dividing by G gives AB+CD*E-*F*G/.

Q3Which one of the following is the process of inserting an element in the stack?

A Insert
B Add
C Push
D None of the above
Explanation

In a stack, the operation that places a new item on the top is called push. The verified programming reference for stack operations defines push as adding an item onto the top of the stack, while pop removes the top item. Therefore option C is correct.

Q4Reverse polish notation for infix expression (A+B)*C-D/E will be -

A -*+ABC/DE
B AB+CD-*E/
C AB+C*DE-/
D AB+C*DE/-
Explanation

Reverse Polish notation is postfix notation, so every operator is written after its operands. Here, (A+B) becomes AB+, multiplying by C gives AB+C*, D/E becomes DE/, and subtracting the second part gives AB+C*DE/-. Therefore option D is the correct postfix form.

Q5Rohit multiplies a number by 2 instead of dividing the number by 2. Resultant number is what percentage of the correct value?

A 200%
B 300%
C 50%
D 400%
Explanation

Option D is correct. If the number is x, the correct value after dividing by 2 is x/2, while Rohit's result is 2x; therefore the result is (2x)/(x/2) × 100 = 400% of the correct value.

You've seen 5 of 13 sample questions

Unlimited practice on Algorithms comes with the RAS Test Series + Practice pack or Gate Pass.

More questions

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

ASquare buffer
BRectangle buffer
CRing buffer
DNone of the above

7For defining the best time complexity, let f(n) = log(n) and g(n) = √n, .......

Af(n) ∈ Ω (g(n)), but g(n) ∉ Ω (f(n))
Bf(n) ∉ Ω (g(n)), but g(n) ∈ Ω (f(n))
Cf(n) ∉ Ω (g(n)), and g(n) ∉ Ω (f(n))
Df(n) ∈ Ω (g(n)), and g(n) ∈ Ω (f(n))

8Which of the following principle does queue use?

ALIFO principle
BFIFO principle
CLinear tree
DOrdered array

9Consider an undirected un-weighted graph G. Let a breadth first traversal of G be done starting from a node r. Let d(r,u) and d(r,v) be the length of the shortest path from r to u and v respectively in G. If u is visited before v during the breadth first traversal, which of the following statement is correct?

Ad (r,u) < d (r,v)
Bd (r,u) > d (r,v)
Cd (r,u) <=d (r,v)
DNone of the above

10The Knapsack problem where the objective function is to minimize the profit is -

AGreedy
BDynamic 0/1
CBack tracking
DBranch & Bound 0/1

11If P denotes '+', R denotes '×', S denotes '−' and T denotes '÷', then what will be the value of 5R9P7S9T3P6?

A128
B59
C55
D54

12An advantage of chained hash table (external hashing) over the open addressing scheme is -

AWorst case complexity of search operations is less
BSpace used is less
CDeletion is easier
DNone of the above

13Which one of the following is an application of queue data structure?

AWhen a resource is shared among multiple consumers
BWhen data is transferred asynchronously between two processes
CLoad balancing
DAll of the above

More topics in Programming & Data Structures (Senior CI)

Explore other subjects