Although Elixir is not the most popular language among developers, it’s still widely used for developing scalable applications. Leveraging on the syntax of Erlang and the features of Ruby, Elixir is known for its high-level performance and code reusability. Although the technology is template-friendly and relatively easy to master, when looking for an Elixir developer, business owners should make sure the candidate they are choosing has a solid theoretical and practical grasp of the language. To make sure you land the right fit, take some time to create a list of well-rounded elixir vacancies interview questions. In this post, we are sharing 25 questions that test both the theoretical and the practical knowledge of Elixir.
Top 15 Basic Elixir Interview Questions
Question #1. What are the advantages of Elixir compared to other web development languages?
Answer: typically, a skillful candidate lists and elaborates on the following advantages of the language:
- Concurrency – Elixir apps support multithreading without halting the product’s performance. The language’s efficiency shows in the impeccable performance of the platforms in supports – Pinterest, Moz, and others.
- High scalability potential. Since Elixir builds on Erlang’s syntax, the language accommodates the needs of complex AI and IoT applications. Team leaders who choose the language can run apps on multiple virtual servers at once.
- High fault tolerance. Elixir is loved by developers because of its safety mechanisms – a robust failure alert system and the independence of application elements. Even if there’s a system failure, the components of an app hosted on a different server will run errorlessly.
- High readability. Elixir uses simple expressions and intuitive methods to execute commands. The language’s syntax is succinct and easy to understand – that’s why Elixir developers don’t need a lot of time to finish onboarding.
- Phoenix framework. This technology makes migrating from Rails to Elixir a piece of cake. Other than that, the framework supports real-time processing both on the server- and client-side (the latter runs JS in the background).
Question #2. What data type categories are there in Elixir?
Answer: developers classify Elixir data into two broad categories:
- Constant data types: numbers and atoms.
- Compound data that allow connecting constant data. These, for example, are tuples or lists.
Question #3. What are some of the best Elixir error handling questions?
Answer: although this question has room for interpretation, it’s a helpful one for when you want to hire a developer. It will clearly showcase the candidate’s willingness to stick to well-defined conventions, as well as the ambition for constant improvement.
Here are some worthwhile practices developers can mention during the interview:
- Preferring two-element tuples over variable-element ones.
- Avoiding strings for error handling.
- A developer can consider using some non-error structs for error-handling. %Ecto.Changeset{}, for one, is a good fit since it has errors and valid? properties.
Question #4. Define Elixir modules
Answer: Ideally, a developer should give an interview a definition that closely resembles that from the official documentation.
A module is a piece of Erlang code consisting of function declarations and attributes. Each module declaration is terminated by a period (.) symbol.
Module attributes have a well-defined structure as well. Each of those has a value and a tag. A value of an attribute can only be a literal item while a tag is an atom. The meanings of an attribute can either be pre-defined or user-defined.
Question #5. Describe guard() sequences in Elixir.
Answer: in Elixir, guard() sequences derive from when() clauses in Erlang. Their main function is pattern matching augmentation. Guards allow developers to specify predicates for a given argument type, as seen in the example below:
defmodule Sum do def to(1), do: 1 def to(n) when n > 0, do: n + to(n-1) # only nonzero positive numbers
It’s worth noting that most expressions don’t support guard testing.
Developers mainly use guards when working in Kernel. In and not in boolean-only, and comparison operators, as well as datatype and type-check functions, support guard expressions.
Question #6. Explain the difference between Spawn_link 1|3/ and Spawn/ 1|3
Answer: Spawn_link/1|3 creates one more link than Spawn/ 1|3. The new link is created between a spawn process and the caller.
Spawn/ 1|3, on the other hand, creates a single link for a new process. After it’s added to the queue in the scheduler, a new process will run without hindering the application’s performance. Spawn/ 1|3 returns pid.
Question #7. What are records in Erlang
Answer: Records are data structures with a fixed number of stored elements. When the compiler runs the code, it translates records into tuples. This is a detail worth remembering since it means that a record as-is will not be understood by the shell.
Here are the most common operations involving records in Erlang:
- Defining the name and the fields of a record. Both elements should only consist of atoms. If there’s no value inside a record, it’ll be labeled as undefined. Here’s an example of defining an Erlang record:
-record(Name, {Field1 [= Value1], ... FieldN [= ValueN]}).
- Returning the position of a record field and updating records using Expr#Name.field. This action helps developers navigate records quickly and efficiently. Here’s an example of a record field assessment.
- Creating records in patterns and nested items.
Question #8. What Elixir pre-defined macros do you use?
Answer: as an answer to this question, senior developers typically expect juniors to name a few pre-defined macros and elaborate on their benefits. Most elixir career candidates’ answers feature the following:
- As for modules or Module_Strings, they return a name of a module as is or in the syntax of a string.
- Returning a file name for a file.
- Lines return line numbers.
- Machines return their existing names.
Question #9. Explain String Interpolation in Elixir
Answer: by definition, string interpolation is a practice used to join two strings together in a new object. An interpolated string is wrapped in the # function, as well as curly brackets.
Here’s an example of Elixir string interpolation:
x = "Apocalypse" y = "X-men #{x}" IO.puts(y) x = "Apocalypse" y = "X-men #{x}" IO.puts(y)
Question #10. What operator types does Elixir support?
Answer: In Elixir, operators are mainly used to create and manage arithmetic expressions. Here are the operator types the language supports:
- Boolean operators
- Arithmetic operators
- Misc operators
- Comparison operators.
Question #11. Explain Elixir’s handling of concurrency
Answer: since concurrency support is one of the language’s selling points, looking for a developer in Elixir web development job openings who understands and feels comfortable implementing the concept makes complete sense.
Here’s an approximation of how an elixir job candidate should explain concurrency handling on the interview:
Elixir concurrency is built upon the Actor model, according to which, a single process is an independent actor. The elements of the system can exchange data but are managed by the virtual machine.
The memory of each process is fully isolated from others allowing developers to ensure elements’ independence. For communication, processes rely on the mailbox and commands – such as send and receive. Developers also need to use loops to ensure the stability of long-running actors.
Question #12. What is the difference between concurrency and parallelization?
Answer: When it comes to concurrency, the processes are independent of each other and can, but don’t have to run in the same period of time.
Parallelism, on the other hand, directly refers to processes running in the same period of time.
Essentially, while two parallel processes are definitely concurrent, two concurrent tasks won’t’ necessarily be parallel.
Question #13. Define Port Mapper Daemon
Answer: in Elixir, Port Mapper Daemon is a server that supports distributed communications. It helps map out node names for a specific machine address. It’s worth noting that Port Mapper Daemon uses the 4369 port – the development team should keep it open.
The number of earmarks should correspond to the number of nodes in a given security group.
Question #14. Describe the process of sending and receiving messages in Elixir
Answer: to send messages in Elixir, a developer needs to know the ID of a process. The overall syntax looks as follows.
iex > send(id(), :text) :text
The text after the “:” is what the system returns.
A developer should mention that after the system sent a message from one process to another, it will not get retrieve until the “receive” function is called. For the time being, it will stay stored in the mailbox.
To see which messages there are in the inbox of each process, call Process.info/
iex > Process.info(self(), :messages) {:messages, [:hi]}
To get a message from one process to another, developers run the receive/1 macro.
iex > receive do :text -> IO.puts "Hello." end Hello. :ok iex > Process.info(self(), :messages) {:messages, []}
It’s important to make sure that the function matches the message atom.
Question #15. What is OTP in Elixir
Answer: OTP (short from Open Telecom Platform) is a set of libraries, tools, and middleware techology originally written in Erlang and widely used by Elixir. Despite its name, OTP is not specific to telecom projects only.
Some of the elements OTP contains are:
- Interpreter (for Elixir, it’s BEAM)
- Compiler
- Node (server) communication protocol
- Dialyzer – a static analysis tool.
- Object Request Broker – CORBA
- Mnesia – a database server (distributed).
This is not the full list of OTP middleware – there are many other specific libraries developers use depending on the tasks at hand.
5 Practical Questions to Asses Elixir Developer Skills
Now that a developer has shown a solid understanding of theoretical concepts behind Elixir, it’s time to see how skillfully elixir programming jobs candidates solves practice problems. Other than checking the answers to questions, be sure to watch a prospective employee to test her stress resistance, concentration, and attention to detail.
Here are a few interesting Elixir practice problems senior developers use.
Task #1. Calculate the angle between the hands of the clock using the text data of your choice.
Task #2. Create a program that analyzes a range of points and returns those closest to the origin of the coordinate plane.
Input ponts: (2,1), (0,2), (0,1), , (5, 5)
Desired number of points in the output – 3.
Output points: (0,1), (0, 2), (2, 1)
Task #3. Create a program that returns all numbers from 1 to 100. However, instead of the multiples of three, return “Fizz”.
Make sure that the multiples of 5 return “Buzz”. The numbers that are multiples of both 3 and 5 should print “FizzBuzz”.
Task #4. Create two data sets and build a routine that returns the symmetric difference between the two.
Note: the symmetric difference between elements is the range of values that aren’t repeated in either set.
This interview question tests the candidate’s ability to parse the command line and create sets that could be used by functions.
Task #5. Create a routine that both encodes and decodes two strings. An interview can use the following strings for input and output:
Input: abbcccddddeeeeeffffff
Output:a1b2c3d4e4f6
High Elixir Developer Salaries – A Challenge to Overcome
Interviewing Elixir coders for hire is challenging enough – however, this is not the main issue business owners have to tackle as they are looking forward to expanding their tech teams.
Unfortunately, a lot of team managers struggle to find a good developer due to high working rates. According to statistics, the average salary of an Elixir developer is $167,000 – that’s not the budget all business owners can afford.
Build an Affordable In-House Team Abroad
The good news is, there’s a way to hire web developers by getting in touch with global professionals. Outside Western Europe and the US, a yearly salary of an Elixir developer is much lower. That’s why business owners move their headquarters abroad and create in-house teams all over the world.
If you are looking for a reliable Elixir development team, create one with Bridge Teams. We help SMEs and large-scale corporations from all over the world to get in touch with professionals from Ukraine, Mexico, and Argentina. The cost savings business owners benefit from are drastic – see them for yourself with our calculator.
Build a powerful Elixir development team with Bridge Teams. Leave us a message to find out how to get in touch with top-notch professionals from Eastern Europe and Latin America.