Search Header Logo

Functional Programming in JavaScript

Authored by Anonymous Anonymous

Mathematics

1st - 5th Grade

Functional Programming in JavaScript
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Let point be an object { x: 0, y: 0 }. What is the result of { x: 1, ...point }?

{ x: 0, y: 0 }

{ x: 0, y: 1 }

{ x: 1, y: 0 }

{ x: 1, y : 1 }

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Media Image

What is the output of the console.log?

{ x: 0, y: 0 }

[ 0, 0 ]

undefined

[Function: getPoint]

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Media Image

What will happen if the following code is executed?

A SyntaxError will be raised in the first line.

A SyntaxError will be raised in the second line.

The console.log will output [] (i.e. the empty array)

The console.log will output [Function (anonymous)]

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does { ...obj1, ...obj2 } do (assuming that obj1 and obj2 are objects)?

Creates a new object containing obj1 and obj2 as properties.

Creates a new object containing the keys of obj1 and obj2 as properties.

Creates a new object containing keys of obj1 and obj2 as properties unless obj1 or obj2 have equal keys.

Copies obj2 into obj1.

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of these statements about the filter method is true?

It retrieves all of the elements that meet a certain predicate

The returned elements are deep copied

The returned elements are shallow copied

It only works for primitive values

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does the expression Object.entries({ x: 0, y: 0 }).map(([x1, x2]) => [x1, x2]) return?

{ x: 0, y: 0 }

[ [ 'x', 0 ], [ 'y', 0 ] ]

Nothing, a SyntaxError will happen

[ 0, 0 ]

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of these statements are true about pure functions?

They have no side effects

They are easily testable

They don't mutate global state

Their output(s) depends only on their input(s)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?