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.
- 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?
- 4 days
- 7/24 days
- What is the degree formed when the time is 3 hours and 40 mins on a clock?
- 150
- 140
- 130
- 125
- 120
- 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?
- 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-
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 -
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
Post a Comment