IBM Recruitment Exam - Coding Questions

   

IBM is one of the top companies and leading recruiters. It is soon going to visit your campus for recruitments for the year 2018. So, if you're wondering how to get through the recruitment and bag the job from IBM, here we are to guide you through. In this blog, we've discussed the sample questions on coding which are likely to be asked in IBM recruitment.  

Take Free IBM Recruitment Mock Test

1. Write a program to find HCF of two numbers by without using recursion.

Input format:

The first line contains any 2 positive numbers separated by space.

Output format:

Print the HCF of given two numbers.

Sample Input:

70 15

Sample Output:

5

Sample Questions  Answer 
Solution code 

#include<stdio.h>

int gcd(int,int);

int main()

{

    int m,n,ans;

scanf("%d",&m);

    scanf("%d",&n);

    while(m!=n)

    {

        if(m>n)

 

        {

            m=m-n;

        }

        else

        {

            n=n-m;

        }

    }

    printf("%d",m);

    return 0;

}

Solution Explanation

int m,n;  //declare required variables

scanf("%d",&m); //scan the inputs

scanf("%d",&n);

while(m!=n) //check the condition

{

    if(m>n)  //if it is satisfied

 

    {

        m=m-n;  //update m value

    }

    else

    {

        n=n-m; //otherwise n value

    }

}

printf("%d",m);  //print it

2. Write a C program to find the sum of A.P(Arithmetic Progression ) series

Input Format:

• The first line contains the first term of the A.P series.

• The second line contains a total number of terms in  A.P series

• The third line contains the common difference of A.P series.

Output Format:

• Sum of the A.P series.

Sample Input:

1

5

2

Sample Output:

25

3. Write a program to calculate the standard deviation.

Input format:

N(Number of Integers)

N Integers

Output format:

The standard deviation of the given integer.

sample input:

10

1 2 3 4 5 6 7 8 9 10

Sample output:

2.87

If you want to practice more such programming tasks and find the solution of the above-mentioned questions then check out Conduira Online's Programming Hub that contains 200+ similar programming tasks with a varying level of difficulty. 

 3 IBM Mock Tests - 200+ Programming Tasks

Check Other Blogs on IBM Recruitment

IBM Eligibility Criteria 

IBM Quantitative Aptitude Questions

IBM Reasoning Questions

IBM Verbal Ability Questions 

Read 147 times Last modified on Wednesday, 26 September 2018 20:22
Login to post comments

Vocabprep Banner

Please key in your e-mail address.

Be up-to-date with the happenings at Conduira!