Back

Wipro Coding Questions: Practice and Prepare for Interviews

16 Dec 2024
10 min read

Wipro is one of India's leading IT services companies. It conducts a variety of coding rounds during its recruitment process. The coding round is an essential part of the hiring process to evaluate a candidate’s problem-solving and coding abilities. Whether you're preparing for the Wipro assessment test coding questions or specifically focusing on Wipro coding interview questions, understanding the types of questions and the strategies to crack them can significantly boost your chances of success.

As one of the most sought-after companies for freshers and experienced, Wipro’s selection process has evolved to include challenging coding questions. These questions are designed to assess a candidate’s technical problem-solving skills, logical thinking, and proficiency in programming language. For candidates aiming to get through Wipro's coding test or coding interview, focusing on practice and mastering coding fundamentals is crucial.

Importance of Wipro Coding Questions for Candidates

The Wipro coding questions hold significant importance because they test not just your knowledge of programming languages, but also your ability to think critically and solve complex problems. Whether it’s Wipro milestone coding questions or the ones asked during Wipro placement coding questions, mastering them can help you secure your place in the company. The coding round typically evaluates:

  • Data Structures and Algorithms Knowledge
  • Logical reasoning and problem-solving ability
  • Speed and accuracy in coding
  • Ability to debug and optimize code
  • A good grasp of these elements will give you an edge in the competitive hiring process.

Beginner Level Wipro Coding Question & Answers

For those just starting their Wipro coding preparation, focusing on fundamental concepts is key. Here are a few examples of beginner-level Wipro coding questions:

Problem 1: You are given two strings, each representing a large number. Write a program to calculate the sum of these two numbers. Each string contains digits only and can be of different lengths. The result should be returned as a string, and no leading zeroes should be present in the result.

Test Cases

Input: First number: 123, Second number: 456

Output: 579

Input: 999, 1

Output: 1000

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char* addStrings(char* num1, char* num2) {
    int len1 = strlen(num1), len2 = strlen(num2);
    int maxLen = (len1 > len2) ? len1 : len2;
    char* result = (char*)malloc((maxLen + 2) * sizeof(char)); // Extra space for carry
    int carry = 0, i, j, k = 0;

    for(i = len1 - 1, j = len2 - 1; i >= 0 || j >= 0 || carry; i--, j--) {
        int digit1 = (i >= 0) ? num1[i] - '0' : 0;
        int digit2 = (j >= 0) ? num2[j] - '0' : 0;
        int sum = digit1 + digit2 + carry;
        carry = sum / 10;
        result[k++] = (sum % 10) + '0';
    }
    result[k] = '\0';

    // Reverse result string
    for(i = 0, j = k - 1; i < j; i++, j--) {
        char temp = result[i];
        result[i] = result[j];
        result[j] = temp;
    }

    return result;
}

int main() {
    char num1[1000], num2[1000];
    printf("Enter first number: ");
    scanf("%s", num1);
    printf("Enter second number: ");
    scanf("%s", num2);

    char* sum = addStrings(num1, num2);
    printf("Sum: %s\n", sum);
    free(sum);
    return 0;
}

Problem 2: You are given an array of integers. Write a program to find the largest product of any two distinct numbers in the array. The program should handle both positive and negative numbers. If the array contains fewer than two elements, return a suitable message indicating that it’s not possible to calculate the product.

Test Cases

Input: n= 4, arr[] = 1 2 3 4

Output: 12

Input: n= 4, arr[] = -10 -3 5 6

Output: 30

#include <stdio.h>

int largestProduct(int arr[], int n) {
    int max1 = arr[0], max2 = arr[1], min1 = arr[0], min2 = arr[1];
    
    for(int i = 2; i < n; i++) {
        if(arr[i] > max1) {
            max2 = max1;
            max1 = arr[i];
        } else if(arr[i] > max2) {
            max2 = arr[i];
        }
        
        if(arr[i] < min1) {
            min2 = min1;
            min1 = arr[i];
        } else if(arr[i] < min2) {
            min2 = arr[i];
        }
    }
    
    return (max1 * max2 > min1 * min2) ? max1 * max2 : min1 * min2;
}

int main() {
    int n;
    printf("Enter number of elements: ");
    scanf("%d", &n); // Scanning the number of elements
    
    int arr[n];
    printf("Enter %d elements: ", n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &arr[i]); // Scanning the elements of the array
    }

    printf("Largest product: %d\n", largestProduct(arr, n));
    return 0;
}

Problem 3: Write a program that reverses the words in a given sentence. The characters within each word should retain their order, but the words themselves should appear in reverse order. Handle edge cases like empty strings or strings with only one word. Ensure that multiple spaces between words are reduced to a single space.

Test Cases

Input: Hello World

Output: olleH dlroW

Input: Wipro

Output: orpiW

#include <stdio.h>
#include <string.h>

void reverseWords(char* str) {
    int length = strlen(str);
    int start = 0, end = 0;
    
    while (end <= length) {
        if (str[end] == ' ' || str[end] == '\0') {
            int tempStart = start, tempEnd = end - 1;
            while (tempStart < tempEnd) {
char temp = str[tempStart];
                str[tempStart] = str[tempEnd];
                str[tempEnd] = temp;
                tempStart++;
                tempEnd--;
            }
            start = end + 1;
        }
        end++;
    }
}

int main() {
    char str[1000];
    printf("Enter a sentence: ");
    fgets(str, sizeof(str), stdin);
    str[strcspn(str, "\n")] = '\0';  // Remove the newline character

    reverseWords(str);
    printf("Reversed Words: %s\n", str);
    return 0;
}

Problem 4: Given an unsorted array of integers, write a program to find the second largest element in the array. If there is no second-largest element (such as when all elements are equal), the program should return an appropriate message indicating the absence of a second-largest number.

Test Cases

Input: n = 5, arr[] = 10 20 4 45 99

Output: 45

Input: n = 5, arr[] = 1 1 1 1

Output: No second largest element

#include <stdio.h>

int secondLargest(int arr[], int n) {
    if(n < 2) return -1;
    int largest = arr[0], secondLargest = -1;
    for(int i = 1; i < n; i++) {
    if(arr[i] > largest) {
            secondLargest = largest;
            largest = arr[i];
        } else if(arr[i] > secondLargest && arr[i] != largest) {
            secondLargest = arr[i];
        }
    }
    return secondLargest;
}

int main() {
    int n;
    printf("Enter number of elements: ");
    scanf("%d", &n);

    int arr[n];
    printf("Enter %d elements: ", n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    int result = secondLargest(arr, n);
    if (result == -1)
        printf("No second largest element\n");
    else
        printf("Second largest: %d\n", result);

    return 0;
}

Problem 5: You are given a sorted array of integers. Write a function to remove duplicates from the array, ensuring that the remaining elements are placed in the original positions of the array. The function should return the new length of the array after removing duplicates. The array should be modified in place.

Test Cases

Input: n = 6, arr[] = 1 1 2 3 3 4

Output: 4

Input: n = 4, arr[] = 0 0 0 0

Output: 1

#include <stdio.h>

int removeDuplicates(int arr[], int n) {
    if(n == 0) return 0;
    int j = 0;
    for(int i = 1; i < n; i++) {
        if(arr[i] != arr[j]) {
            j++;
            arr[j] = arr[i];
        }
    }
    return j + 1;
}

int main() {
    int n;
    printf("Enter number of elements: ");
    scanf("%d", &n);

    int arr[n];
    printf("Enter %d elements: ", n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    int newLength = removeDuplicates(arr, n);
    printf("New length: %d\n", newLength);
    return 0;
}

Advanced Level Wipro Coding Question & Answers

As you advance in your preparation for Wipro coding questions, you’ll encounter more complex problems. Some examples of advanced-level Wipro coding questions include:

Problem 6: Write a program that takes two arrays of integers and finds their intersection. The intersection should contain unique elements that are common in both arrays. You may assume that each element in the arrays is unique. Return the result as a new array, maintaining the order of elements in the first array.

Test Cases

Input: n1 = 4 arr1[] = 1 2 3 4, n2 = 4, arr2[] = 3 4 5 6

Output: 3 4

Input: n1= 3, arr1[] = 1 2 3, n2 = 3, arr2[] = 4 5 6

Output: []

#include <stdio.h>

void intersection(int arr1[], int n1, int arr2[], int n2) {
    for(int i = 0; i < n1; i++) {
        for(int j = 0; j < n2; j++) {
            if(arr1[i] == arr2[j]) {
                printf("%d ", arr1[i]);
                break;
            }
        }
    }
}

int main() {
    int n1, n2;
    printf("Enter number of elements in first array: ");
    scanf("%d", &n1);
    int arr1[n1];
    printf("Enter %d elements for first array: ", n1);
    for(int i = 0; i < n1; i++) {
        scanf("%d", &arr1[i]);
    }

    printf("Enter number of elements in second array: ");
    scanf("%d", &n2);
    int arr2[n2];
    printf("Enter %d elements for second array: ", n2);
    for(int i = 0; i < n2; i++) {
        scanf("%d", &arr2[i]);
    }

    printf("Intersection: ");
    intersection(arr1, n1, arr2, n2);
    return 0;
}

Problem 7: Given an array of integers, write a program that rotates the array to the right by a given number of positions 'k'. The program should handle cases where 'k' is greater than the length of the array by rotating the array multiple times if necessary. Ensure that the array is rotated in-place.

Test Cases

Input: N = 5, arr[] = 1 2 3 4 5, k = 2

Output: 4 5 1 2 3

Input: N = 3, arr[] = 1 2 3, k = 1

Output: 3 1 2

#include <stdio.h>

void rotate(int arr[], int n, int k) {
    k = k % n;  // Handle cases where k > n
    int temp[k];
    
    for(int i = 0; i < k; i++) {
        temp[i] = arr[n - k + i];
    }
    
    for(int i = n - 1; i >= k; i--) {
        arr[i] = arr[i - k];
    }
    
    for(int i = 0; i < k; i++) {
        arr[i] = temp[i];
    }
}

int main() {
    int n, k;
    printf("Enter number of elements: ");
    scanf("%d", &n);
    
    int arr[n];
    printf("Enter %d elements: ", n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
printf("Enter number of positions to rotate: ");
    scanf("%d", &k);

    rotate(arr, n, k);
    
    printf("Array after rotation: ");
    for(int i = 0; i < n; i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
    return 0;
}

Problem 8: Write a program to find the longest substring in a given string without repeating characters. The program should return the length of the longest substring as well as the substring itself. Handle edge cases like an empty string or a string with all repeating characters.

Test Cases

Input: abcabcbb

Output: abc, Length: 3

Input: bbbbb

Output: b, Length: 1

#include <stdio.h>
#include <string.h>

void longestSubstring(char *s) {
    int n = strlen(s);
    int max_len = 0, start = 0;
    int char_index[256] = {0}; // For storing the index of characters
    
    for (int end = 0; end < n; end++) {
        if (char_index[s[end]] > start) {
            start = char_index[s[end]];
        }
        char_index[s[end]] = end + 1;
        
        int len = end - start + 1;
        if (len > max_len) {
 max_len = len;
        }
    }
    
    // Printing the length and substring
    printf("Length: %d\n", max_len);
    for (int i = start; i < start + max_len; i++) {
        printf("%c", s[i]);
    }
    printf("\n");
}

int main() {
    char s[100];
    printf("Enter a string: ");
    scanf("%s", s);
    
    longestSubstring(s);
    return 0;
}

Problem 9: Write a program to check if a given number is a palindrome. A palindrome number reads the same backward as forward. The program should return true if the number is a palindrome and false if it is not. Handle both positive and negative numbers.

Test Cases

Input: 121

Output: Palindrome

Input: 123

Output: Not a palindrome

#include <stdio.h>

int isPalindrome(int num) {
    int original = num, reversed = 0, remainder;
    if (num < 0) return 0; // Negative numbers are not palindrome

    while (num != 0) {
        remainder = num % 10;
        reversed = reversed * 10 + remainder;
num /= 10;
    }

    return original == reversed;
}

int main() {
    int num;
    printf("Enter a number: ");
    scanf("%d", &num);
    
    if (isPalindrome(num)) {
        printf("Palindrome\n");
    } else {
        printf("Not a palindrome\n");
    }
    return 0;
}
₹ 49,000
strip
₹ 33,000
/-
Karthik was able to transform his career from a boring job to an exciting job in software!
Talk to a career expert
intensive student
emoji

Problem 10: Write a program to calculate the factorial of a given number using recursion. The program should handle numbers of different sizes and return the factorial value as an integer. If the number is 0, the program should return 1 as the factorial of 0 is defined to be 1.

Test Cases

Input: 5

Output: 120

Input: 7

Output: 5040

#include <stdio.h>

long long factorial(int n) {
    if (n == 0) return 1;
    return n * factorial(n - 1);
}

int main() {
    int num;
    printf("Enter a number: ");
    scanf("%d", &num);
    
    printf("%lld\n", factorial(num));
    return 0;
}

Problem 11: You are given a 2D array representing a matrix of integers. Write a program to calculate the sum of all the elements in the matrix. Handle cases where the matrix is empty or contains only one row/column.

Test Cases

Input: n1 = 2,  arr1[] = 1 2, n2 = 2, arr2[] = 3 4

Output: 10

Input: n1 = 2,  arr1[] = 1 1, n2 = 2, arr2[] = 1 1

Output: 4

#include <stdio.h>

int sumMatrix(int rows, int cols, int matrix[rows][cols]) {
    int sum = 0;
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            sum += matrix[i][j];
        }
    }
    return sum;
}

int main() {
    int rows, cols;
    printf("Enter number of rows and columns: ");
    scanf("%d %d", &rows, &cols);

    int matrix[rows][cols];
    printf("Enter the matrix elements:\n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }
printf("Sum of matrix elements: %d\n", sumMatrix(rows, cols, matrix));
    return 0;
}

Problem 12: Write a program to print all the prime numbers up to a given number 'n'. The program should check each number from 2 to n to see if it is prime and print it. A prime number is a number greater than 1 that has no divisors other than 1 and itself.

Test Cases

Input: 10

Output: 2 3 5 7

Input: 5

Output: 2 3 5

#include <stdio.h>
#include <stdbool.h>

bool isPrime(int num) {
    if (num <= 1) return false;
    for (int i = 2; i * i <= num; i++) {
        if (num % i == 0) return false;
    }
    return true;
}

int main() {
    int n;
    printf("Enter a number: ");
    scanf("%d", &n);
    
    printf("Prime numbers up to %d: ", n);
    for (int i = 2; i <= n; i++) {
        if (isPrime(i)) {
            printf("%d ", i);
        }
    }
    printf("\n");
    return 0;
}

Problem 13: Given a sequence of numbers from 1 to N, write a program to find the missing number in the sequence. The sequence may have one missing number, and you are expected to return that number. If no number is missing, the program should return a message indicating that the sequence is complete.

Test Cases

Input: N = 5, arr[] = 1 2 4 5

Output: 3

Input: N = 4, arr[] = 2 3 4

Output: 1

#include <stdio.h>

int findMissing(int arr[], int n) {
    int sum = n * (n + 1) / 2;
    for (int i = 0; i < n - 1; i++) {
        sum -= arr[i];
    }
    return sum;
}

int main() {
    int n;
    printf("Enter the value of N: ");
    scanf("%d", &n);

    int arr[n - 1];
    printf("Enter the sequence: ");
    for (int i = 0; i < n - 1; i++) {
        scanf("%d", &arr[i]);
    }

    int missing = findMissing(arr, n);
    printf("Missing number: %d\n", missing);
    return 0;
}

Problem 14:  Write a program to count the number of vowels in a given string. Consider the characters 'a', 'e', 'i', 'o', and 'u' as vowels. The program should be case-insensitive and should return the total count of vowels in the input string.

Test Cases

Input: HelloWorld

Output: 3

Input: Wipro

Output: 2

#include <stdio.h>
#include <ctype.h>

int countVowels(char *str) {
    int count = 0;
    while (*str) {
        if (strchr("aeiouAEIOU", *str)) {
            count++;
        }
        str++;
    }
    return count;
}

int main() {
    char str[100];
    printf("Enter a string: ");
    scanf("%s", str);
    
    printf("Number of vowels: %d\n", countVowels(str));
    return 0;
}

Problem 15: Write a program to find the first non-repeating character in a string. The program should return the first character that does not repeat. If all characters repeat, it should return a message indicating no non-repeating character was found.

Test Cases

Input: swiss

Output: w

Input: ccbp

Output: b

#include <stdio.h>
#include <string.h>

char firstNonRepeating(char *str) {
    int freq[256] = {0};
    
    for (int i = 0; str[i] != '\0'; i++) {
        freq[str[i]]++;
    }

    for (int i = 0; str[i] != '\0'; i++) {
        if (freq[str[i]] == 1) {
            return str[i];
        }
    }
    return '\0'; // No non-repeating character found
}

int main() {
    char str[100];
    printf("Enter a string: ");
    scanf("%s", str);
    
    char result = firstNonRepeating(str);
    if (result) {
        printf("First non-repeating character: %c\n", result);
    } else {
        printf("No non-repeating character found\n");
    }
    return 0;
}

Top Wipro Coding Questions for 2025

The types of questions asked at Wipro coding assessments can be tricky but mostly it contains the logic of these questions. Based on recent trends, here are some of the popular programming concepts you can expect to face are:

1. Arrays

  • Using two numbers in an array, find the value that sums up the target value.
  • Given an array of n-1 integers in the range 1 to n, find the missing number.
  • Merge two sorted arrays into one sorted array.
  • Maximum Subarray Sum (Kadane's Algorithm).
  • Find the contiguous subarray with the largest sum.

2. Strings

  • Find out whether a given string is a palindrome.
  • Reverse the words in a sentence but not the individual words.
  • Check if the two strings are anagrams of each other.
  • Implement a function to compress a string by counting repeated characters.
  • Longest Substring Without Repeating Characters.
  • Calculate the length of the longest substring without repeating characters.

3. Linked Lists

  • Reverse a singly linked list in place.
  • Use Floyd’s Cycle-Finding algorithm (Tortoise and Hare) to detect a cycle.
  • Create a sorted linked list by merging two singly linked lists.
  • Use the slow and fast pointer approach to find the middle element.
  • Given a linked list with a random pointer, flatten it into a single-level list.

4. Stacks and Queues

  • Implement a stack using two queues.
  • Check if the parentheses in a string are balanced.
  • Reverse the elements of a stack using recursion.
  • Implement a queue using two stacks.
  • Find the next greater element using a stack for each element in the array.

5. Sorting and Searching

  • Implement binary search on a sorted array to find an element.
  • Implement merge sort and analyze its time complexity.
  • Implement quick sort and analyze its time complexity.
  • Find the kth largest element in an array.
  • Find Missing Number in a Sorted Array
  • Find the missing element in a sorted array where elements are missing in a sequence.

6. Dynamic Programming

  • Implement Fibonacci using both recursion and dynamic programming.
  • Given a set of items with weights and values, find the maximum value you can carry in a knapsack of a fixed weight.
  • Find the longest common subsequence between two strings.
  • Find the minimum number of coins needed to make a given amount using dynamic programming.
  • Find the optimal way to multiply a sequence of matrices.

7. Recursion

  • Solve the Tower of Hanoi problem using recursion.
  • Find all permutations of a given string.
  • Given a set of numbers, find all possible subsets.
  • Given a set of numbers and a target, find all unique combinations that sum up to the target.
  • Solve the N-Queens problem using backtracking.

8. Graphs

  • Implement DFS traversal for a graph.
  • Implement BFS traversal for a graph.
  • Use DFS to detect a cycle in a directed graph.
  • Apply topological sorting to a Directed Acyclic Graph (DAG).
  • Find out the shortest path of the graph from a source vertex to all other vertices.

Wipro Coding Round Tips

To ace the Wipro coding interview questions, here are some essential tips:

  • Before jumping into coding, take time to understand the problem statement. Break it down and plan your approach.
  • Solving competitive programming regularly is crucial.
  • Use platforms like LeetCode, HackerRank, and Codechef to practice regularly.
  • Try to crack the logic of the question using pen and paper. 
  • Don’t just focus on writing correct code; ensure your solution is efficient in terms of time and space complexity.
  • Always debug your code during the interview. Sometimes, minor mistakes can make a solution fail, so practice debugging as well.

Conclusion

In conclusion, Wipro coding questions are a critical part of the selection process and are designed to test your programming and problem-solving abilities. By focusing on mastering coding questions for Wipro, practicing across different difficulty levels, and understanding the concepts in-depth, you can significantly increase your chances of success. Remember to focus on fundamental concepts but also be ready for advanced topics as you progress.

₹ 49,000
strip
₹ 33,000
/-
Karthik was able to transform his career from a boring job to an exciting job in software!
Talk to a career expert
intensive student
emoji

Frequently Asked Questions

1. How can I prepare for the Wipro coding assessment?

To prepare for Wipro coding test questions, practice problems on coding platforms, study data structures and algorithms, and review previous years' Wipro milestone coding questions.

2. Are there different coding questions for different Wipro hiring programs?

Yes, there are specific Wipro coding questions for different hiring programs like Wipro NLTH coding questions, Wipro elite National Talent Hunt coding questions, and Wipro milestone 1 coding questions.

Read More Articles

Chat with us
Chat with us
Talk to career expert