Automation test engineer Interview Questions | Glassdoor.co.in

# Automation test engineer Interview Questions

876

automation test engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Test Automation Engineer at Oracle was asked...

28 Mar 2018
 Sort Binary Arrays - {0,1,0,1,1,1,0,0,0,1}7 Answerspublic static void SortBinaryArrays(int[] Binary) { int[] sorrtedArray = new int[Binary.length]; int i = 0; for (int a : Binary) { if (a == 0) { sorrtedArray[i] = a; i++; } } for (int a : Binary) { if (a == 1) { sorrtedArray[i] = a; i++; } } for (int a : sorrtedArray) { System.out.print(a + " "); } }int [] a= {1,0,1,0,1,1,1,0,0,0}; int [] arr= new int[a.length]; int left=0; int right=a.length-1; while (leftShow more responsespublic static void main(String[] args) { int [] a= {1,0,1,0,1,1,1,0,0,0}; int [] arr= new int[a.length]; int left=0; int right=a.length-1; while (leftpublic static void main(String[] args) { int [] a= {1,0,1,0,1,1,1,0,0,0}; int [] arr= new int[a.length]; int left=0; int right=a.length-1; while (leftint[] a={0,1,0,1,1,1,0,0,0,1}; int index=0; public static int[] sortBinaryArray(int[] a) { for(int i=0;ipublic static int[] sortBinaryArray(int[] a) { int leftptr=0; int rightptr=a.length-1; while(true) { while(a[leftptr]==0) { leftptr++; } while(a[rightptr]==1) { rightptr--; } if(leftptr One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Test Automation Engineer at Oracle was asked...

7 Feb 2019
 String Palindrom, reverse words in a string, find longest substring in a string, duplicate characters in a string and print the count of it.5 Answerspublic static boolean isPalindrome(String string) { String reverse =""; for(int i=string.length()-1;i>=0;i--) { reverse=reverse+string.charAt(i); } if(string.equalsIgnoreCase(reverse) { return true; } return false; }//* Using stack public static boolean isPalindrome(String string) { String rev=""; Stack stack = new Stack(); for(int i=0;i//Reverse Words In a String public static String reverseWords(String s) { String res=""; String[] string=s.split(" "); for(int i=0;i=0;i--) { rev=rev+string.charAt(i); } return rev; }Show more responses//*Counting duplicates public static int countDuplicates(String str) { char[] charArray = str.toCharArray(); Map hash_map = new HashMap(); for(int i=0;i entry:hash_map.entrySet()) { if(entry.getValue()>1) { count=count+1; } } return count; }//Reverse Words in String public static String reverseWords(String string){ String[] stAr=string.split(" "); String result=""; for(int i=stAr.length-1;i>=0;i--) { result=result+" "+stAr[i]; } return result.subString(1,result.length()); }

### Automation Test Engineer at Oracle was asked...

13 Feb 2016
 Code to find a missing number in an array5 Answerspublic void missing() { ArrayList arr = new ArrayList(); int a[] = { 1, 3, 4, 5, 6, 7, 10 }; int j = a; for (int i = 0; i < a.length; i++) { if (j == a[i]) { j++; continue; } else { arr.add(j); i--; j++; } } System.out.println("missing numbers are "); for (int r : arr) { System.out.println(" " + r); } }Does the numbes in an array lies in between a specific range ?Does the numbes in an array lies in between a specific range ?Show more responsesDoes the numbes in an array lies in between a specific range ?public static int findMissingNumber(int[] a) { int n=a.length; int expectedNumber=n*(n+1)/2; int actualsum=0; for(int i=0;i

### Automation Test Engineer at Oracle was asked...

13 Feb 2016
 Code to reverse a string4 Answersdeclare l_orig varchar2(32767):='&input'; l_out varchar2(32767); begin for i in 0..length(l_orig)-1 loop l_out := l_out ||substr(l_orig,length(l_orig)-i,1); end loop; dbms_output.put_line(l_out); end; /// Java program to Reverse a String by // converting string to characters one // by one import java.lang.*; import java.io.*; import java.util.*; // Class of ReverseString class ReverseString { public static void main(String[] args) { String input = "GeeksForGeeks"; // convert String to character array // by using toCharArray char[] try1 = input.toCharArray(); for (int i = try1.length-1; i>=0; i--) System.out.print(try1[i]); } }source: GeeksforGeeksShow more responsesclass ReverseString { public static void main(String[] args) { String input = "GeeksForGeeks"; // convert String to character array // by using toCharArray char[] try1 = input.toCharArray(); for (int i = try1.length-1; i>= 0; i--) System.out.print(try1[i]); } }

### Automation Test Engineer at Oracle was asked...

13 Feb 2016
 Code to find a repeated number in an array3 Answerspublic void CountTheRepeatedNumber(int[] arr){ Map map=new Hashmap(); for(Integer num:arr){ if(map.containsKey(num)){ map.put(num,map.get(num)+1); //increase the value if it is repeated } else{ map.put(num,1); // put 1 into value if number is first time present } } Set key=map.KeySet(); //return you all the distinct integer number for(Integer i:key){ if(map.get(i)>=0){ syso(i +" is " +map.get(i) +"Times in an array"); //simply print this so u will get repeated numbers with count and just print it } }public void unique(){ int[] numbers = {1,2,2,3,4,5,5,6,7}; Arrays.sort(numbers); System.out.println("Sorted : "+numbers.length); for(int i = 1; i < numbers.length; i++) { if(numbers[i] == numbers[i - 1]) { System.out.println("Duplicate: " + numbers[i]); } } }//Finding the number which appeared twice public static void findDuplicates(int[] a) { Map hashmap = new HashMap(); for(int i=0;i entries : hashmap.entrySet()) { if(entries.getValue()>1) { System.out.print(entries.getKey()+" "); } } }

### Senior Software Engineer - Test Automation at LTI was asked...

26 Feb 2018
 Public int compareTo(object o) { Employee emp = (Employee)o; return this.id - e.id; }3 AnswersOutput should be 0. Since compareTo() implements Comparable interface.Have you received offer.?Have you received offer?

### Test Automation Engineer at Oracle was asked...

6 Feb 2018
 Find duplicate numbers from an array {1,2,3,3, 4,5,6,7,...100}3 AnswersFrom a string "abacddefabgh", find the count of each alphabet occurring in string, eg: a = 5, b=2...public static void findDuplicates(int[] a) { Setset=new LinkedHashSet(); for(int i=0;ipublic static void findDuplicatesWithSets(int[] array) { Set sets=new LinkedHashSet(); for(int i=0;i

### Test Automation Engineer at Oracle was asked...

28 Mar 2018
 Is Webdriver a class or interface?3 AnswersIt is an Interface.Webdriver is basically an Interface which is always implemented by any of browser class like ChromeDrive() , FirefoxDriver(), OperaDriver() etc.WebDriver is an interface which can be implemented by the class which implements it. ChromeDriver,geckoDriver,IEDriver these are the class which implements the webdriver interface . Since webdriver is an interface it contians all the abstract methods .These methods are implemented by the class implementing the interface . Hence in our code we write WebDriver driver = new ChromeDriver(); we can also write ChromeDriver driver = new ChromeDriver(); But here we can only invoke methods that are of chrome driver. Whereas in WebDriver driver = new ChromeDriver(); we can invoke the methods of both chrome driver and webdriver

### Test Automation Engineer at Wipro was asked...

19 Jan 2020
 What is Difference between XPath and CSS Selectors in Selenium WebDriver2 AnswersMajor Difference I see is CSS Selector is faster then Relative Xpath. Relative XPath tends to find multiple elements and used in special case only. He asked like there is one major difference can you tell that. I couldn't answer that as I told I have used id and name selector more than CSS selector.In Xpath you can traverse backward and forward as per your need but in CSS you can only move forward. Also Xpath can be created by using text() but there is no such way of finding element in CSS CSS is faster comparatively.

### Test Automation Engineer at Oracle was asked...

28 Mar 2018
 "Hello My Name is Shiva" Reverse the Characters and the positions of the Strings in the given sentence. [There can be variations on this question.]2 Answerspublic class ReverseWords { public static void main(String[] args) { String str [] = "Hello My Name is Shiva.".split(" "); int len = str.length; String revWords = ""; for(int i=0; i=0; j--) { revLetters = revLetters + word.charAt(j); } revWords = revWords + revLetters + " "; } System.out.println(revWords); } }public static void main(String[] args) { String string = "Hello My Name is Shiva"; String[] Words = string.split(" "); for (int i = Words.length - 1; i >= 0; i--) { char[] EachWord = Words[i].toCharArray(); for (int j = EachWord.length - 1; j >= 0; j--) { System.out.print(EachWord[j]); } System.out.print(" "); } }
110 of 876 Interview Questions