Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

Which of the following is an array-like object in JavaScript?

View

How do you convert an array-like object (such as arguments) into a real array?

View

What is the result of the following code?

View

What does the spread operator (...) do when used with arrays?

View

What does the following code return?

View

Which of the following uses the rest operator correctly?

View

What does the rest operator do?

View

Which operator is used to expand elements from an iterable (such as an array)?

View

What is the output of the following code?

View

What is the result of combining arrays using the spread operator?

View

Which of the following is an array-like object in JavaScript?

NodeList
Array
String
All of the above

How do you convert an array-like object (such as arguments) into a real array?

Array.from(arguments)
Array.toArray(arguments)
[].slice.call(arguments)
Both a and c

What is the result of the following code?

function sum(...numbers) { return numbers.reduce((total, num) => total + num, 0); } console.log(sum(1, 2, 3, 4));

0
10
6
12

What does the spread operator (...) do when used with arrays?

Combines arrays
Extracts elements from arrays
Makes arrays immutable
Deletes elements from arrays

What does the following code return?

var arr1 = [1, 2]; var arr2 = [3, 4]; var combined = [...arr1, ...arr2]; console.log(combined);

[1, 2, [3, 4]]
[1, 2, 3, 4]
[[1, 2], [3, 4]]
[3, 4, 1, 2]

Which of the following uses the rest operator correctly?

function(...args) { return args }
function(...args) { return ...args }
function(args...) { return args }
function(args...) { return ...args }

What does the rest operator do?

Gathers all remaining arguments into an array
Extracts elements from arrays
Combines arrays
Removes elements from arrays

Which operator is used to expand elements from an iterable (such as an array)?

spread
spread()
...
@

What is the output of the following code?

var arr = [1, 2, 3]; console.log(Math.max(...arr));

undefined
3
NaN
Error

What is the result of combining arrays using the spread operator?

A new array with all elements
A reference to the original arrays
A copy of the first array only
The arrays are modified in-place