QANTLER TECHNOLOGIES – Fresher Interview Questions with Answers – Session – 1

QANTLER TECHNOLOGIES – Fresher Interview Questions with Answers – Session – 1 

This blog explains about QANTLER TECHNOLOGIES – Fresher Interview Questions with Answers – Session – 1 . They are explained clearly below : 

             Some of the frequently asked questions are :

____________________________________________________________________

 1. Write a program to find the addition of digits ?

                                            Addition of digits

// A Simple C++ program to compute sum of digits in numbers from 1 to n

#include<bits/stdc++.h>

using namespace std;

 

int sumOfDigits(int );

 

// Returns sum of all digits in numbers from 1 to n

int sumOfDigitsFrom1ToN(int n)

{

    int result = 0; // initialize result

 

    // One by one compute sum of digits in every number from

    // 1 to n

    for (int x = 1; x <= n; x++)

        result += sumOfDigits(x);

 

    return result;

}

 

// A utility function to compute sum of digits in a

// given number x

int sumOfDigits(int x)

{

    int sum = 0;

    while (x != 0)

    {

        sum += x %10;

        x   = x /10;

    }

    return sum;

}

 

// Driver Program

int main()

{

    int n = 328;

    cout << “Sum of digits in numbers from 1 to ” << n << ” is “

         << sumOfDigitsFrom1ToN(n);

    return 0;

}

____________________________________________________________________

2. Write a program to find the addition of even digits ?

                                                 Addition of even digits

// C++ implementation to find sum of

// first n even numbers

#include <bits/stdc++.h>

 

using namespace std;

 

// function to find sum of

// first n even numbers

int evenSum(int n)

{

    int curr = 2, sum = 0;

 

    // sum of first n even numbers

    for (int i = 1; i <= n; i++) {

        sum += curr;

 

        // next even number

        curr += 2;

    }

 

    // required sum

    return sum;

}

 

// Driver program to test above

int main()

{

    int n = 20;

    cout << “Sum of first ” << n

         << ” Even numbers is: ” << evenSum(n);

    return 0;

}

______________________________________________________________________________

 

3 .  Write a program to Get mark 1 to mark 5 and create a method which has argument pass mark if mark 1 to mark 5 are greater than pass mark ,return true ,else return false

#include<stdio.h>
void main()
{
         int m1,m2,m3,total;
         float per;
         clrscr();
         printf("Enter 3 Nos.");
         scanf("%D%D%D",&m1,&m2,&m3);
         total=m1+m2+m3;
         per=total*100/300;
         if(per>=60&&per<=100)
                 printf("You are 1st :");
        else if(per>=50&&per<=60)
                 printf("You are 2nd");
        else if(per>=40&&per<=50)
                 printf("You are 3rd");
        else
                 printf("You are Fail");
        getch();
}

____________________________________________________________________

 REFERENCES :

https://www.geeksforgeeks.org/count-sum-of-digits-in-numbers-from-1-to-n/

https://www.geeksforgeeks.org/sum-first-n-even-numbers/

http://ecomputernotes.com/c-program/enter-the-student-marks-and-find-the-percentage-and-grade