In the courtyard of the XXI century, and for a long time telephone interviews are the most popular way to select candidates for work. This approach has its advantages – for example, the candidate and the interviewer do not need to waste their valuable time for the sake of meeting. This is the second part of my manual for programmers looking for work. In the first part, I sorted out some questions from interviews for the post of Java / C ++ / C-developer, and many asked me to do a similar article about phone interviews.
To go through the stage of a telephone interview and talk directly with the interviewer, you need to answer all the questions correctly. As a rule, it happens that questions are asked not only for your programming language, but also for related technologies: for example, SQL, Unix, XML, OOP, data structures and algorithms, working with networks, etc. If you intend to seriously prepare for the interview, then I advise you to read the books “Interviews for the post of programmer” and “Analysis of interviews for the post of programmer . ” The first is my favorite. I read it seven years ago, but it still has a lot of useful information and questions about algorithms and data structures.
The main thing that you must remember is always to respond to what you require, and avoid unnecessary reasoning. Interviewers during the telephone interviews cover many topics, and they do not want to listen to useless chatter, spending time on it. You will be able to show your profound knowledge of the topic in person. By the way, you can understand what the interviewer requires of you, in response to your answers – if he asks suggestive questions or asks you to tell more, then tell as much as you can on the topic, and if he quickly moves on to the next question, brief.
Basically, questions cover a lot of topics, but superficially – on telephone interviews usually only check the knowledge of the basics. And although the following questions are mainly intended for programmers with experience of 2-5 years, senior developers can also draw from them something useful. If you are an interviewer, you can use the questions below in order to quickly assess the candidate for the position. I provided answers to these questions and several instructions on what to say if you are asked to tell more.
Top 25 questions for a phone interview
These questions are suitable for many posts: developers, software engineers, QA, since they cover the most basic aspects of programming, but they are best suited for candidates for the position of developer. By the way, if you are a Java-developer, then for you there is a separate list . The following questions are suitable for everyone: Python-, Ruby-, Perl- and C # -programmers.
1. How long does it take to receive an item from a linked list? From a binary search tree? Or from a hash table? And if there are a million entries in these structures?
From the hash table you can get the element for the constant time, from the linked list – for the linear, from the binary tree – for the logarithmic. The number of elements does not affect the asymptotic behavior of the data structure in the event that everything goes as it should: there is not a hash table or very few collisions, and the binary tree is balanced. Otherwise, as the number of elements increases, the performance will decrease.
2. What is the difference between overloading and redefining something?
Overriding is performed while the program is running, and overloading is performed at compile time. Also, overloading and overloading are performed in different ways: for example, in Java, the overloaded method must have a signature other than the original method, and in the case of overriding it can be the same. Read more here.
3. What is the difference between branching the process and creating a new thread?
When a process is ramified, a new process is created with the same code, but in a separate memory space, and when creating a new thread, the code runs simultaneously with the main thread, but in the same memory space.
4. What is a critical section?
A critical section is a piece of code that can be changed by all threads. In order to protect the critical section, semaphores and locks are used (in Java, this is done using a keyword
ReentrantLock). Read more.
5. What is the difference between a value type and a reference type?
Value types are more optimized and store values in themselves, while reference types store a reference to the object. Details here.
6. What is the heap and stack process?
The heap and stack are two different areas of memory for one process. In Java, the stack is used to store primitive values and reference types, but the objects themselves are always created on the heap. Another critical difference is the heap one for all threads, but each thread has its own stack. More here.
7. What is the version control system?
Version control systems are used to effectively store and compare different versions of your product. In the professional development, this or that version control system is always used: Git, SVN, CVS, PerForce or another, and the more developers participate in the project, the greater the need for such a system. Version control systems play an important role in resolving conflicts in the code and supporting the history of the project. Details under the link .
8. What is a strongly typed programming language?
In strongly typed languages, the compiler ensures the correctness of data types. For example, you can not store a number in a String type, and vice versa. Java – silnotipizirovanny language, and therefore it has many types such as
boolean, etc. You can store values only in their respective types. In weakly typed languages, the variable type is defined at compile time, depending on the context. Popular weakly typed languages: Python and Perl. Read more.
9. What is the difference between a valid and well-formed XML?
A well-formed XML file contains a root tag, all tags are closed, all attributes in it are correctly defined, and so on. On the other hand, a valid XML file is tested by an XSD file or schema. So XML can be well formed, but at the same time do not pass the test, because it contains unresolved tags, etc.
10. What is the difference between a DOM and a SAX parser XML?
The DOM parser loads the entire XML file into memory at once and creates a DOM tree on it, which is parsed. Because of the way it works, the DOM parser is not suitable for large XML files, since they take up too much memory, but it works faster. SAX-parser works on the basis of events: opening / closing the tag, the beginning / end of the attribute, etc. Thus, the SAX parser takes up a bit of memory, but is slower than the DOM parser. The detailed answer is here .
11. How do flows and processes correspond to each other?
A single process can have multiple threads, but each thread can belong to only one process. Two processes are started in different areas of memory and can not communicate with each other, and two threads of the same process are always started in one memory area. Read more here.
12. What is an immutable class?
A class is called immutable if its state can not be changed after creation. For example, the String class in Java is immutable. Once you create the string “Java”, you can not change its contents, and any operation on it will return a new object. Immutable objects are best used for multi-threaded programming, because when you use them you do not have to worry about synchronization. In fact, the whole paradigm of functional programming is built on immutable objects. Details here.
13. Why do we need Mock objects?
Mock objects are useful for testing a particular area in your code. For example, you are creating a program for tracking exchange rates that takes data from the Internet, but you do not have a URL that you can connect to. By creating a Mock object that mimics the behavior you need, you can test your code. For Java, there are many libraries with which you can create Mock objects. For example, Mockito and PowerMock. The answer is here .
14. What is SQL injection?
SQL injection – a vulnerability in the security of the system, in which an attacker instead of data sends the executable SQL code to the database, thereby gaining full control over the database. Because of SQL injections, passwords, logins and personal information of users often disappear. SQL injection can be avoided by “preparing” incoming data in advance.
15. What is the difference between INNER JOIN and LEFT JOIN?
In SQL, there are two types of operator
OUTER JOINtoo, can be of two kinds:
RIGHT JOIN. The main difference between
LEFT JOINin the fact that in the first case only suitable records are selected from both tables, and in the second case, all records are selected from the first table, and only suitable records from the second one. Always pay attention to requests with ”
ALL“, because they usually require
LEFT JOIN, for example, a request that requires finding all the branches and the number of employees in them. If you use
INNER JOIN, then skip empty compartments in which no one works. More here .
16. What does the letter V mean in the abbreviation MVC?
V is the View in the MVC pattern. View is what the user sees when they browse your web page. The idea behind the MVC pattern is that the entire Web application is divided into three independent parts that can be edited without fear of affecting others: Model, View, Controller. Models are business objects themselves (for example, the user, the developer, the director, etc.), and the controller is what controls the models. For Java, there are many frameworks that implement MVC – for example, Struts 2 or Spring MVC. Details under the link .
17. What is the difference between a class and an object?
A class is a “drawing” by which an object is created. He describes the possible behavior of the object being created, and the object implements this behavior. You can not create an object without the class corresponding to it. Read more .
18. What is loose-coupling?
Loose coupling – the desired quality software, whereby one module it can be freely changed without affecting the second. For example, if you make changes to the user interface, it does should not affect the structure of the classes to the backend.
19. What is the difference between composition, aggregation and association?
At association two objects are connected among themselves, but can exist and separately. Composition is a form of association where one object consists of several others that can only exist together. For example, the human body is a composition of organs. One particular organ can not work by itself outside the body. Aggregation is a collection of objects. For example, a city is an aggregation of citizens. Detailed answer.
20. What is the difference between an interface and an abstract class?
Classic. An interface is a pure abstraction that does not contain anything other than method names, while an abstract class can also contain code for itself. The difference may differ depending on the language – in Java, a class can inherit only one abstract class, but several interfaces at once. Read more here .
21. What is unit testing?
Unit testing is a way to test the behavior of not just the entire application, but of which specific area of code. There are many ways to conduct unit testing in different languages. In Java, there are JUnit and TestNG libraries for this. Typically, unit tests are run automatically at compile time or in environments like Jenkins. An example here .
22. What three types of testing exist?
Unit, system and smoke testing. Unit testing is used to test a specific area of code, system testing – in order to test the entire system, and smoke testing is conducted in order to verify the performance of the main and most frequently used system functionality, for example, on the site for the booking of tickets for the plane should work itself booking and its cancellation.
23. What is the difference between iteration and recursion?
Iteration uses a loop to repeat an action several times, and the recursive function calls itself. Often recursion can provide a cleaner and more understandable solution for some tasks, for example: “towers of Hanoi”, a coup of a connected list or a line. On the other hand, each function call reduces the free space in the stack, and after a while you can get a stack overflow error. For this reason, iteration is usually preferable to recursion. More here .
24. What is the difference between operators
&Is a bit operator, and
&&is a logical operator .
&can be applied to both integers and Boolean types, while
&&– only to Boolean.
&is applied to each bit of both compared variables, while when using the
&&second, the argument may not be used at all, if the first one is false. I like this question, and I often ask it to both junior and senior developers. Click here for details .
25. What is the result of the operation 1 xor 1?
Answer: 0, because xor returns one only if one of the arguments is one, and the other is zero. For example, 0 xor 0 and 1 xor 1 are zero, and 1 xor 0 and 0 xor 1 is one.