# Wipro DSA Questions with Answers

6 previously-asked dsa questions from Wipro's hiring process, each with the correct answer and a worked explanation. Written against the company's actual test pattern.

_Source: Astra (https://useastra.in). Updated 2026-09-05._

### 1. Check whether a given number is an Armstrong number.

**Answer:** For an n-digit number, sum each digit raised to the power n; if the sum equals the original number it is an Armstrong number (for example 153 = 1 + 125 + 27). Extract digits with modulo and division. Time O(number of digits).

**Explanation:** Sum of digits each raised to digit-count.

### 2. Find the sum of the digits of a number.

**Answer:** Repeatedly take n mod 10 to get the last digit, add it to a running total, then do integer division n = n / 10 until n becomes 0. Time O(number of digits).

**Explanation:** Modulo and divide loop.

### 3. Reverse a string in place.

**Answer:** Use two pointers at the start and end, swap the characters, and move them toward the centre until they meet. Time O(n), space O(1). In languages with immutable strings, build a new reversed string instead.

**Explanation:** Two-pointer in-place swap.

### 4. Find the maximum element in an array.

**Answer:** Initialise max to the first element, then scan the rest, updating max whenever a larger element is found. Return max. Time O(n), space O(1).

**Explanation:** Single pass tracking the maximum.

### 5. Check whether two strings are anagrams of each other.

**Answer:** If lengths differ they are not anagrams. Otherwise count character frequencies for both (or sort both) and compare. Using a frequency array is O(n); sorting is O(n log n).

**Explanation:** Compare character frequencies.

### 6. Count how many times a given element appears in an array.

**Answer:** Initialise a counter to 0, iterate the array, and increment the counter each time the element matches the target. Return the counter. Time O(n).

**Explanation:** Linear scan with a counter.

More Wipro preparation, including the full recruitment process: https://useastra.in/campus/wipro
