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

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

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

 We have already discussed about some questions in the previous blog . Some of the frequently asked questions are :

_______________________________________________________________________________

 1. Find the maximum number in a given three number ?

  1. import java.util.Scanner;
  2.  
  3. class Largest
  4. {
  5.   public static void main(String args[])
  6.   {
  7.     int x, y, z;
  8.     System.out.println(“Enter three integers”);
  9.     Scanner in = new Scanner(System.in);
  10.  
  11.     x = in.nextInt();
  12.     y = in.nextInt();
  13.     z = in.nextInt();
  14.  
  15.     if (x > y && x > z)
  16.       System.out.println(“First number is largest.”);
  17.     else if (y > x && y > z)
  18.       System.out.println(“Second number is largest.”);
  19.     else if (z > x && z > y)
  20.       System.out.println(“Third number is largest.”);
  21.     else
  22.       System.out.println(“The numbers are not distinct.”);
  23.   }
  24. }

____________________________________________________________________

  2 . Write a program to get input until user gives q as a input and find the maximum number

  • print(“Start entering numbers”)
    sum=0
    c=0
    while 1:
        num=int(input())
        c=c+1
        sum=sum+num
        print(“Press q when you are done inputting the numbers or y to continue”)
        m=input()
        if m==’q’:
            break
        
    print(“Average”,sum/c)
    print(“Sum”,sum )

____________________________________________________________________________

 3.  Write a program to get three inputs such as first number, second number and operator.based on given operator then perform the corresponding arithmetic operation

(eg:if operator given is’+’ then perform (firstnumber+ secondnumber) )

#include <stdio.h>

#include <conio.h>

void main()

{

   int a, b, c;

   char ch;

   clrscr() ;

   printf(“Enter your operator(+, -, /, *, %)\n”);

   scanf(“%c”, &ch);

   printf(“Enter the values of a and b\n”);

   scanf(“%d%d”, &a, &b);

    switch(ch)

   {

      case ‘+’: c = a + b;

        printf(“addition of two numbers is %d”, c);

        break;

      case ‘-‘: c = a – b;

         printf(“substraction of two numbers is %d”, c);

         break;

      case ‘*’: c = a * b;

         printf(“multiplication of two numbers is %d”, c);

         break;

      case ‘/’: c = a / b;

         printf(“remainder of two numbers is %d”, c);

         break;

      case ‘%’: c = a % b;

         printf(“quotient of two numbers is %d”, c);

         break;

      default: printf(“Invalid operator”);

         break;

  }

   getch();

}

____________________________________________________________________

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

https://payilagam.com/blogs/qantler-technologies-fresher-interview-questions-with-answers-session-1/

https://www.programmingsimplified.com/java/source-code/java-program-largest-of-three-numbers

https://www.codesdope.com/discussion/take-integer-inputs-from-user-until-heshe-presses-/

https://studentboxoffice.in/jntuh/notes/computer-programming-lab/write-a-c-program-which-takes-two-integer-operands-and-one-operator-from-the-user-performs-the-operation-and-then-prints-the-result-consider-the-operator/98