📜 ⬆️ ⬇️

Questions for the interview backend developer

This list appeared as a personal note on the topics that I discussed with my colleagues and friends and that I wanted to understand more deeply ...

I’m not a big fan of asking technical questions at interviews: for me it’s better to sit with a candidate (or candidate) behind the keyboard over some real code, a real problem - and do pair programming all day, preferably one by one with the rest of the team. But I believe that some technical issues can be a good starting point for an exciting and enjoyable conversation and will allow you to get to know each other more deeply.

This repository contains a number of issues related to the server part, which can be used when checking potential candidates. In no case is it recommended to ask all the questions to one candidate: it will take several hours and does not make sense at all, because they cover too wide a range of topics. No one can know everything. Select the most relevant section and the most interesting questions to expand the conversation.

A warning


Most of the questions are open, some just do not have the right or wrong answer. On the contrary, they should be the starting point of a conversation, which, in theory, should better demonstrate a person’s abilities than a simple answer. Personally, I would prefer to ask questions, the answers to which I do not know.
')
Again, I emphasize that just asking questions is hardly enough. At the end of the interview, conduct a lengthy pair programming session: this is one of the best options to understand each other’s style and approach — and let the candidates know what to expect from their future work.

This project is modeled on the @darcyclarke “Question for interviewing a front-end job” .

Where are the answers?


Sooner or later I will supplement the article with relevant answers. I would be grateful for any help!

Content


Design Pattern Questions
Questions on the organization of the code (code design)
Questions about programming languages
Web development questions
Database issues
NoSQL Questions
Questions about code versioning
Questions about concurrency
Questions about distributed systems
Questions about software lifecycle and team management
Questions on logic and algorithms
Questions about software architecture
Questions about service-oriented architecture and microservices
Safety issues
General issues
Open questions
Questions with code snippets
Questions in the style of Bill Gates

Questions on design patterns:


• Why are global objects and statics evil? Can you show by example code?

• Tell us about the inversion of control and how it improves the organization of the code.

• The Demeter Law (Minimum Awareness Principle) states that each software module must have limited knowledge of other modules and must interact only with direct “friends” (sometimes it is formulated as “Do not talk to strangers”). Can you write code that violates this principle? Why does he have a bad organization and how to fix it?

• Active-Record is a design pattern that encourages the implementation of functions, such as Insert, Update and Delete, and properties that correspond to columns of a certain base table in the database in the object itself. In your opinion and experience, what are the limitations and pitfalls of this template?

• Data-Mapper - a design pattern that encourages the use of a layer of converters (mappers) that move data between objects and the database, while at the same time maintaining their independence from each other and from the converter itself. In contrast to this template, in Active-Record, objects directly include operations to save themselves in the database and properties corresponding to the base tables in the database. Do you have an opinion on these templates? When do you prefer one of them to another?

• Why, when introducing NULL, is the Billion Dollar Error often mentioned? Want to discuss techniques to prevent this, such as the Null Object pattern presented in the GOF book, or optional types?

• Why is composition often better than inheritance?

• What is the Anti-corruption Layer?

• A singleton is a design pattern that creates one instance of a class for a single object. It’s not so easy to write a Thread Safe Singleton. Will try?

• The ability to change the implementation without affecting the client part is called the Data Abstraction. Write an example that violates this property, then correct it.

• Write a piece of code that violates the principle of Don't Repeat Yourself (DRY). Then fix it.

• How will you deal with Dependency Hell?

• Why is goto evil?

• The principle of reliability - the general rule of the organization code, which recommends "to be conservative in what you send, and liberal in what you accept . " It is often formulated as "being a tolerant reader and a careful writer . " Want to discuss the meaning of this principle?

• Responsibility - a design principle for dividing a computer program into separate areas, each of which is responsible for its task. There are many different mechanisms for sharing responsibilities (using objects, functions, modules, or templates, such as MVC and the like). Want to discuss this topic?

Questions on code organization (code design):


• It is often said that one of the most important tasks of an object-oriented design (and organizing code in general) is strong adhesion and loose coupling. What does it mean? Why are they so important and how to reach them?

• Why in most languages ​​does the array index start at zero?

• How do tests and TDD affect code organization?

• Write a piece of code that violates the principle of Don't Repeat Yourself (DRY). Explain why he has a bad organization, and correct it.

• What is the difference between coupling and connectedness?

• What is refactoring useful for?

• Are comments in the code helpful? Someone says that they should be avoided if possible, and ideally they are not needed at all. Do you agree?

• What is the difference between code organization and architecture?

• Why are tests written in TDD before the code?

• C ++ supports multiple inheritance, and Java allows a class to implement multiple interfaces. What effect does the use of these tools have on orthogonality? Is there a difference in impact between the use of multiple inheritance and multiple interfaces? Is there a difference between using delegation and inheritance? [This is a question from the book The Pragmatic Programmer by Andrew Hunt and David Thomas.]

• Pros and cons of storing domain logic in stored procedures.

• In your opinion, why has an object-oriented organization dominated the market for so many years?

• If your code has a bad organization, how do you understand this?

Questions about programming languages:


• .

• ?

• ? ?

• ?

• ? ? .

• , , (. . ). .

• , ?

• , .

• : , . , . , ?

• ? .

• Java C# ( ).

• Java?

• — ?

• , , . .

• ? ?

• , ?

• , , , . ? Switch?

• ? ?

CatAnimal, , TakeCare<Cat>TakeCare<Animal>?

• Java, C# ?

• Node.js. , ?

• , Java (C#, Python, Go - ) JDK. ? ? ? ?

-:


• -?

• Web Services API?

• - ?

• , stateless? stateless-? (statefullness) — ?

• REST SOAP: , ?

• - Model-View Controller Model-View-View-Model , . ?

:


• , , MySQL PostgreSQL? , ?

• NULL ? , SQL SELECT * FROM table WHERE field = null null?

• ACID — Atomicity, Consistency, Isolation, Durability (, , , ). . ? ?

• c , ?

• ? ? ?

• « N+1» , «-» ORM , , , . ?

• ?

• , ? ?

• - . ,  — , . , . .

NoSQL:


• (eventual consistency)?

• CAP, CP, AP CA.

• NoSQL ?

• NoSQL ?

• MongoDB , MySQL PostgreSQL?

:


• Mercurial Git , SVN?

• , Git, VCS SVN?

• GitHub Flow GitFlow?

• rebase ()?

• Mercurial Git, SVN CVS?

:


• ? .

• / ?

• ? .

• ? - , ?

• (process starvation)? , .

• (wait-free )?

:


• ?

• ?

• ?

• ,  — ?

• -? ?

• ?

• (reconciliation) .

• ?

• Request/Reply, Publish/Subscribe?

• , , c , . ?

:


• (agility)?

• -?

• , . , - .

• . .

• ?

• , ?

• , ?

• « » « » — , Agile-. .

• , , .

• ?

• , ( ) « ».

• ? , ?

• , ?

• , ?

• , . ?

:


• FIFO, LIFO. LIFO, FIFO.

• , .

• .

• REPL, . RPN-.

• ?

• , .

• , .

• .

• .

• .

• -. , .

• 10 ? 10 ?

• ?

:


• ?

• - ?

• ?

• (emergent design) ?

• : ? , ?

• (failover) ?

• CQRS (Command Query Responsibility Segregation)? Command-Query Separation?

• ?

• ?

• C10k?

• ( ) P2P?

• CGI ?

• (vendor lock-in)?

• «-» ?

• 80- , ?

• ?

• - DoS-, - ?

• ?

• (tight coupling)?

• ?

• ? : ?

• , , ? .

- :


• SOA , Saga?

• SOA ?

• -, , .

• Saga, SOA?

• ?

• ?

:


• ? , ? ?

• , ?

• ? -?

• , , , . ?

• , SQL- .

• SQL- ? , , , .

• ? , .

• ? , .

• HTTPS?

• « »? HTTPS ?

• ? , , , .

:


• ? ?

• Microsoft, Google, Opera Mozilla ?

• TCP ?

• ?

• ?

• ?

• — , . ?

• .

• - (bject-relational impedance mismatch)?

• ?

• TCP HTTP?

• ?

• ?

« », « , , , , ». , : ? ?

:


• ?

• .

• , . ?

• ?

• , .

• , : ?

• ?

• . , — ?

• , .

• , - ?

• ?

• , (Eating Your Own Food).

• ?

• ? ?

• (greenfield) (brownfield)? ?

, google.com Enter?

• , ? , , , , . .

• .

• .

• « »?

• — , ? .

• ?

• , ?

• , ?

:


• JavaScript?

function hookupevents() {
  for (var i = 0; i < 3; i++) {
    document.getElementById("button" + i)
      .addEventListener("click", function() {
        alert(i);
      });
  }
}

• , Java ?

ArrayList<Integer> li = new ArrayList<Integer>();
ArrayList<Float> lf = new ArrayList<Float>();
if (li.getClass() == lf.getClass()) // evaluates to true
  System.out.println("Equal");

• ?

public class Stack {
    private Object[] elements;
    private int size = 0;
    private static final int DEFAULT_INITIAL_CAPACITY = 16;

    public Stack() {
        elements = new Object[DEFAULT_INITIAL_CAPACITY];
    }

    public void push(Object e) {
        ensureCapacity();
        elements[size++] = e;
    }

    public Object pop() {
        if (size == 0)
            throw new EmptyStackException();
        return elements[--size];
    }

    /**
     * Ensure space for at least one more element, roughly
     * doubling the capacity each time the array needs to grow.
     */
    private void ensureCapacity() {
        if (elements.length == size)
            elements = Arrays.copyOf(elements, 2 * size + 1);
    }
}

switch - ?

public class Formatter {

    private Service service;

    public Formatter(Service service) {
        this.service = service;
    }

    public String doTheJob(String theInput) {
        String response = service.askForPermission();
        switch (response) {
        case "FAIL":
            return "error";
        case "OK":
            return String.format("%s%s", theInput, theInput);
        default:
            return null;
        }
    }
}

if - ?

public class TheService {
    private final FileHandler fileHandler;
    private final FooRepository fooRepository;

    public TheService(FileHandler fileHandler, FooRepository fooRepository) {
        this.fileHandler = fileHandler;
        this.fooRepository = fooRepository;
    }

    public String Execute(final String file) {

        final String rewrittenUrl = fileHandler.getXmlFileFromFileName(file);
        final String executionId = fileHandler.getExecutionIdFromFileName(file);

        if ((executionId == "") || (rewrittenUrl == "")) {
            return "";
        }

        Foo knownFoo = fooRepository.getFooByXmlFileName(rewrittenUrl);

        if (knownFoo == null) {
            return "";
        }

        return knownFoo.DoThat(file);
    }
}

• ?

function()
{
    HRESULT error = S_OK;

    if(SUCCEEDED(Operation1()))
    {
        if(SUCCEEDED(Operation2()))
        {
            if(SUCCEEDED(Operation3()))
            {
                if(SUCCEEDED(Operation4()))
                {
                }
                else
                {
                    error = OPERATION4FAILED;
                }
            }
            else
            {
                error = OPERATION3FAILED;
            }
        }
        else
        {
            error = OPERATION2FAILED;
        }
    }
    else
    {
        error = OPERATION1FAILED;
    }

    return error;
}

:


Microsoft ( Microsoft).

• , ?

• . , — . /?

• .

• Quora , Yahoo Answers?

• : Cobol .

• 10 ?

• , . .

• . . . .

• . ?

• , ?

Source: https://habr.com/ru/post/349434/


All Articles