Today we will discuss Wipro Coding Questions with answers and also Wipro Programming Questions. But, before discussing the questions we will make you know about Wipro Company. So,

Table of Contents

## What is Wipro?

Wipro Limited is an Indian International Corporation that provides consulting, Information Technology, and some Business services to their clients. Wipro is also called one of the MNC giants of India and headquartered in Bangalore, Karnataka. The Wipro was founded by Mohamed Premji on 29th December 1945. It is one of the top recruiters in India

## Wipro Coding Questions

Wipro NLTH is expected to be held in the month of September 2023 (Tentative). After searching a lot on Google for Wipro Coding Questions with answers Finally, you come here. If you’ve aspired to get your dream job in Wipro then you should be prepared to crack the Wipro exam. You’re at the right place, here we will discuss the exam patterns and the previous year’s repeated questions with solutions.

## Wipro Coding Test Pattern

Wipro Coding Questions is one of the important processes of Wipro off-campus and on-campus selections. Mainly 2 questions are asked in the exam in which 1st question is easy and the 2nd question is medium-difficult. Students have to code these two questions with the help of the given programming languages. The Languages which are supported are C, C++, Java, and Python. The time is given to the students to solve both the questions in only 60 minutes.

In this given period of time students have to solve one question completely or two questions with partial outputs. If most of the students have cleared all the two questions correctly then the final cut-off may vary or goes high.

Coding Questions | Wipro |

Time | 60 Minutes |

Number of Questions | 2 |

Coding Difficulty | Medium |

Adaptive Test | No |

Key Points You Need To Remember:

- You might need to add some necessary libraries if needed.
- Remember that do not modify the pre-defined main method.
- Sometimes you need to implement the functional signature which has been provided by the editor.
- Use only that function that is necessary to implement in the question.
- The signatures may be called other functions defined by you.

## Wipro Programming Questions Topic

Data Structure Concepts |

Arrays & Matrices |

Linked Lists |

Operations on Linked Lists |

Circular Linked Lists |

Doubly Linked Lists |

Trees |

Graphs |

Minimum Spanning Tree |

Shortest Path Algorithm |

Topological Sort |

String Processing and Manipulation |

Stacks & Queues |

Sorting & Searching |

Dynamic Programming |

Greedy Algorithms |

String Matching |

Divide & Conquer |

Disjoint Sets |

Computational Geometry |

Students who are appearing to this exam should have a minimum knowledge of programming languages such as C, C++, Java, and the Python language. If you are not well prepared for these Languages then read our C Tutorials and also practice the Programming question given in the Programming Sections.

## Wipro Coding Questions Analysis

After doing lots of research our team has prepared the chart which describes the probability of question types that should be asked in the Wipro exam. The chart is given below:

Answer Type | Probability of Being Asked | No of Ques Asked |
---|---|---|

Coding Pattern Questions | 50% | 1 |

Searching & sorting Questions | 20% | 1 |

HCF and GCD | 20% | 0-1 |

Others | 10% | 1 |

## Wipro Coding Questions

- Finding Prime Number
- Palindrome Program
- Finding Factorial
- Print Fibonacci Series
- Finding Leap Year
- LCM & GCD Of Two Numbers
- Removing Duplicates in Array
- Bubble Sort

## Wipro Coding Questions With Answers

Here are the questions which are asked previously in the Wipro Exams. Each question is described with its output. If you want to achieve your dream job in Wipro then be prepared with all the questions which can be asked in the exam.

**1. The digital machine generates the binary data which consists of strings of 0’s and 1’s. The maximum signal M, in the data, consists of a maximum number of either 1’s or 0’s appearing consecutively in the data but M can’t be at the beginning or end of the string. Design a way to find the length of the maximum signal?**

**Input:**

First line of inputs consist of the integer N, representing the length of the binary string. The second line consists of a string of length N which consist of 0’s and 1’s only.

**Output:**

Print the integer which represents the length of the maximum signal.

**Example:**

**Sample** **Input:** 6 101000 **Output:** 1

**Explanation:** For 101000, M can be 0 at the 2’nd index or at the 3’rd index so, in both the cases max length is 1.

**Program**:

//Learnprogramo #include <stdio.h> int main() { int size; scanf("%d",&size); char arr[size+1]; int max=0,count=0; int flag=0; for(int i=0;i<size;i++) { scanf("%s",&arr[i]); } for(int i=0;i<size;i++) { if(arr[i]=='1') { count++; flag=1; } else if(arr[i]=='0' && flag==1) { count=0; flag=0; } if(count>max) { max=count; } } printf("%d",max); return 0; }

Input:

Output:

**2. You are playing an online game. In the game list of the N numbers are given. The player has to arrange the numbers so that all the odd numbers of all the lists come after the even numbers. Write an algorithm to arrange an given list such that all the odd numbers of the list will come after the even numbers?**

**Input:**

The 1’st line of inputs consist of an integer num, representing the size of the list(n). The 2’nd line of the inputs consist of N space separated integers representing the values of the list.

**Output:**

print n space separated integers such that odd numbers will come after the even numbers in the list.

**Example:**

**Sample** **Input:** 8 10 93 3 33 12 22 21 11 **Output:** 10 98 12 22 3 33 21 11

**Explanation:** All the Odd numbers are placed after the even numbers.

**Program:**

//Learnprogramo #include<stdio.h> void swap(int *i, int *j) { int temp = *i; *i = *j; *j = temp; } int seperateEvenAndOdd(int arr[], int size) { int left = 0; int right = size - 1; while(left < right) { while(arr[left]%2 == 0 && left < right) { left++; } while(arr[right]%2 == 1 && left < right) { right--; } if(left < right) { swap(&arr[left], &arr[right]); left++; right--; } } } int main() { int arr_size; scanf("%d",&arr_size); int arr[arr_size]; for(int i=0;i<arr_size;i++) { scanf("%d",&arr[i]); } int i=0; seperateEvenAndOdd(arr,arr_size); for(i=0;i<arr_size;i++) printf("%d ",arr[i]); return 0; }

**Input:**

**Output:**

**3. Write a program to implement the bubble sort algorithm for sorting the elements of an array?**

**Input:**

In the 1’st line give the size of an array and the 2’nd line corresponds to the elements.

**Output:**

Print the given elements in an ascending order.

**Sample Input:** 5 2 1 4 3 **Output:** 1 2 3 4 5

**Explanation:** The number are sorted in the ascending order after processing the program which are 1 2 3 4 5.

**Program:**

//Learnprogramo #include <stdio.h> void bubbleSort(int arr[], int n) { int i, j, temp; for(i = 0; i < n; i++) { for(j = 0; j < n-i-1; j++) { if( arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } } int main() { int arr[100], i, n, step, temp; scanf("%d", &n); for(i = 0; i < n; i++) { scanf("%d", &arr[i]); } bubbleSort(arr, n); for(i = 0; i < n; i++) { printf("%d ", arr[i]); } return 0; }

**Input:**

**Output:**

**4. Josh went to the market to buy N apples. He found two shops, shop A and B, where apples were being sold in lots. He can buy any number of the complete lot(s) but not lose apples. Now he is confused with the price and wants you to figure out the minimum cost to buy exactly N apples. Write an algorithm for Josh to calculate the minimum cost to buy exactly N apples**?

**Input:**

The 1’st line of the input consists of an integer – N, representing the total number of apples that Josh wants to buy. The 2’nd line consists of two space-separated positive integers – M1 and P1, representing the number of apples in a lot and the lot’s price at shop A, respectively. And the 3’rd line consists of two space-separated positive integers-M2 and P2, representing the number of apples in a lot’s price at shop B, respectively.

**Output:**

The positive integer representing the minimum price at which Josh will able to buy an apples.

**Sample Input:** 19 3 10 4 15 **Output:** 65

**Program:**

//Learnprogramo #include <stdio.h> int main() { int n, m1, p1, m2, p2; scanf("%d", &n); scanf("%d", &m1); scanf("%d", &p1); scanf("%d", &m2); scanf("%d", &p2); int min_cost = -1; for (int i=0; m1*i <= n; i++) { int count2 = n - i*m1; if (count2%m2 == 0) { int cost = p1 * i + p2 * (count2/m2); min_cost = (cost < min_cost || min_cost == -1) ? cost : min_cost; } } if (min_cost != -1) printf("%d\n", min_cost); else printf("Invalid inputs\n"); }

**Input:**

**Output:**

**5. Alex works at a clothing store. There is a large pile of socks that must be paired by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are?**

**For example:** There are **n=7** socks with colors **arr= {1,2,1,2,1,3,2}**. There is one pair of color **1** and one of color **2**. There are three odd socks left, one of each color. The number of pairs is **2**.

**Description:** Complete the **sockMerchant** function in the editor below. It must return an integer representing the number of matching pairs of socks that are available. sockMerchant has the following parameter(s): **1.** **n:** the number of socks in the pile** 2. arr:** the colors of each sock.

**Input:**

The 1’st line contains n integer and the no of sock represented in arr. The 2’nd line contains n space-separated integers which describes the colors arr[i] of the socks in the pile.

**Constraints:**

1 <= n <= 100 1 <= arr[i] <= 100 & 0 <= i < n

**Output:**

Return the total no of matching pairs of socks that Allen can sell.

**Sample Input:** 9 10 20 20 10 10 30 50 10 20 **Output:** 3

**Explanation:** Alex can match 3 pairs of socks i.e **10-10, 10-10,** **20-20**. While the left out socks are **50, 60, 20**.

**Program:**

int sockMerchant(int n, int ar_count, int* ar) { int i, j, count; int pair = 0; int unique=0; int new_ar[n]; for(i=0; i<ar_count; i++) { count = 0; for(j=0;j<=i;j++) { if(ar[i]==ar[j]) { count++; } } if(count==1) { new_ar[unique] = ar[i]; unique++; } } for(i=0; i<unique; i++) { count = 0; for(j=0; j<ar_count; j++) { if(new_ar[i]==ar[j]) { count++; } } pair = pair + (count/2); } return pair; }

**6. Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike, he took exactly n steps. For every step he took, he noted if it was an uphill or a downhill step. Gary’s hikes start and end at sea level. We define the following terms: 1. A mountain is a non-empty sequence of consecutive steps above sea level, starting with a step up from sea level and ending with a step down to sea level. 2. A valley is a non-empty sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level. Given Gary’s sequence of up and down steps during his last hike, find and print the number of valleys he walked through?**

**Input:**

The 1’st line contains an integer, , denoting the number of steps in Gary’s hike. The 2’nd line contains a single string of characters. Each character belongs to {U, D} (where U indicates a step up and D indicates a step down), and the i(th) cin the string describes Gary’s i(th) step during the hike.

**Output:**

Print a single integer which denotes the no of valleys Garry walked through during his hike.

**Sample Input:** 8 UDDDUDUU **Output:** 1

//Learnprogramo #include <stdio.h> #include <string.h> int countingValley(long int steps, char *path) { long int i, level = 0, valley = 0; for(i=0; i<steps; i++) { if(path[i] == 'U') { level++; } else if(path[i] == 'D') { if(level == 0) { valley++; } level--; } } return valley; } int main() { long int steps; scanf("%li",&steps); char path[steps]; int i, result; for(i=0; i<steps; i++) { scanf("%c",&path[i]); } result = countingValley(steps, path); printf("%d",result); return 0; }

**Input:**

**Output:**

**7. Left rotation operation on the array shifts each element of an array to the left. For example, if 2 left rotations are done on array [1, 2, 3, 4, 5], after performing rotations the array will become [3, 4, 5, 1, 2]. Given an array of integers and the number, perform the left rotations on an array. And return the updated array to be printed as a single line of space-separated integers.**

**Function Description:**

Now complete the function rotLeft in the editor given below. It must return the resulting array of integers. The function rotLeft has the following parameters:

- An array of integers.
- a number of rotations and an integer.

**Input Format:**

Here, the first line contains two space-separated integers, the size and the number of left rotations that you’ve to perform. And the second line contains the space-separated integers a[i].

**Constraints:**

- 1 <=n <= 10^5
- 1 <=d <=n
- 1 <=a[i]<= 10^8

**Output Format:**

Now print a single line of space-separated integers denoting the final state of an array after performing d left rotations.

**Sample Input:**

5 4

1 2 3 4 5

**Sample Output:**

5 1 2 3 4

**Explanation:**

When we perform d=4 left rotations, the following sequence of changes is done on the array:

[1,2,3,4,5] -> [2,3,4,5,1] -> [3,4,5,1,2] -> [4,5,1,2,3] -> [5,1,2,3,4]

**Test Case 1:**

**Input:**

5 4

1 2 3 4 5

**Output:**

5 1 2 3 4

**Test Case 2:**

**Input:**

20 10

41 73 89 7 10 1 59 58 84 77 77 97 58 1 86 58 26 10 86 51

**Expected Output:**

77 97 58 1 86 58 26 10 86 51 41 73 89 7 10 1 59 58 84 77

//Learnprogramo #include <stdio.h> int rotLeft(int arr[], int n, int d) { int i, j; int first; for(i=0; i<d; i++) { first = arr[0]; for(j=0; j<n-1; j++) { arr[j] = arr[j+1]; } arr[j] = first; } return *arr; } int main() { int n, d, i; scanf("%d",&n); scanf("%d",&d); int list[n]; for(i=0; i<n; i++) { scanf("%d",&list[i]); } rotLeft(list, n, d); for(i=0; i<n; i++) { printf("%d ",list[i]); } }

#### 8. Write a C program to check if the given matrices are identical or not?

//Learnprogramo #include<stdio.h> #define N 4 int checkSame (int A[][N], int B[][N]) { int i, j; for (i = 0; i < N; i++) for (j = 0; j < N; j++) if (A[i][j] != B[i][j]) return 0; return 1; } int main () { int A[N][N] = { {1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4} }; int B[N][N] = { {1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4} }; if (checkSame (A, B)) printf ("Matrices are identical "); else printf ("Matrices are not identical"); return 0; }

9. The 2D array is given, Now print it in the spiral form. For reference see the following examples.

**Note:** Please comment down the code in other languages as well.

**Input:**

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

**Output:**

1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10

**Input:**

1 2 3 4 5 6

7 8 9 10 11 12

13 14 15 16 17 18

**Output:**

1 2 3 4 5 6 12 18 17 16 15 14 13 7 8 9 10 11

//Learnprogramo #include <stdio.h> #define R 3 #define C 6 void spiralPrint (int m, int n, int a[R][C]) { int i, k = 0, l = 0; while (k < m && l < n) { for (i = l; i < n; ++i) { printf ("%d ", a[k][i]); } k++; for (i = k; i < m; ++i) { printf ("%d ", a[i][n - 1]); } n--; if (k < m) { for (i = n - 1; i >= l; --i) { printf ("%d ", a[m - 1][i]); } m--; } if (l < n) { for (i = m - 1; i >= k; --i) { printf ("%d ", a[i][l]); } l++; } } } int main () { int a[R][C] = { {1, 2, 3, 4, 5, 6}, {7, 8, 9, 10, 11, 12}, {13, 14, 15, 16, 17, 18} }; spiralPrint (R, C, a); return 0; }

## Frequently Asked Questions

#### Q1. What are the Coding Questions asked in Wipro?

**Ans:** Mainly the questions on a palindrome, Sorting, Fibonacci Series, Leap year, etc are asked in Wipro. Students should solve these questions using C, C++, Java, and Python.

#### Q2. How can I prepare for Wipro?

**Ans:** If you want to land your dream job in Wipro then you should know the basics of the programming languages. You should practice the given question every day.

#### Q3. How can I clear my Wipro Online test?

**Ans:** The selection process kicks off with a 128-minute duration **Online Assessment** divided into 3 phases. The candidates will start off with an aptitude **test** on logical ability, quantitative ability, and verbal ability in a 48-minute duration.

#### Q4. Is there any negative marking in Wipro 2023?

**Ans:** No there is no negative marking in Wipro ExamLabs.

#### Q5. Which programming languages is used in Wipro?

**Ans:** Programming Languages such as C, C++, Java, and Python are used in The Wipro.

#### Q6. **How much time will be provided in the Wipro Elite NLTH Coding Programming Section?**

**Ans:** 60 Minutes will be provided to each student to solve a total of 2 questions.

#### Q7. What is the difficulty of the questions asked in the Wipro Exams?

**Ans:** The difficulty of 1st question is easy and the 2nd question is medium-difficult.

**Also, Read:**