Haskell Interview Questions

1) What is Haskell?

Haskell is a functional programming language. It is based on mathematical functions. This programming language is more intelligent than other popular programming languages.

2) Who is the developer of Haskell?

Lennart Augustsson is the developer of Haskell.

3) Write a program in Haskell to print “Haskell Expert”?

Example:

OUTPUT:

4) What is Tuple in Haskell?

Tuple is used to declare multiple values in a single data type. Tuple is heterogeneous and immutable in nature. Tuples are represented by single parenthesis.

5) What are the types of operators used in Haskell?

The types of operators used in Haskell are:

  • Addition Operator
  • Subtraction Operator
  • Multiplication Operator
  • Division Operator
  • Sequence / Range Operator

6) What are the types of Monads used in Haskell?

The types of Monads used in Haskell are:

  • List Monad
  • Error Monad
  • Reader Monad
  • Failure Monad
  • State & Writer Monad

7) What is the difference between Haskell and Erlang?

The difference between Haskell and Erlang are:

Haskell Erlang
Offers the features like lazy evaluation, equations, higher order functions, pattern matching over algebraic data type, etc. Offers the features like pattern matching, higher order functions, fault tolerance, dynamic code reloading etc.
No built in support for concurrency in Haskell built in support for concurrency
Static typing Dynamic typing

8) What are the types of polymorphism you will encounter in Haskell?

The types of polymorphism used in Haskell are:

  • Parametric Polymorphism
  • Bounded Polymorphism

9) How data types are combined in Haskell?

There are two ways to combine data types in Haskell are:

10) What is Zippers?

Zippers are basically pointers that point to some specific location of a data structure. Example: Tree

11) What are the basic laws that are applicable over a Monad declaration in Haskell?

There are three basic laws that are applicable over a Monad declaration are:

12) What is Monoid?

Monoid is a set of functions and operators. In Monoids, The output is independent of its input.

13) What are the types of Modules used in Haskell?

The types of Modules used in Haskell are:

  • List Module
  • Char Module
  • Map Module
  • Set Module
  • Custom Module

14) What is Function Composition in Haskell?

The process of using the output of one function as an input of another function is known as Function Composition.

15) Which operator is used to implement function composition in Haskell?

The dot operator (.) is used to implement function composition in Haskell.

Leave a Comment