Algorithm Basics MCQs: 12 Solved Questions with Explanations

Solve 12 algorithm basics MCQs from teaching, PSU and placement papers, with clear answers, traps, efficiency checks and step-by-step traces.

KnowledgeGate Team

Exam prep & CS education

Updated 27 Jul 20267 min read

Algorithm basics look easy until a definition, a comparison operator or a recursive call catches you out. The right frame turns most of them into 30-second questions. The 12 previous-year questions here come from DSSSB, HTET, BPSC, RSSB and Bihar STET teaching papers, from ISRO, and from the Infosys, Accenture and Hexaware placement rounds.

What these exams actually ask from algorithm basics

Questions fall into three buckets: algorithm definitions and properties, flowcharts and control constructs, or efficiency and simple traces. Teaching-recruitment papers lean on the first two, where one word such as finiteness or selection decides the mark. ISRO and the placement rounds push into the third, where recognising the answer is not enough and you have to run the lines yourself.

Traces are where the clock goes, so if pseudocode output questions are the ones you lose, work through Infosys Pseudocode Questions: 17 Solved Traces and Traps alongside this set.

Defining an algorithm: 4 solved questions

Q1. A step-by-step solution

HTET 2023: "Step by step description of how to arrive at a solution to a given problem is known as:"

  • (A) Algorithm

  • (B) Plan

  • (C) ASCII Code

  • (D) UNICODE

Answer: (A) Algorithm

An algorithm is a step-by-step procedure for solving a problem. A plan may be informal, while an algorithm is finite and unambiguous. You can practise this question on the solved page.

Q2. The property that guarantees termination

DSSSB 2018: "Which of the following properties ensures that an algorithm must always terminate after a finite number of steps?"

  • (A) Effectiveness

  • (B) Definiteness

  • (C) Finiteness

  • (D) Output

Answer: (C) Finiteness

The five classic properties are input, output, definiteness, finiteness and effectiveness. Finiteness guarantees termination after a limited number of steps, while definiteness, the strongest trap here, means that every step is unambiguous. You can practise this question on the solved page.

Q3. True statements about algorithms

DSSSB 2021: "Which of the following statement(s) is/are true about Algorithm? I. It is step by step solution of problem. II. It is difficult to debug. III. It is not dependent on the programming language."

  • (A) I and II

  • (B) II and III

  • (C) I and III

  • (D) I, II and III

Answer: (C) I and III

Statements I and III are true because an algorithm is language-independent. Statement II is false: algorithms are easier to debug than code because there is no syntax noise. Settling II eliminates every option containing it. You can practise this question on the solved page.

Q4. What a computer program consists of

BPSC 2023: "A computer program consists of"

  • (A) system flowchart

  • (B) program flowchart

  • (C) algorithms written in computer language

  • (D) More than one of the above

  • (E) None of the above

Answer: (C) algorithms written in computer language

A program is an algorithm expressed in a computer language. Flowcharts are design artefacts, not the program, so option D is also incorrect. State PSC papers may have five options; read them all. You can practise this question on the solved page.

Flowcharts and control constructs: 2 solved questions

Q5. Pictorial representation

HTET 2023: "Pictorial representation of an algorithm is called as:"

  • (A) Image

  • (B) Picture

  • (C) Flowchart

  • (D) Pseudocode

Answer: (C) Flowchart

A flowchart is the pictorial representation of an algorithm. Pseudocode is the textual alternative, which is the only contrast needed to reject the strongest wrong option. You can practise this question on the solved page.

Q6. Selection in an everyday scenario

RSSB 2023: "A child has to cross road and reach the school opposite to his house. The child looks on right and left before crossing the road. On observing that no vehicle is coming, he crosses the road and reaches school. What action of algorithm is represented by the child in the above situation?"

  • (A) Input

  • (B) Output

  • (C) Selection

  • (D) Repetition

Answer: (C) Selection

The condition "no vehicle coming?" controls whether the child crosses, so this is selection, like if-else. Looking left and right is the input that feeds the condition, and repetition would need that check to run in a loop. You can practise this question on the solved page.

Measuring efficiency: 4 solved questions

Q7. The two resources that matter

DSSSB 2021: "Efficiency of an algorithm is measured in terms of _____."

  • (A) Memory and processor speed

  • (B) Time and space

  • (C) Response time and completion time

  • (D) Data and space

Answer: (B) Time and space

Algorithmic efficiency is described through time complexity and space complexity. Processor speed belongs to the hardware, so option A does not measure the algorithm independently of the machine. You can practise this question on the solved page.

Q8. What algorithm analysis measures

Bihar STET 2025: "Algorithm analysis is primarily concerned with:"

  • (A) Determining the best algorithm for a specific problem

  • (B) Measuring the time and space efficiency of an algorithm

  • (C) Creating new algorithms from scratch

  • (D) Solving algorithmic problems using any available approach

Answer: (B) Measuring the time and space efficiency of an algorithm

Analysis measures how one algorithm's time and space requirements grow with the input. Choosing the best algorithm, option A, can be a consequence of comparing analyses, but it is not the primary act of analysis itself. You can practise this question on the solved page.

Q9. Bit-field width for values from 0 to n

ISRO 2018: "If a variable can take only integral values from 0 to n, where n is an integer, then the variable can be represented as a bit-field whose width is (the log in the answers are to the base 2, and [log n] means the floor of log n)"

  • (A) [log(n)] + 1 bits

  • (B) [log(n-1)] + 1 bits

  • (C) [log(n+1)] + 1 bits

  • (D) None of the above

Answer: (A) [log(n)] + 1 bits

The range 0 to n contains n + 1 distinct values. For n = 100, floor(log2 100) = 6 because 2^6 = 64 <= 100 < 128 = 2^7, so the width is 6 + 1 = 7 bits; 7 bits provide 128 states for 101 values, while 6 bits provide only 64. As a sanity check, n = 7 needs 3 bits, giving exactly 8 states for 0 through 7, and n = 8 needs 4 bits for 9 states. These capacity checks rule out the nearby log expressions. You can practise this question on the solved page.

Hexaware 2024: "Is the space consumed by linear search (recursive) and linear search (iterative) the same?"

  • (A) No, recursive algorithm consumes more space

  • (B) No, recursive algorithm consumes less space

  • (C) Yes

  • (D) Nothing can be said

Answer: (A) No, recursive algorithm consumes more space

Recursive linear search can build n stack frames, giving O(n) auxiliary space, while the iterative version uses O(1) auxiliary space. Their time complexity can be the same, but option C ignores the extra call stack, which is exactly what the question tests. You can practise this question on the solved page.

Pseudocode tracing under time pressure: 2 solved questions

Q11. Equality inside a comparison

Accenture 2024: "What will be the output of the following pseudocode? SET x TO 5, SET y TO 5, IF x >= y THEN OUTPUT \"x is greater than or equal to y\" ELSE OUTPUT \"x is less than y\" END IF"

  • (A) x is greater than or equal to y

  • (B) x is less than y

  • (C) 5

  • (D) Error

Answer: (A) x is greater than or equal to y

The condition 5 >= 5 is true because >= includes equality. Option B comes from reading the operator as >, so slow down at the comparison even when the values look trivial. You can practise this question on the solved page.

Q12. A recursion trace on the way down and up

Infosys 2024: "What will be the output of the following pseudocode when n = 3? Integer calc(Integer n): if (n <= 0) return 0; if (n < 1) return 1; Print n; calc(n-1); Print n; End function calc"

  • (A) 1 2 3

  • (B) 3 2 1 0

  • (C) 3 2 1 1 2 3

  • (D) Compiler error

Answer: (C) 3 2 1 1 2 3

calc(3) prints 3 and calls calc(2); calc(2) prints 2 and calls calc(1); calc(1) prints 1 and calls calc(0); calc(0) hits n <= 0 and returns 0 without printing, so the second guard, n < 1, can never fire. Unwinding then prints 1, 2, 3 from the pending second Print in each frame, giving 3 2 1 1 2 3. Option B wrongly prints the base value and misses those pending statements. Anything printed after a recursive call comes out in reverse order on the way back up. You can practise this question on the solved page.

Vertical call-stack trace for calc(3) with four frames labelled calc(3), calc(2), calc(1), calc(0); down-arrows on the left showing prints 3, 2, 1 on the way down, calc(0) marked "returns 0, prints nothing", and up-arrows on the right showing prints 1, 2, 3 during unwinding; final output strip at the bottom reading 3 2 1 1 2 3.

The pattern behind all 12

The details change, but the fast check for each bucket stays stable:

Bucket

What it tests

The 5-second check

Definitions

Meaning and properties

Recall input, output, definiteness, finiteness and effectiveness

Flowcharts and constructs

Mapping a representation or scenario

Choose input, output, selection or repetition

Efficiency

Resource growth

Check both time and space, never hardware speed

Traces

Execution order

Run line by line and mark statements after recursion

Strong candidates do not drop these marks. Asymptotic notation and recurrences build on this foundation. Continue with Data Structures MCQs for the next solved set.

The short version and where to practise next

These 12 solved PYQs span teaching, PSU and placement papers. KnowledgeGate's question bank carries about 45 questions on algorithm basics and analysis, each with a worked solution page.

For topic-wise mocks and full-length practice, use the GATE Test Series. To build concepts from scratch for placement tests, follow CS Fundamentals for Placements by Sanchit Sir. Find more guides and solved sets under Coding & CS Fundamentals.