Elixir Interview Questions

Elixir Interview Questions | Freshers & Experienced

  • Sharad Jaiswal
  • 15th Mar, 2021
  • 484 Followers

Key Features of Elixir

Below are few major features of Elixir

Erlang VM

Immutability

Pattern matching

Simple and consistent

Concurrency

Fault tolerance

Ruby-like syntax

Functional

Dynamic typing

Elixir Interview Questions and Answers

Q1. How To Create A Map In Elixir?

You can create a map in elixir by using the following syntax: Syntax: % {}

Q2. How to perform String Interpolation in Elixir?

In elixir, String Interpolation is a way that is used to construct a new String value and the code is wrapped within the curly braces and ‘#’ symbol.

Q3. What are main features of Elixir?

Some of the main features of Elixir are as follows:

  • Functional Programming
  • Erlang Compatibility
  • Fault of tolerance
  • Build tools
  • Scalability

 

Q4. How to install Elixir on Mac Book?

You can install Elixir on Mac Book with the help of the following steps:

  • Install Homebrew (Mac OS X package manager) if you haven't already.
  • Open a Terminal. 
  • Type brew update to make sure your Homebrew installation is up to date.
  • Type brew installs elixir to download and install the Elixir package.
  • Now you should have a working Elixir installation.

Q5. How to read and write a file in Elixir?

To read and write files in Elixir, one must use the functions in the IO module. By default, a file is opened in binary mode, which requires the functions IO. binread/2 and IO. binwrite/2 to interact with the file.

Q6. For what sigil are used in Elixir?

In Elixir, The ~w sigil is used to generate lists of words where the words are just regular strings. Inside the ~w sigil, words are separated by whitespace.

Q7. What are Macros in Elixir?

Macros are one of the important aspects of Elixir that are used to define things that would be keywords in other languages: defmodule , def , defp , defmacro , and defmacrop are all macros defined by the standard library in Kernel.

Q8. How to create a Macro in Elixir?

In Elixir, Macros are defined via defmacro/2.Macros are compile-time constructs that are invoked with Elixir's AST as input and a superset of Elixir's AST as output.

Q9. How to define a Struct in Elixir?

In Elixir, the Structs are defined within the context of a module using defstruct to define the struct's properties and default values. Structs are basically extensions built on top of maps that provide compile-time checks and default values.

Q10. List types of variables supported by Elixir?

The types of variables supported by Elixir are as follows:

  • Integer - These are used for Integers. 
  • Floats - Floats have a 64-bit precision in elixir. 
  • Boolean - They can take up 2 values which are either true or false.
  • Strings - Strings are utf-8 encoded in elixir. 
  • Anonymous Functions/Lambdas.
  • Collections.

About Author :

  • Author of Elixir Interview Questions

    Sharad Jaiswal

    My name is Sharad Jaiswal, and I am the founder of Conax web Solutions. My tech stacks are PHP, NodeJS, Angular, React. I love to write technical articles and programming blogs.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.