Wipro Elite NLTH Coding Questions | PrepInsta

Wipro NLTH Coding Questions and Answer

Wipro NLTH Programming Test Questions and Answer are not like a general Coding Round Questions with Solutions it is all together different from C programming.

We have analyzed over 100+ Wipro NLTH Coding Questions. Below you will find Similar pattern based Wipro NLTH Coding Round Questions, Wipro NLTH Coding Questions that are asked constantly in Wipro NLTH Placement test. The languages that you can use in the test are –

 

  • C

  • C++

  • Java

  • Python

Mu Sigma Placement Papers
Total number of questions2 questions
Total Time Duration60 minutes
Type of TestAdaptive
Negative MarkingNo

WIPRO NLTH PROGRAMMING PREVIOUS YEAR  QUESTIONS AND ANSWERS

   Here are some questions that are asked in Wipro for –

  1. Wipro NLTH C Programming Questions for On Campus
  2. Wipro NLTH Java Programming Questions for On Campus
  3. Wipro NLTH C++ Programming Questions for On Campus

Free Material

  • Program to calculate the GCD of two numbers –  | C | C++ | Java | Python
  • Program to calculate the GCD of three numbers –  | C | C++ | Java | Python
  • Program to check if the given number is Prime or not –  | C | C++ | Java | Python
  • Program to Display the distinct elements of an array – | C | C++ | Java | Python
  • Program to Sort first half in ascending order and second half in descending order in an array – | C | C++ | Java | Python
  • Program for Matrix multiplication and finding transpose – | C | C++ | Java | Python
  • Program to Remove vowels from an input string – | C | C++ | Java | Python
  • Program to Print Sum of all Odd Numbers present in a larger number – | C | C++ | Java | Python
  • Program to Print the Transpose of a matrix – | C | C++ | Java | Python
  • Program to Display the largest element in each row in a 2-D Array – | C | C++ | Java | Python
  • Program to Check the balance of Parenthesis – | C | C++ | Java | Python
Mu Sigma Coding Placement Papers

Online Classes

  1. Free Paid Materials also given
  2. Click here to join Online Live Class

Wipro Paid Material –

In Online class you will get preparation paid materials access also, but if you just want materials then you can buy the ones below –

or

  1. Click here to join Online Live Class
Minutes
Seconds

Some Coding Questions for Practice

Question : 1

(asked in Wipro On Campus, Sastra University, Aug, 2019)

Problem: in this first line you are required to take the value of m and n as the number of rows and columns of matrix, then you are required to take the input elements of array.
As an output you are required to print the sum of each row then the row having the maximum sum.
Test Case :
Input : 3 3
1 2 3
4 5 6
7 8 9
Output :
Row 1 : 6
Row 2 : 15
Row 3 : 24
Row 3 is having the maximum sum : 24

#include <stdio.h>

int main()
{
int row, colm, i, j, temp, max = 1;
int mat[100][100];
int sum[100];
printf("enter the number of rows : ");
scanf("%d",&row);
printf("enter the number of columms : ");
scanf("%d",&colm);
for(i=0; i<row; i++)
{
for(j=0; j<colm; j++)
{
printf("enter [%d %d] element : ",i+1,j+1);
scanf("%d",&mat[i][j]);
}
}

for(i=0; i<row; i++)
{
sum[i] = 0;
for(j=0; j<colm; j++)
{
sum[i] = sum[i] + mat[i][j];
}
printf("\n");
}

for(i=0; i<row; i++)
{
printf("Row %d : %d\n",i+1,sum[i]);
}

for(i=0; i<row; i++)
{
if(sum[0]<sum[i+1])
{
temp = sum[0];
sum [0] = sum[i+1];
sum[i+1] = temp;
max = max+1;
}
}

printf("\nRow %d is having the maximum sum : %d",max,sum[0]);

return 0;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question : 2

(asked in Wipro On Campus, PESIT Bangalore, Oct, 2019)

Problem: You are required to count the number of words in a sentence.
You are required to pass all the test cases

Test Cases :
Test Case : 1
Input : welcome to the world
Output : 4

Test Case : 2
Input : [space] say hello
Output : 2

Test Case : 3
Input : To get pass you need to study hard [space] [space]
Output : 8

#include <stdio.h>
#include <string.h>
int main()
{
char a[100];
int i=0,count;

printf("Enter the string : ");
scanf("%[^\n]s",a);

if(a[0]==' ')
{
count = 0;
}
else
{
count = 1;
}

while(a[i]!='\0')
{
if(a[i]==' ' && a[i+1]!=' ' && a[i+1]!='\0')
{
count = count + 1;
}
i++;
}

printf("%d",count);
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question : 3

(asked in Wipro On Campus, VIT University, Aug, 2019)

Problem: First of all you need to input a whole sentence in the string, then you need to enter the target
word.
As an output you need to find the number of times that particular target word is repeated in the
sentence.

Test Cases :

Test Case : 1
Input : welcome world to the new world
world
Output : 2

Test Case : 2
Input : working hard and working smart both are different ways of working
working
Output : 3

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

int main()
{
char str[100];
char toSearch[100];
int count;
int i, j, found;
int stringLen, searchLen;

scanf("%[^\n]s",str);
scanf("%s",toSearch);

stringLen = strlen(str);
searchLen = strlen(toSearch);

count = 0;

for(i=0; i <= stringLen-searchLen; i++)
{
found = 1;
for(j=0; j<searchLen; j++)
{
if(str[i + j] != toSearch[j])
{
found = 0;
break;
}
}

if(found == 1)
{
count++;
}
}

printf("%d",count);

return 0;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question : 4

(asked in Wipro On Campus, MIET Meerut, Aug, 2019)

Problem Statement

You are required to implement the following function:
Int SumNumberDivisible(int m, int n);

The function accepts 2 positive integer ‘m’ and ‘n’ as its arguments.
You are required to calculate the sum of numbers divisible both by 3 and 5, between ‘m’ and ‘n’ both inclusive and return the same.

Note
0 < m <= n

Example
Input:
m : 12
n : 50
Output   90

Explanation:
The numbers divisible by both 3 and 5, between 12 and 50 both inclusive are
{15, 30, 45} and their sum is 90.

Sample Input

m : 100
n : 160

Sample Output

405

/* Programming Question */

#include <stdio.h>

int Calculate(int, int);

int main()
{
int m, n, result;

// Getting Input

printf("Enter the value of m : ");
scanf("%d",&m);
printf("Enter the value of n : ");
scanf("%d",&n);

result = Calculate(n,m);

// Getting Output

printf("%d",result);

return 0;
}

/* Write your code below . . . */

int Calculate(int n, int m)
{
// Write your code here

int i, sum = 0;
for(i=m;i<=n;i++)
{
if((i%3==0)&&(i%5==0))
{
sum = sum + i;
}
}

return sum;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question : 5

(asked in Wipro On Campus, Galgotia University Noida, Aug, 2019)

Input
The first line of input consists of three space separated integers. Num, start and end representing the size of list [N], the starting value of the range and the ending value of the range respectively.
The second line of input consists N space separated integers representing the distances of the employee from the company.

Output
Print space separated integers representing the ID’s of the employee whose distance liew within the given range else return -1.

Example
Input
6 30 50
29 38 12 48 39 55

Output
1 3 4

Explanation :
There are 3 employees with id 1, 3, 4 whose distance from the office lies within the given range.

#include <stdio.h>

int main()
{
int start, end, a[50], num, i, flag;

scanf("%d %d %d",&num,&start,&end);

for(i=0; i<num; i++)
{
scanf("%d",&a[i]);
}

for(i=0;i<num;i++)
{
if(a[i]>start && a[i]<end)
{
flag = 1;
}
else
{
flag = -1;
}

if(flag == 1)
{
printf("%d ",i);
}
}
return 0;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question : 6

(asked in Wipro On Campus, IIIT Hyderabad, Aug, 2019)

Write a code for the following functions
Function 1 : sortArray
It’s function is to sort the passed array with a particular length, there are 2 parameters passed into it first is the length of array and next is the elements of list.
Function 2 : findMaxElement
It’s function is to get the 2 array with their own particular elements and length, and find the maximum element from both the array and print it.

Input
12
2 5 1 3 9 8 4 6 5 2 3 11
11
11 13 2 4 15 17 67 44 2 100 23

Output
100

#include <stdio.h>

int* sortArray(int len, int* arr)
{
int i=0, j=0, temp = 0;
for(i=0; i<len; i++)
{
for(j=i+1; j<len; j++)
{
if(arr[i]>arr[j])
{
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}

int findMaxElement(int len1, int* arr1, int len2, int* arr2)
{
sortArray(len1, arr1);
sortArray(len2, arr2);
if(arr1[len1-1]>arr2[len2-1])
return arr1[len1-1];
else
return arr2[len2-1];
}


int main()
{
int len1, len2, arr1[20], arr2[20], i;
int ans;

scanf("%d",&len1);

for(i=0; i<len1; i++)
{
scanf("%d",&arr1[i]);
}

scanf("%d",&len2);

for(i=0; i<len2; i++)
{
scanf("%d",&arr2[i]);
}

ans = findMaxElement(len1, arr1, len2, arr2);

printf("%d",ans);

return 0;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question 7

(asked in Wipro On Campus, HBTI Kanpur, Sep, 2019)

Problem: you are given a number, and you have to extract the key by finding the difference between the sum of the even and odd numbers of the input.

Test Case :

Input : 24319587

Output :  11

Explanation : odd terms : 3 + 1 + 9 + 5 + 7 = 25

                              even terms : 2 + 4 + 8 = 14

                              output : 11 (25-14)

/* Program to find key */

#include <stdio.h>

int main()
{
int n;
int r, odd=0, even=0, key;

scanf("%d",&n);

while(n!=0)
{
r = n%10;
if(r%2==0)
{
even = even + r;
}
else
{
odd = odd + r;
}
n = n/10;
}

if(odd>even)
{
key = odd - even;
}
else
{
key = even - odd;
}

printf("%d",key);
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question 8

(asked in Wipro NLTH 2019)

Problem:  in this first line you are required to take the value of m and n as the number of rows and columns of matrix, then you are required to take the input elements of array.

As an output you are required to print the sum of each row then the row having the maximum sum.

Test Case :

Input : 3 3

               1 2 3

               4 5 6

               7 8 9

Output :  

               Row 1 : 6
               Row 2 : 15
               Row 3 : 24

               Row 3 is having the maximum sum : 24

#include <stdio.h>

int main()
{
int m, n, i, j, temp, max = 1;
int mat[100][100];
int sum[100];
scanf("%d %d",&m, &n);
for(i=0; i<m; i++)
{
for(j=0; j<n; j++)
{
scanf("%d",&mat[i][j]);
}
}

for(i=0; i<m; i++)
{
sum[i] = 0;
for(j=0; j<n; j++)
{
sum[i] = sum[i] + mat[i][j];
}
printf("\n");
}

for(i=0; i<m; i++)
{
printf("Row %d : %d\n",i+1,sum[i]);
}

for(i=0; i<m; i++)
{
if(sum[0]<sum[i+1])
{
temp = sum[0];
sum [0] = sum[i+1];
sum[i+1] = temp;
max = max+1;
}
}

printf("\nRow %d is having the maximum sum : %d",max,sum[0]);

return 0;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question 9

(asked in Wipro NLTH 2019)

Problem:  in this first line you are required to take the input that set the number of elements to be inserted, the next line takes the elements as input.

You are required to print the sum of maximum and minimum element of the list

Test Case :

Input : 6

               55 87 46 21 34 79

Output :  

               108 

Explanation : 

               21 + 87 = 108

#include <stdio.h>

int main()
{
int a[100];
int n, sum, temp;
int i, j;

scanf("%d",&n);

for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}

for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(a[i]>a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}

sum = a[0]+a[n-1];

printf("%d",sum);

return 0;
}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Question 10

(asked in Wipro NLTH 2019)

Problem:  in this first line you are required to take the input of an integer number, and in the second line you are required to input the target element 

You are required to print the number of time target element occured in the integer

Test Case :

Input : 734139

               3

Output :  

               2 

Explanation : 

               3 occured 2 times in the integer.

#include <stdio.h>

int main()
{
int num, target, count = 0, r;

scanf("%d",&num);
scanf("%d",&target);

while(num!=0)
{
r = num%10;
if(r==target)
{
count = count + 1;
}
num = num/10;
}

printf("%d",count);

}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

Summary
Review Date
Reviewed Item
Wipro NLTH Coding Ability 2020
Author Rating
51star1star1star1star1star

Please Login/Signup to comment

21 comments on “Wipro Elite NLTH Coding Questions | PrepInsta”


  • Amit

    Simple Code For Problem 9 in C++
    #include
    #include
    using namespace std;

    int main(){
    int arr[] = { 55, 87, 46, 21, 34, 79 };
    int n = sizeof(arr) / sizeof(arr[0]);
    int res=0;
    sort(arr,arr+n);
    res+=arr[0];
    sort(arr, arr+n, greater());
    res+=arr[0];
    cout<<res<<endl;

    }


    • Amit

      #include
      #include
      using namespace std;

      int main(){
      int arr[] = { 12, 1234, 45, 67, 1 };
      int n = sizeof(arr) / sizeof(arr[0]);
      int res=0;
      sort(arr,arr+n);
      res+=arr[0];
      sort(arr, arr+n, greater());
      res+=arr[0];
      cout<<res<<endl;

      }


  • Rajat Tyagi

    Thank you sir, Question 10 and question 7 on this page were repeated in my exam as is. Here is the code that i wrote

    //For Question 10,can this be the soln.
    #include
    using namespace std;

    int main()
    {
    int rem,num,count=0,t;
    scanf(“%d”,&num);
    scanf(“%d”,&t);
    while(num > 0)
    {
    rem=num%10;
    if(rem == t)
    {
    count++;
    }
    num=num/10;
    }
    printf(“%d”,count);
    return 0;
    }


  • Rajat Tyagi

    //Above written is the c++ code for question 7
    #include
    using namespace std;

    int main()
    {
    int rem,num,se=0,so=0,s=0;
    scanf(“%d”,&num);
    while(num > 0)
    {
    rem=num%10;
    if(rem%2 == 0)
    {
    se = se+rem;
    }
    else
    {
    so = so+rem;
    }
    num=num/10;
    }
    if(se > so)
    {
    s=se-so;
    }
    else
    {
    s=so-se;
    }
    //printf(se)
    //printf(so)
    printf(“%d”,s);
    return 0;
    }


  • Rajat Tyagi

    //Above written is the c++ code for question 7
    #include
    using namespace std;
    int main()
    {
    int rem,num,se=0,so=0,s=0;
    scanf(“%d”,&num);
    while(num > 0)
    {
    rem=num%10;
    if(rem%2 == 0)
    {
    se = se+rem;
    }
    else
    {
    so = so+rem;
    }
    num=num/10;
    }
    if(se > so)
    {
    s=se-so;
    }
    else
    {
    s=so-se;
    }
    //printf(se)
    //printf(so)
    printf(“%d”,s);
    return 0;
    }


  • Sachin Singh

    #include
    #include
    using namespace std;

    int main()
    {
    int mat[100][100],row,f,column,max,sum[10],z=0;
    cout<<"enter the number of row and column"<>row;
    cin>>column;
    for(int i=0;i<row;i++)
    {
    for(int j=0;j>mat[i][j];
    }
    }
    for(int i=0;i<row;i++)
    {
    sum[z]=0;
    for(int j=0;j<column;j++)
    {

    sum[z]=sum[z]+mat[i][j];

    }
    z++;
    }
    cout<<"sum array"<<endl;
    for(int i=0;i<z;i++)
    {
    cout<<sum[i]<<endl;
    }
    f=sum[0];
    for(int i=0;if)
    {
    f=sum[i];
    }

    }
    cout<<"maximum"<<f<<endl;
    return 0;
    }