ELIXIR Flashcards

(65 cards)

1
Q

Who is the Brazilian software engineer and co-founder of Plataformatec that created Elixir?

A

José Valim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In what year did José Valim publish version 0.5 of Elixir?

A

2012

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Elixir was built on top of which virtual machine originally created to power telecom systems?

A

Erlang virtual machine (BEAM)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the name of the high-performance web framework built on Elixir for scalable, real-time web applications?

A

Phoenix Framework

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Elixir follows the “let it crash” philosophy to recover gracefully from failures.
True or False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The latest version of Elixir, version 1.19, was released in what month and year?

A

October 2025

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the name of the build tool in Elixir that provides tasks for creating, compiling, and testing projects?

A

Mix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Elixir uses an interpreter as its translator program rather than a compiler.
True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Elixir emphasizes mutable data, meaning data can be changed once created.
True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Elixir source code written in .ex files is compiled into what type of bytecode?

A

BEAM bytecode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Create a statement in Elixir that explicitly binds the integer value 10 to the variable x.

A

x = 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Elixir natively supports user-defined subrange or enumerated types.
True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What built-in data structure in Elixir uses square brackets and is optimized for sequential traversal?

A

Lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What built-in data structure in Elixir uses curly brackets and stores elements contiguously in memory for fast indexed access?

A

Tuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Create a statement in Elixir that defines a tuple containing the atom :ok and the string “hello”.

A

{ :ok, “hello” }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the built-in data structure module in Elixir used for handling collections where uniqueness matters?

A

MapSet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What operator is used to concatenate strings in Elixir?

A

<>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

In Elixir, abstract data types are implemented using built-in language constructs rather than modules and structs.
True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What keyword is used in Elixir to define fixed data shapes within a module?

A

defstruct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Elixir uses the ASCII character set by default, preventing the use of international characters in strings.
True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

In Elixir, what operator is used for pattern matching and variable binding?

A

= (Match operator)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the name of the ^ operator used to prevent rebinding a variable in Elixir?

A

Pin operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The |> symbol is known as the pipeline operator in Elixir.
True or False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What delimiter separates patterns and expressions in anonymous functions and control structures like case and cond?

A

-> (Arrow operator)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Elixir code blocks are enclosed using curly braces. True or False
False
26
What symbol is used to introduce comments in Elixir?
(Hash symbol)
27
What punctuation mark is used to prefix atoms in Elixir?
: (Colon)
28
Identifiers for variables and functions in Elixir must be written in CamelCase. True or False
False
29
What macro is used to define a public function that forms a module's public API?
def
30
What macro is used to define a private, internal function accessible only within the defining module?
defp
31
Create a statement in Elixir that declares a namespace or module named Calculator.
defmodule Calculator do
32
Create a statement in Elixir that defines a public function named add that takes two parameters, a and b.
def add(a, b) do
33
Elixir enforces strict lexical scoping and immutable data, meaning there are no shared global variables. True or False
True
34
What module attribute is used in Elixir to attach documentation metadata immediately preceding a function definition?
@doc
35
In Elixir, the division operator always yields a floating-point result. True or False
True
36
What strict boolean operator in Elixir returns true only if both boolean operands are true?
and
37
What macro evaluates a boolean condition to implement two-way selection in Elixir?
if (or unless)
38
Elixir relies heavily on traditional pre-test (while) and post-test (do-while) loops for iteration. True or False
False
39
Iteration in Elixir is implemented primarily through what mechanism?
Recursion
40
What primitive function allows a developer to detach a subprogram to run in a separate, isolated process concurrently?
spawn
41
Elixir implements traditional symmetric coroutines with explicit yield and resume operators. True or False
False
42
What module facilitates lazy evaluation in Elixir, allowing a subprogram to generate a sequence of values one at a time?
Stream module
43
Create a statement in Elixir that explicitly halts or immediately terminates the runtime system.
System.halt
44
What function is explicitly used to perform integer division in Elixir?
div
45
In Elixir, an explicit return statement is required to exit a subroutine with a value. True or False
False
46
What compiler feature ensures that recursive self-reference does not consume additional stack frames in Elixir?
Tail-call optimization
47
What is the output of the following program snippet in Elixir? result = 5 * 2 IO.puts("Result is #{result}")
Result is 10
48
What is the output of the following program snippet in Elixir? Elixir [1, true, 2, false, 3, true] -- [true, false]
[1, 2, 3, true]
49
What is the output of the following program snippet in Elixir? "elixir" |> String.upcase() |> String.reverse()
"RIXILE"
50
What is the output of the following program snippet in Elixir? Stream.cycle([1, 2, 3]) |> Stream.take(5) |> Enum.to_list()
[1, 2, 3, 1, 2]
51
- What is the file extension for Elixir source files that are compiled?
.ex
52
- Which Elixir primitive enables a subprogram to run concurrently in a separate process?
spawn/1
53
- What operator prevents variable rebinding during pattern matching?
^ (pin operator)
54
- What Elixir construct allows multi-way selection and uses pattern matching to determine which branch to execute?
case
55
- Name the virtual machine that runs Elixir programs.
BEAM (Erlang Virtual Machine)
56
- In Elixir, variables are mutable by default, allowing values to be directly changed in memory. True or False
False
57
- The MapSet module in Elixir is used to manage collections of unique values and supports operations like union, intersection, and difference. True or False
True
58
- The ++ and -- operators modify the original list in-place when concatenating or subtracting elements. True or False
False
59
- Elixir source files with the .exs extension are compiled before execution, similar to .ex files. True or False
False
60
- In Elixir, the do … end keywords are used to delimit code blocks instead of curly braces {}. True or False
True
61
- What is the output of the program? a = 3 b = 7 c = 10 {[x, y], z} = {[b, a], c} x = x * 2 y = y + z z = z + y IO.inspect({x, y, z})
{14, 13, 23}
62
- Fill in the missing code so that the variable result is bound to "even" when n is even and "odd" otherwise. n = 7 result = case __________ do __________ -> "even" __________ -> "odd" end IO.puts(result)
(1) rem(n, 2) (2) 0 (3) _
63
- Analyze the following recursive function. What value is printed to the console? defmodule MathOps do def sum([], acc), do: acc def sum([h | t], acc), do: sum(t, acc + h) end IO.inspect(MathOps.sum([2, 4, 6], 0))
12
64
- Based on thIs expression, what list is produced? result = Stream.cycle([:a, :b]) |> Stream.take(4) |> Enum.to_list() IO.inspect(result)
[:a, :b, :a, :b]
65
- Fill in the blank to complete the output string. parent = self() spawn(fn -> send(parent, {:msg, 42}) end) receive do {:msg, value} -> IO.puts("Received: #{________}") end
value