0% found this document useful (0 votes)
3 views3 pages

Assignments-2021-22 in That Assignment-4

The document is an assignment from Zeal College of Engineering & Research focusing on Web Technology for the academic year 2021-22. It includes questions and answers about arrays in JavaScript, their differences from objects, and methods for manipulating arrays such as unshift(), sort(), map(), filter(), and reduce(). Each question is associated with a specific learning outcome and Bloom's taxonomy level.

Uploaded by

Janhavi Raikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Assignments-2021-22 in That Assignment-4

The document is an assignment from Zeal College of Engineering & Research focusing on Web Technology for the academic year 2021-22. It includes questions and answers about arrays in JavaScript, their differences from objects, and methods for manipulating arrays such as unshift(), sort(), map(), filter(), and reduce(). Each question is associated with a specific learning outcome and Bloom's taxonomy level.

Uploaded by

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

Zeal Education Society's

Zeal College of Engineering & Research, Pune


- 41 Department of Computer Engineering
Academic Year – 2021-22

Rollno-T213011

Course: Web Technology Course faculty:

Assignment No: 04 Date: Date of Submission:

Rollno- T213011

Question
Question CO Blooms Level
No.
Marks
Q1 What is an array in JavaScript? 3 C Remembering
-> An array in JavaScript is a special type of O1
object that allows you to store multiple values in a
single variable. Arrays can hold elements of any
data type, including numbers, strings, objects,
other arrays, and even functions.

Arrays in JavaScript are zero-indexed, meaning the


first element is at index 0, the second at index 1,
and so on.

example-let fruits = ["Apple", "Banana",


"Orange"];

console.log(fruits);

How are arrays different from objects in


Q2 3 C Understanding
JavaScript? O1
-> Arrays in JavaScript:An array in
JavaScript is a special type of object used to
store multiple values in a single variable.
Arrays are ordered collections, meaning
they maintain the order of their elements
based on numeric indices (starting from 0).

Objects in JavaScript: An object in JavaScript is


a collection of key-value pairs where keys (also
called properties) are strings (or Symbols), and
values can be of any data type, including other
objects, functions, and arrays. Objects are
unordered collections, meaning their properties do
not have a fixed order.
Zeal Education Society's
Zeal College of Engineering & Research, Pune
- 41 Department of Computer Engineering
Academic Year – 2021-22

Write a code snippet that adds an element to the


Q3 3 C Applying
beginning of an array. O1
->You can use the unshift() method to add an
element to the beginning of an array in JavaScript.
Here's a simple code snippet:
let fruits = ["apple", "banana",
"mango"];
fruits.unshift("orange");
console.log(fruits);
Given an array, how would you sort it in
Q4 3 C Analyzing
descending order using JavaScript? O1
->You can use the sort() method in JavaScript
along with a custom comparison function to sort
an array in descending order. Here's how:
let numbers = [5, 2, 9, 1, 7];
numbers.sort((a, b) => b - a);
console.log(numbers);

How would you evaluate the use of map(), filter(),


and reduce() methods in modern JavaScript over
Q5 3 C Evaluating
traditional loops for O1
manipulating arrays?
->1. map() – Transforming Arrays
eg-let numbers = [1, 2, 3, 4];
let squared = numbers.map(num => num * num);
console.log(squared);
2. filter() – Selecting Elements Based on a
Condition
eg-let numbers = [1, 2, 3, 4, 5, 6];
let evenNumbers = numbers.filter(num => num %
2 === 0);
console.log(evenNumbers);
3. reduce() – Accumulating Values
eg-let numbers = [1, 2, 3, 4, 5];
let sum = numbers.reduce((acc, num) => acc +
num, 0);
console.log(sum);

Course Faculty
Zeal Education Society's
Zeal College of Engineering & Research, Pune
- 41 Department of Computer Engineering
Academic Year – 2021-22

You might also like