×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

Lodash Framework Multiple-Choice Questions (MCQs)

Lodash is a JavaScript library. It provides utility functions for common programming tasks using the functional programming paradigm.

Lodash Framework MCQs: This section contains multiple-choice questions and answers on the various topics of Lodash Framework. Practice these MCQs to test and enhance your skills on Lodash Framework.

List of Lodash Framework MCQs

1. Which of the following method Divides an array into pieces of a certain size?

  1. _.chunk(array, size)
  2. _.peice(array, size)
  3. _.data(array, size)
  4. _.divide(array, size)

Answer: A) _.chunk(array, size)

Explanation:

_.chunk(array, size) method Divides an array into pieces of a certain size.

Discuss this Question


2. Which of the following method Gets rid of all false values in an array?

  1. _.del(array):
  2. _.remove(array):
  3. _.false(array):
  4. _.compact(array)

Answer: D) _.compact(array)

Explanation:

_.compact(array) method Gets rid of all false values in an array.

Discuss this Question


3. Lodash is a ____ library?

  1. C++
  2. JavaScript
  3. Java
  4. Python

Answer: B) JavaScript

Explanation:

Lodash is a JavaScript library.

Discuss this Question


4. The ____ function is used to retrieve the first entry of an array.

  1. _.one()
  2. _.fortharray()
  3. _.first()

Answer: C) _.first()

Explanation:

The _.first() function is used to retrieve the first entry of an array.

Discuss this Question


5. To flatten the array to one level deep, use the Lodash.flatten() function.

  1. Lodash.pureflatten()
  2. Lodash.deepflatten()
  3. Lodash.Oneflatten()
  4. Lodash.flatten()

Answer: D) Lodash.flatten()

Explanation:

To flatten the array to one level deep, use the Lodash.flatten() function.

Discuss this Question


6. The ____ method is used to return a random integer inside the function's supplied range.

  1. _.rand()
  2. _.createrandom()
  3. _.random()
  4. _.randomnumber()

Answer: C) _.random()

Explanation:

The _.random() method is used to return a random integer inside the function's supplied range.

Discuss this Question


7. The Lodash ____ method returns a numeric array.

  1. _.range()
  2. _.limit()
  3. _.array()

Answer: A) _.range()

Explanation:

The Lodash _.range() method returns a numeric array.

Discuss this Question


8. What will be the output of the following code?

const value = _.range(10);
console.log(value);
  1. [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ,10]
  2. [1, 2, 3, 4, 5, 6, 7, 8, 9 ,10,11]
  3. [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

Answer: C) [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

Explanation:

The output will be the range from 0 to 9 which makes the total of 10 numbers, therefore [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] will be the output.

Discuss this Question


9. What will be the output of the following code?

const value = _.range(0, 15, 5);
console.log(value);
  1. [ 0, 5, 10 ]
  2. [ 0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ]
  3. [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
  4. [ 0, 5, 10,15 ]

Answer: A) [ 0, 5, 10 ]

Explanation:

Following will be the output: [ 0, 5, 10 ], 15 will not be included in the range.

Discuss this Question


10. The function is called n times by ____ method.

  1. _.repeat()
  2. _.times()
  3. _.counter().

Answer: B) _.times()

Explanation:

The function is called n times by _.times() method

Discuss this Question


11. What will be the output of the following code?

array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let chunk1 = _.chunk(nums, 2);
console.log( chunk1);
  1. [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]
  2. [ 0, 1 ], [ 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8,9 ]
  3. [ [ 0, 1 ], [ 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8,9 ] ]

Answer: A) [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]

Explanation:

The following will be the output: [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9 ] ]

Discuss this Question


12. _.slice() method takes how many indexes?

  1. 1
  2. 2
  3. 3

Answer: B) 2

Explanation:

_.slice() method takes two indexes: starting and ending indexes.

Discuss this Question


13. In _.slice() method, the starting index is ____.

  1. Inclusive
  2. Exclusive

Answer: A) Inclusive

Explanation:

In _.slice() method, the starting index is inclusive.

Discuss this Question


14. In _.slice() method, the ending index is ____.

  1. Inclusive
  2. Exclusive

Answer: B) Exclusive

Explanation:

In _.slice() method, the ending index is exclusive.

Discuss this Question


15. What will be the output of the following code?

array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let slice1 = _.slice(nums, 3, 7);
console.log(slice1);
  1. [3, 4, 5, 6]
  2. [3, 4, 5, 6,7]
  3. [4, 5, 6,7]
  4. [3,4, 5, 6,7]

Answer: C) [4, 5, 6,7]

Explanation:

The following will be the output: [4, 5, 6,7].

Discuss this Question


16. The ____ method is used to shuffle a collection.

  1. _.reaarange()
  2. _.rotate()
  3. _.mix()
  4. _.shuffle()

Answer: D) _.shuffle()

Explanation:

The _.shuffle() method is used to shuffle a collection.

Discuss this Question


17. What are some alternatives to lodash?

  1. Underscore.js
  2. Ramda
  3. Rx.js
  4. ALL OF THE ABOVE

Answer: D) ALL OF THE ABOVE

Explanation:

Following are the alternatives of lodash:

  • Underscore.js
  • Ramda
  • Rx.js

Discuss this Question


18. Which of the following methods Reduces an array to a single value by applying a function to each element and aggregating the result?

  1. _.map()
  2. _.reduce()
  3. _.filter

Answer: B) _.reduce()

Explanation:

_.reduce() method Reduces an array to a single value by applying a function to each element and aggregating the result.

Discuss this Question


19. Which of the following Lodash methods generates an object that organizes array members depending on a provided iterate function?

  1. _.group()
  2. _.groupby()
  3. _.reduce()

Answer: B) _.groupby()

Explanation:

_.groupby() Lodash methods generate an object that organizes array members depending on a provided iterate function.

Discuss this Question


20. Which of the following Lodash methods generates a new array by applying a function to each member of the existing array?

  1. _.map()
  2. _.reduce()
  3. _.filter

Answer: A) _.map()

Explanation:

_.map() Lodash methods generate a new array by applying a function to each member of the existing array.

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.