Erlang Latest Advanced Interview Questions And Answers

Erlang Programming language Latest Advanced Interview Questions And Answers

What Is Erlang?

Erlang is a general purpose programming language and a runtime environment. It has built in support for concurrency, fault tolerance and distribution. Erlang is available as an open source.

How Run-time Error Is Handled In Erlang?

It is possible to prevent run-time errors and other exceptions from causing the process to terminate by using Catch or Try. Catch Expr returns the value of expression unless an exception occurs during the evaluation. Try Exprs is the enhancement of catch with ability to identify the exception class and choose to handle the desired one.

Erlang Latest Advanced Interview Questions And Answers
In Erlang How “process” Is Created?

The process is created by calling spawn, and spawn forms a new process and returns the pid.

Spawn (Module, Name, Args ) -> pid ()

Define Guard Sequence And What Are The Valid Guard Expressions?

Erlang function clauses can be protected with guards; a clause can be protected only if the guard holds. It is a sequence of guards, separated by semicolon (;), and a guard is a sequence of guard expressions separated by comma (,). The guard sequence is true if at least one of the guards is true.

Explain What Is A Record And How You Can Define Records In Erlang?

For storing a fixed number of elements, a data structure is used which is referred as record. Expressions are translated into tuple expressions during compilation record.

Record in Erlang is defined by the name of the record, followed by the field names of the record. Record and field names must be atoms.

record (Name, { Field1 [= Value] , … FieldN [= ValueN] } )

Mention What Is The Command Used For Accessing Record Field In Erlang?

Expr#Name.Field, this command will return the value of the mentioned field while for returning the position of the specified field #Name.Field is used.

Explain What Is Epmd?

epmd is a small name server which is used by Erlang programs when establishing distributed Erlang communications. It is also referred as an Erlang Port Mapper Daemon. It is responsible for mapping the symbolic node names to machine addresses it is used.

Give The List Of Valid Guard Expressions?

Valid guard expressions are:

Atom true,
Other constants
Calls to the BIFs specified
Term Comparisons
Arithmetic Expressions
Boolean Expressions
Short-circuit Expressions

Explain How Message Is Send And Receive In Erlang?

For sending message Erlang uses the exclamation mark (!) as the operator for sending a message. The syntax used for sending a message is Pid ! Message.

For receiving message Erlang uses Pattern Matching, to deliver a message from the message queue receive statement is used.

Explain What Is Spawn/ 1l3 And Spawn_link 1l3?

Spawn/ 1l3: It creates a new process and return its pid. In system scheduler queue, the new process is placed so that it runs some time later.

Spawn_link/1l3: It provides the same functionality as spawn/1l3 but with the addition of a link that is atomically created between the newly spawned process and the caller.

Mention What Is The Syntax To Write Macros In Erlang?

The syntax used to write Macros in Erlang is

define ( Const, Replacement ).
define ( Fun ( Var1 , Var2, …., Var ) , Replacement )

Explain What Is Otp (open Telecom Platform)?

OTP is an open source platform, and it is a large set of libraries for Erlang to do all from compiling ASN.1 to providing a WWW server.

What Are The Key Features Of Erlang?

Key features for Erlang is that it has:

Declarative Syntax: It has got declarative syntax
Concurrent: It has process based model of concurrency
Real time: It programs real time system
Continuous Operation: It allows continuous operation
Robust: For detecting runtime errors it has three constructs in the language
Memory Management: Memory is allocated automatically and de-allocated when not required
Distribution: It has got no shared memory, distributed systems can be easily be built in erlang
Integration: Easy integration of program written in other language.

Name The Datatypes That Erlang Provides?

Erlang provides two datatypes:

Constant data types: These types of data types cannot be split into more primitive subtypes. It consists of Numbers and Atoms.
Compound data types: These types of data types are used to group together other types of data types. It consists of tuples and lists.

What Is The Command To Disconnect Node In Erlang?

By calling erlang: disconnect_node (Node) will force disconnection of the node.

Explain What Is Modules In Erlang?

Erlang enables to organize code into modules. A module consists of functions; it introduces a local scope of functions (Public and Private).

Mention How Module Is Stored In Erlang?

A module name is stored in a file named .erl. File basename and module name must be the same.

Explain What Is Bit Strings In Erlang?

To store an area of untyped memory, a bit string is used and are expressed using the bit syntax.

Explain What Is Pattern Matching?

A pattern matching occurs when evaluating a function call. Through pattern matching mechanism, variables are bound to the values.

Explain What Is Pid Datatype?

PID mean Process Identifier and is the datatype used for the unique process identifiers which are assigned to every process.

To Include A File In Erlang What Is The Command Used?

In two ways, a file can be included in Erlang

include (File).
include_lib (File).

List Out The Pre-defined Macros In Erlang?

The pre-defined Macros in Erlang is

Module: It returns the name of the current module
Module_String: It returns the name of the current module, as a string
File: It returns the current file name
Line: It returns the current line number
Machine: It returns the current machine name, ‘BEAM.’

Post a Comment

Previous Post Next Post