JavaRush /Java Blog /Random EN /Analysis of a typical test task for a developer position
Uniges
Level 35
Санкт-Петербург

Analysis of a typical test task for a developer position

Published in the Random EN group
Today I would like to look at the terms of reference for the position of intern developer. Once upon a time I wrote it: I want to share my thoughts on this matter. It will be useful for beginners to have an idea of ​​​​what awaits them in the future when finding a job.
Analysis of a typical test task for a developer position - 1
The vacancy is as follows: Trainee PostgreSQL developer from RUB 30,000. before deduction of personal income tax LLC Business Technologies St. Petersburg, Kolomyazhsky Prospekt, 33k2 Business Technologies Required work experience: not required
  • Full time, full time
Responsibilities:
  • Implementation of low complexity tasks under the guidance of a developer
  • Constant growth of qualifications
Requirements:
  • Understanding of the principles of structured programming, the theory of relational databases.
  • Responsibility, independence, initiative
  • Communication skills, ability and desire to work in a team
  • High learning ability
Desirable:
  • Knowledge
  • Sql;
  • Pl\sql;
  • Pl\pgSql;
  • C++, java, pascal.
Conditions:
  • Work in a stable, dynamically developing company
  • Comfortable working conditions
  • Lack of formalism and bureaucracy
  • Extensive opportunities for professional and career growth
  • Salary based on interview results
  • Registration according to the Labor Code, paid leave in accordance with labor legislation.
  • Please indicate the job code in the header of the letter: Project04
Description of the test task: The test is intended for self-control in order for the applicant to determine for himself whether it is worth spending his time on an interview. Pseudocode This pseudocode is used to describe algorithms.
  1. Indentation from the left margin indicates the level of nesting.
  2. Loops while, for, repeat and conditional constructs have the same meaning as in Pascal.
  3. The symbol “--” indicates a comment
  4. The symbol “:=” denotes assignment
  5. Variables are local to the procedure unless otherwise stated
  6. The array index is written in square brackets, the construction A[i] means the i element in array A
  7. It is possible to use objects consisting of several fields or having several attributes; the field values ​​are written as FieldName[ObjectName].

    For example, the length of array A is written as Length[A]; what the square brackets mean is determined by the context (a variable denoting an array, or an object is a pointer to its constituent data). After assigning y:=x for any field f the equality f[y]=f[x] will be satisfied; Determining whether an attribute is a function, a variable, or anything else is done by context.

  8. A pointer can have the special value NIL, which does not point to any object.
  9. Parameters are passed by value: the called procedure receives its own copy of the parameters; changes to the parameters inside the procedure are not visible from the outside. When passing objects, a pointer to the data corresponding to that object is copied.
Problem A function that sorts an array of elements A: Sort(A,p,r) 1 if p < r 2 then q := round_half_down((p+r)/2) 3 Sort(A,p,q) 4 Sort(A,q +1,r) 5 Merge(A,p,q,r) Array example: A = (5,2,4,6,1,3,2,6) Run example: Sort(A,1,length[A ]) Required: Develop an algorithm for the Merge(A,p,q,r) function in any language convenient for you, with or without the use of additional memory, whichever is faster or more convenient for you to implement. If you succeed, we will be happy to welcome you for additional testing. My answer: The algorithm described in the Pseudocode example is the Merge sort algorithm. The main task of our function is to sort an array of unordered numbers: for example, in ascending order. The problem is divided into subtasks: the sequence of numbers from the array is divided into smaller arrays until the array becomes single-valued, the elements of the arrays are compared, they are replaced (smaller by larger, by index), and merged.
Analysis of a typical test task for a developer position - 2
public class Main {
    public static void main(String[] args) {
        int[] massif = {13, 3, 8, 1, 15, 2, 3, 7, 4};
        System.out.print("Массив до сортировки: ");
        for (int i = 0; i < massif.length; i++)
            System.out.print(massif[i] + " ");
        System.out.println("");
        massif = sort(massif);
        System.out.print("Массив после сортировки: ");
        for (int i = 0; i < massif.length; i++)
            System.out.print(massif[i] + " ");
    }

    public static int[] sort(int x[]) {
        if (x.length == 1) //Рекурсия идет до тех пор, пока массив делится
            return x;
        else {
            int half = (int) Math.floor(x.length / 2); //Разбиваем массив на 2 части
            int halfFirst[] = new int[half]; //1 часть, пустой массив
            int halfSecond[] = new int[x.length - half]; //2 часть, пустой массив
            for (int i = 0; i < x.length; i++) { //Заполняем новосозданные массивы значениями
                if (i < half)
                    halfFirst[i] = x[i];
                else
                    halfSecond[i - half] = x[i];
            }
            halfFirst = sort(halfFirst); //Рекурсия
            halfSecond = sort(halfSecond); //Рекурсия
            x = sortNext(halfFirst, halfSecond); //Отправляем заполненные значениями массивы в следующий метод
            return x;
        }
    }

    public static int[] sortNext(int x[], int y[]) {
        int c[] = new int [x.length + y.length]; //Создаем результирующий массив из суммы длин массивов из аргументов метода
        int a = 0, b = 0;
        for (int i = 0; i < x.length + y.length; i++) { //Сравниваем массивы, меняем местами элементы, заполняем новосозданный массив
            if (a == x.length) {
                c[i] = y[b];
                b++;
            }
            else if (b == y.length) {
                c[i] = x[a];
                a++;
            }
            else if (x[a] > y[b]) {
                c[i] = y[b];
                b++;
            }
            else {
                c[i] = x[a];
                a++;
            }
        }
        return c;
    }
}
Analysis of a typical test task for a developer position - 3
Link with working code to Ideone: HERE The task was successfully completed, after which I was invited to an interview, where, instead of an interview, they threw another batch of similar tasks at me and left for two hours, giving me a pen and 2 A4 pieces of paper. They took the leaves without looking at them and said that they would call back. My pleasure from such a pastime cannot be described in censored words. But, at a minimum, this is the harsh reality that many will have to face at the beginning of their journey.
Analysis of a typical test task for a developer position - 4
I sincerely wish you interesting and constructive interviews. Choose your employer wisely. All the best!) P.S.: my review of employing companies for April 2018 (St. Petersburg) can be viewed HERE
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION