# Fragen im Vorstellungsgespräch: Automation engineer

# 6370

Fragen aus Vorstellungsgesprächen für „ Automation Engineer“, von Bewerbern geteilt## Top-Fragen in Vorstellungsgesprächen

### A dwarf-killing giant lines up 10 dwarfs from shortest to tallest. Each dwarf can see all the shortest dwarfs in front of him, but cannot see the dwarfs behind himself. The giant randomly puts a white or black hat on each dwarf. No dwarf can see their own hat. The giant tells all the dwarfs that he will ask each dwarf, starting with the tallest, for the color of his hat. If the dwarf answers incorrectly, the giant will kill the dwarf. Each dwarf can hear the previous answers, but cannot hear when a dwarf is killed. What strategy should be used to kill the fewest dwarfs, and what is the minimum number of dwarfs that can be saved with this strategy?

21 Antworten↳

Think broadband communication. Exploit the capabilities of the communications medium. A minimum of nine dwarves can be saved based on the information provided in the original post I viewed. The strategy is for each dwarf to employ the expected language to communicate the color of their own hat to the giant, while simultaneously employing a vocal pitch protocol to indicate the color of the hat of the dwarf in front of him, high pitch for white and low pitch for black. The original post, indicates the dwarves may collude prior to the distribution of hats, so there is opportunity to negotiate such a simple broadband communication protocol. The tallest dwarf only has a 50/50 chance since the number of black and white hats in play is not known (rhetorical question, what are the odds the tallest dwarf's hat is black if he turns to find that all nine hats in front of him are white? I don't know, but odds are high that the giant is a sadistic bloke). The original post I viewed is here. http://www.businessinsider.com/toughest-job-interview-questions-2013-7#a-dwarf-killing-giant-lines-up-10-dwarfs-from-shortest-to-tallest-each-dwarf-can-see-all-the-shortest-dwarfs-in-front-of-him-but-cannot-see-the-dwarfs-behind-himself-the-giant-randomly-puts-a-white-or-black-hat-on-each-dwarf-no-dwarf-can-see-their-own-hat-the-giant-tells-all-the-dwarfs-that-he-will-ask-each-dwarf-starting-with-the-tallest-for-the-color-of-his-hat-if-the-dwarf-answers-incorrectly-the-giant-will-kill-the-dwarf-each-dwarf-can-hear-the-previous-answers-but-cannot-hear-when-a-dwarf-is-killed-the-dwarves-are-given-an-opportunity-to-collude-before-the-hats-are-distributed-what-strategy-should-be-used-to-kill-the-fewest-dwarfs-and-what-is-the-minimum-number-of-dwarfs-that-can-be-saved-with-this-strategy-11 Weniger

↳

the question does not mention that there will be equal number of white and black hats ! Weniger

↳

What is the minimum number of dwarfs that can be saved with this strategy? 9 First of all, let's numerate the dwarfs as N1, N2, N3, etc. with N10 being the tallest. Now, N10 will state the color of N9 as his own answer, "My hat is WHITE". Based on this answer, N9 will state his color with a positive statement if the color of N8 is the same as his, "My hat is WHITE". Based on N8's answer, N8 knows that his color is WHITE, now, he will state his color depending on N7. Let's say N7 is black, so N8 will state, "My hat is NOT BLACK". N7 knows that his color is BLACK, but N6 is white, so he will use a negative statement, "My hat is NOT WHITE" and so on. Full example: N10 = BLACK N9 = WHITE N8 = WHITE N7 = BLACK N6 = WHITE N5 = WHITE N4 = WHITE N3 = BLACK N2 = BLACK N1 = WHITE N10: My hat is WHITE (Dies) N9 = My hat is WHITE N8 = My hat is NOT BLACK N7 = My hat is NOT WHITE N6 = My hat is WHITE N5 = My hat is WHITE N4 = My hat is NOT BLACK N3 = My hat is BLACK N2 = My hat is NOT WHITE N1 = My hat is WHITE N10 will have a 50/50 chances of survival... I'm sorry N10, I couldn't save you :'( Weniger

### They asked me code some programs

10 Antworten↳

Can you please tell which program they asked?

↳

I took some time and coded the programs and showed it to them

↳

First two were easy but third one was a little tricky.

### Code to find character count in a given string.

8 Antworten↳

Please give more input about this interview

↳

Please if you see the comment please give more input about this interview

↳

In these sorts of interviews you really need to drill down and understand what the interviewer is looking for. A good way to simulate a real interview experience is to do a mock with one of the EPAM Systems Senior Test Automation Engineer experts on Prepfully, rated super strongly on TrustPilot... prepfully.com/practice-interviews Weniger

### Sort Binary Arrays - {0,1,0,1,1,1,0,0,0,1}

6 Antworten↳

public 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 + " "); } } Weniger

↳

public 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 Weniger

↳

int[] a={0,1,0,1,1,1,0,0,0,1}; int index=0; public static int[] sortBinaryArray(int[] a) { for(int i=0;i Weniger

### Write a function that determines which function is a mirror number. i.e. 12321 would return YES

6 Antworten↳

function mirror(number){ number=number.toString(); length=number.length-1; for(i=0;i Weniger

↳

Using Python: def mirror(num): li = list(str(num)) length = len(li)-1 for i in range(length/2): if li[i] != li[length-i]: print 'NO' return print 'YES' mirror(12321) mirror(12341) Output >>> YES NO >>> Weniger

↳

JAVASCRIPT function mirror(num){ var a = []; var n = num.toString().split(""); for (var i= n.length - 1; i>=0; i--){ a.push(n[i]); } a = a.join(""); n = n.join(""); if (n == a){ return "YES"; } else{ return "NO"; } } mirror(12321); Weniger

### 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 Antworten↳

//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()); } Weniger

↳

public 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; } Weniger

↳

//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; } Weniger

### Code to find a missing number in an array

5 Antworten↳

public void missing() { ArrayList arr = new ArrayList(); int a[] = { 1, 3, 4, 5, 6, 7, 10 }; int j = a[0]; 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); } } Weniger

↳

Does the numbes in an array lies in between a specific range ?

↳

Does the numbes in an array lies in between a specific range ?

### You have 2 identical crystal orbs and a 100 storey tall building. How do you determine which floor the orbs will shatter at, and what is the minimum number of tests you need to execute?

5 Antworten↳

The problem here is that you only have two crystal orbs. If you had closer to 100, a strategy of beginning on the 50th floor and working up or down would work great. Unfortunately, if it breaks at 50, and then breaks at 25, you're out of orbs. You'll have to be cautious. You can start on 50. If it shatters at 50, though, you'll have to go to the second floor (assuming you can simply place the orb on the ground when on the first floor) and work your way up one at a time--because you've only got one orb left. If it doesn't shatter at 50, go to 75. If it shatters at 75, you have to go to 51 and work up one at a time, as, again, you only have one orb left. If it doesn't shatter at 75, go to 88, etc. The minimum number of tests is 2. Shatters at 50, shatters at 2. Weniger

↳

You can get it done in about 4-5 tests, I think. Start by dropping one from the 33rd and one from the 66th. If both shatter, it's a floor below 33. If 33 is intact and 66 shatters, then it's a floor between 33 and 66. If both remain intact, then you'll check floors above 66. For your next test, divide the range you need to investigate into 3. So, for example, if the 66th breaks and the 33rd does not, then you have 33 possible floors. 33 divided by 3 is 11, so go up 11 floors from 33 and down eleven floors from 66 and drop them. Same idea as last time- you're narrowing it down to 1/3rd of all of the possible floors. You'll know the correct floor at which they will break when the number of possible floors is exactly 1 percent of the number of original floors (in other words, when there is only 1 floor out of 100 that could be the lowest shattering floor). Since each test reduces the possible floors by 66% (leaving 1/3 of the previous floors remaining), you'll have one floor left when (1/3)^n = .01, where n is the number of trials. This occurs at log base 1/3 of .01, which wolfram alpha says is 4.19, so it would take at least 5 trials to get this narrowed down to a single floor. Weniger

↳

If you only have two orbs, use one to test and the second to confirm. starting from the bottom make your way to the top on steps of 3 floors. This is slightly better than n/3 (n/3 + 3) where n is 100 in this problem. For example: let's say the orbs break on the 48 floor. On increments of 3 you get to the 48 floor in 16 steps. Once the orb breaks go to floors down and throw the second orb. You know that the orb didn't break on the 45th floor. If it breaks on the 48th floor, it won't break on the 46th, or the 47th floor, when you throw the orb from the 48th floor again it will be confirmed. let's say the orbs break on the 49th floor. you know 48th checks, 51st will break the 1st floor. go to 49th if it breaks you can confirm 49th is the limit. let's say they break on the 50th floor. 48th checks, 51st doesn't. go to 49th, checks, 50 doesn't therefore 50th is the limit. Weniger

### wright a program

4 Antworten↳

Which program they asked to write?

↳

I wrote a program

↳

Can you explain in which language we have to write the program?!

### Code to reverse a string

4 Antworten↳

declare 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; / Weniger

↳

// 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]); } } Weniger

↳

source: GeeksforGeeks