JavaRush /Java Blog /Random EN /Interview experience
Galina
Level 8

Interview experience

Published in the Random EN group
I interviewed with an American company that has offices in St. Petersburg, Saratov, Kharkov, Poland, and, well, in the Silicon Valley of California. Lots of Russians there.
IT interview
I was assigned a technical interview for a junior QA with java position . I was preparing, writing with a pen on paper the code of problems for arrays, lists, collections. No peeking anywhere. This, by the way, was not easy. The interview was by hangouts. At the beginning of the interview, the interviewer asked me to describe myself. Then we moved on to tasks. He rummaged through the document with me, where there was a code and we both saw each other's actions at the same time. The first task was on an array with answer options. I won't give an answer here, but I want to warn you to be careful. It is easy to analyze the beginning of code execution and not notice a small catch towards the end.
//Task1
// What will be the value of the “values” variable after execution of the following code snippet?
//
    public static void main(String[] args) {
        int[] values = {23, 12, 13, 17, 23, 19};

        for (int i = 0; i < values.length - 1; i++) {
            if (values[i] > values[i + 1]) {
                int t = values[i];
                values[i] = values[i + 1];
                values[i + 1] = t;
            }
        }
    }

// 1. {12, 13, 17, 19, 23, 23}
// 2. {23, 23, 19, 17, 13, 12}
// 3. {12, 13, 17, 23, 19, 23}
// 4. {12, 13, 23, 17, 19, 23}
The interviewer asked "What does the puzzle do?" and "Which answer is correct?". And "What does this puzzle look like?" To the last question, I answered that it resembles bubble sort, only there are two loops and one nested one that starts from the end. I solved this problem. And I was even glad that it was easy. Then came the second problem "Lucky Ticket". Where the sum of the first three digits is equal to the sum of the last three in a 6-digit number.
// Task2
// boolean isMyTicketLucky(? ticketNumber);

// Notes:
// - You need to choose a type of the ticketNumber input parameter yourself.
// - Ticket number consists of 6 digits like 123456 or 404404.
// - The method returns true if sum of the first three digits is equal to sum of the last three digits.
// If the sums are different the method returns false.

    public static void main(String[] args) {
        //isMyTicketLucky("123006");
        System.out.println(isMyTicketLucky("123006"));
    }
Here you need to choose the type of ticket number in the input parameter yourself. Integeror String. For both types there is a solution to the problem. Decision for ticket type Integer.
private static boolean isMyTicketLucky(int ticketNumber) {

        int number1 = ticketNumber / 100000;
        int number2 = (ticketNumber / 10000) % 10;
        int number3 = (ticketNumber / 1000) % 10;
        int number4 = (ticketNumber / 100) % 10;
        int number5 = (ticketNumber / 10) % 10;
        int number6 = ticketNumber % 10;

        return number1 + number2 + number3 == number4 + number5 + number6;
    }
Decision for ticket type String.
private static boolean isMyTicketLucky(String ticketNumber) {
        return ticketNumber.charAt(0) + ticketNumber.charAt(1) + ticketNumber.charAt(2)
                == ticketNumber.charAt(3) + ticketNumber.charAt(4) + ticketNumber.charAt(5);
    }
Unfortunately, I was confused and could not solve the second problem during the interview. After the tasks there were questions about SQL, SQL Join, system version control. Well, at the very end he asked "Are there any questions?" I asked for criticism of my interview, and the interviewer noted that he liked it, that I reasoned aloud what the code in the first task was doing. I walked straight through the code and said what each line and each iteration in the loop does. This was my first IT interview. I did not pass it, but I know what to work on now and what to learn.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION