Interview Experience at FarEye| Automation Testing

In this article we will cover interview experience at FarEye.

Interview Experience at FarEye | Automation Testing

Round 1 - Written
  •     HackerRank test consisted of 33 questions to be completed in 1.5 hours
    • Java output questions
    • Reasoning
    • Selenium questions
    • 2 programs
      • Write a program to check if the integer is Palindrome or not.
      • Write a program to print the word occurences in a given String using HashMap, for example - This is what this is
        • This - 2
        • is -2
        • what -1
Overall Java output questions were conceptual, prepare with constructors, loops, polymorphism and other topics. Carry a notebook along with you to solve few questions on paper.

  1. There was a question like if A, B and C can complete the work in 12, 20 and 60 days. How many days it will take them to complete the work together?
    1. 4 days
    2. 7/24 days
  2. What is the degree formed when the time is 3 hours and 40 mins on a clock?
    1. 150
    2. 140
    3. 130
    4. 125
    5. 120
  3. A,B and C can do a work in 20, 30 and 60 days respectively. In how many days the work will complete if they all work together?
    1. 10 days
Explanation - A can complete the work in 1/20 days
                       B can complete the work in 1/30 days
                       C can complete the work in 1/60 days
If they all work together, they can complete in 1 day = 1/20 + 1/30 + 1/60 =1/10
Hence, 10 days

  • What is the command to find the background color of an element using cssSelector property?
    • getCssValue("background-color");
      
          
  • What is the difference between == and equals in Java?
    • == refers to the location of the variables
    • equals/ Hashcode refers to the value
    • Example-
        public class Test { public static void main(String[] args) { String s1 = new String("HELLO"); String s2 = new String("HELLO"); System.out.println(s1 == s2); System.out.println(s1.equals(s2)); } }

Output-
false
true



Program to check whether the given number is Palindrome or not.

public class Palindrome {

    public static void main(String[] args) {

        int num = 54645, reversedInteger = 0, remainder, originalInteger;

        originalInteger = num;

        // reversed integer is stored in variable 
        while( num != 0 )
        {
            remainder = num % 10;
            reversedInteger = reversedInteger * 10 + remainder;
            num  /= 10;
        }

        // palindrome if orignalInteger and reversedInteger are equal
        if (originalInteger == reversedInteger)
            System.out.println(originalInteger + " is a palindrome.");
        else
            System.out.println(originalInteger + " is not a palindrome.");
    }
}

Program Explanation -
  • Declare original number, num, reversedInteger, remainder first as integer.
  • OriginalInteger is initialized with num so that in the later phase, we can compare the 2 numbers.
  • While num is not equal to zero.
  • Remainder will be found out using modulus operator.
  • ReversedInteger will be sum of remainder and reversedInteger multiplied by 10.
  • num will be divided by 10.
Steps -
Interview Experience at FarEye


Java program to count the duplicate words in a given String.

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        //1
        String inputString;

        //2
        Scanner scanner = new Scanner(System.in);

        //3
        int count;

        //4
        System.out.println("Enter a string : ");

        //5
        inputString = scanner.nextLine();

        //6
        String[] wordsArray = inputString.split("\\s+");

        //7
        HashMap<String, Integer> map = new HashMap<>();

        //8
        for (String word : wordsArray) {
            //9
            if (map.containsKey(word)) {
                count = map.get(word);
                map.put(word, count + 1);
            } else {
                map.put(word, 1);
            }
        }

        //10
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey() + " : " + entry.getValue());
        }

    }


}

Explanation -
  • String is split into multiple words by using split and regex operator.
  • create an empty HashMap.
  • In the for loop, check each and every word, if it exists in the map, increment the count by 1 else put word count 1.

Technical round -

Interviewer - Piyush Matta
Date of Interview - 05-05-2021

  • Output of below program -
    • class A{ public static void main(String args[]){ try{ int a[]=new int[5]; a[5]=30/0; } catch(Exception e){System.out.println("common task completed");} catch(ArithmeticException e){System.out.println("task1 is completed");} catch(ArrayIndexOutOfBoundsException e){System.out.println("task 2 completed");} System.out.println("rest of the code..."); } }

Comments

Popular posts from this blog

Azure Tutorials Series - Azure Networking

Testing in CI/CD

Azure Tutorials Series - IaaS vs PaaS vs SaaS