My First interview in Suave Technologies as Fresher

It was the first interview I attended as a Java Developer. I had some fear inside me before attending the interview, but after it, I felt much better. Success or failure doesn't matter — what matters is that we give our best effort. 1.The first round was about choosing the correct output. 2.The second round was focused on coding. I was asked to solve a programming problem as part of this round. Write a Java program that: Accepts three inputs from the user using the Scanner class: start: the starting index for Fibonacci series end: the ending index for Fibonacci series limit: the number to compare the final sum with Generates Fibonacci numbers from the start to end index (inclusive). From these Fibonacci numbers: Find which numbers are prime. Calculate the sum of all these prime Fibonacci numbers. Finally: If the sum is less than the limit, print "NO". package pratice; import java.util.Scanner; public class fabonacci_series { static int total = 0; // Make total a static class variable public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter start value:"); int start = sc.nextInt(); System.out.println("Enter end value:"); int end = sc.nextInt(); System.out.println("Enter limit value:"); int limit = sc.nextInt(); findficser(start, limit, end); if (total < limit) { System.out.println("no"); } else { System.out.println("yes"); } sc.close(); } private static void findficser(int start, int limit, int end) { int x = 1; int y = 0; int z = 0; for (int i = 0; i = start && i

Apr 12, 2025 - 17:40
 0
My First interview in Suave Technologies as Fresher

It was the first interview I attended as a Java Developer. I had some fear inside me before attending the interview, but after it, I felt much better. Success or failure doesn't matter — what matters is that we give our best effort.

1.The first round was about choosing the correct output.

2.The second round was focused on coding. I was asked to solve a programming problem as part of this round.

Write a Java program that:

  1. Accepts three inputs from the user using the Scanner class:

    • start: the starting index for Fibonacci series
    • end: the ending index for Fibonacci series
    • limit: the number to compare the final sum with
  2. Generates Fibonacci numbers from the start to end index (inclusive).

  3. From these Fibonacci numbers:

    • Find which numbers are prime.
    • Calculate the sum of all these prime Fibonacci numbers.
  4. Finally:

    • If the sum is less than the limit, print "NO".
package pratice;

import java.util.Scanner;

public class fabonacci_series {
    static int total = 0; // Make total a static class variable

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter start value:");
        int start = sc.nextInt();
        System.out.println("Enter end value:");
        int end = sc.nextInt();
        System.out.println("Enter limit value:");
        int limit = sc.nextInt();

        findficser(start, limit, end);

        if (total < limit) {
            System.out.println("no");
        } else {
            System.out.println("yes");
        }

        sc.close();
    }

    private static void findficser(int start, int limit, int end) {
        int x = 1;
        int y = 0;
        int z = 0;

        for (int i = 0; i <= end; i++) {
            if (i >= start && i <= end) {
                if (z < limit) {
                    findprime(z);
                }
            }
            z = x + y;
            x = y;
            y = z;
        }
    }

    private static void findprime(int z) {
        boolean prime = true;
        if (z <= 1) {
            prime = false;
        } else {
            for (int div = 2; div <= z/2; div++) {
                if (z % div == 0) {
                    prime = false;
                    break;
                }
            }
        }

        if (prime) {
            total =total+ z;
        }
    }
}