0% found this document useful (0 votes)
911 views1 page

Scala Constructs

The document discusses key concepts related to functional programming and Scala programming language including: - Immutability, pure functions, and referential transparency are key concepts of functional programming - List is the default collection class imported from scala.collection.immutable - val is the preferred qualifier for defining variables in Scala - Case classes can contain member functions - Higher order functions allow passing functions as arguments to other functions

Uploaded by

Ayush Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
911 views1 page

Scala Constructs

The document discusses key concepts related to functional programming and Scala programming language including: - Immutability, pure functions, and referential transparency are key concepts of functional programming - List is the default collection class imported from scala.collection.immutable - val is the preferred qualifier for defining variables in Scala - Case classes can contain member functions - Higher order functions allow passing functions as arguments to other functions

Uploaded by

Ayush Garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

Can the following pseudo function be considered a pure function ?

function getMeTimeAdded(arg
Integer) = currentTime + Integer no

Functional programming language cannot be an object oriented language too False

Scala is a pure functional programming language False

You can modify an immutable object once created No

Which of the following are the key concepts of Functional Programming a. Immutability b. Pure functions
c. Inheritance d. Referential Transparency .a,b,d

Is this a valid expression val f: Int = (x: Int) => x + 1 No.

For the given statement, val s = List(1,2,3) What would be the type of s?List[Int]

What would be the output of following snippet

val s = List(1,2,3,4)

val t = List(5,6,7,8)

val n = s ++ t

println(n) List(1, 2, 3, 4, 5, 6, 7, 8)

What is the default class List is imported from ?scala.collection.immutable

What is the preferred qualifier for defining a variable in Scala.val

Case classes can not contain member functions False

What would be the type inferred by Scala compiler for variable salary. val salary = 3000.00 Float

Which of the following provides way to multiple inheritances in Scala interface

Consider the following code snippet (a: Int) => a*a. Above code snippet is an example of higher order
function

val f = (x: Int) => x + 1

You might also like