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

Javascript Assessment

The document outlines a JavaScript assessment for Level 3 Software Development, focusing on asynchronous programming, objects, sets, maps, and arrays. It includes definitions, coding tasks, and comparisons of various JavaScript concepts, requiring students to demonstrate their understanding through practical examples and explanations. The assessment is structured into two parts, covering theoretical knowledge and practical application in JavaScript programming.

Uploaded by

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

Javascript Assessment

The document outlines a JavaScript assessment for Level 3 Software Development, focusing on asynchronous programming, objects, sets, maps, and arrays. It includes definitions, coding tasks, and comparisons of various JavaScript concepts, requiring students to demonstrate their understanding through practical examples and explanations. The assessment is structured into two parts, covering theoretical knowledge and practical application in JavaScript programming.

Uploaded by

isimbideborah7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

APPLY JAVASCRIPT ASSESSMENT NO.

2
Class: L3SOD

Date: 3/2/2026

PART I: JavaScript Asynchronous Programming


1. Define asynchronous programming in JavaScript.

2. What is a callback function?

3. List the three possible states of a JavaScript Promise.

4. Write the basic syntax for: a) A callback function b) A Promise c) An async function

5. What keyword is used to pause execution inside an async function?

6. Explain how the JavaScript event loop enables asynchronous behavior.

7. Describe how callbacks handle asynchronous operations.

8. Explain the difference between .then() and async/await.

9. Why are promises considered an improvement over callbacks?

10. What is 'callback hell', and why is it problematic?

11. Write a function that uses a callback to simulate fetching data after a delay.

12. Convert the following callback-based function into a Promise-based function.

Code Example:

function fetchData(callback) {
[Link]("Fetching data...");

setTimeout(() => {
const data = {
id: 1,
name: "Sample Data",
timestamp: [Link]()
};

callback(null, data);
}, 2000);
}
Usage:

fetchData((error, result) => {


if (error) {
[Link]("Error:", error);
} else {
[Link]("Data received:", result);
}
});

13. Use .then() and .catch() to handle a Promise that may resolve or reject.

14. Rewrite a Promise-based function using async/await.

15. Implement error handling using try...catch in an async function.

16. Evaluate the use of async/await in large-scale applications. What are its benefits and
limitations?

17. Given a real-world scenario (e.g., API calls or file uploads), justify which asynchronous
pattern you would use and why.

18. Design and implement a weather mini application that fetches data asynchronously,
uses async/await, handles errors, and executes multiple asynchronous tasks efficiently.

PART II: JavaScript Objects, Sets, Maps, and Arrays


1. Define a JavaScript object.

2. List two ways to create objects in JavaScript.

3. What is an object constructor?

4. Define a JavaScript Set.

5. Define a JavaScript Map.

6. State the difference between a Set and an Array.

7. What is the difference between a Map and a regular JavaScript object?

8. Define a one-dimensional array.

9. Define a two-dimensional array.

10. List any five built-in JavaScript array methods.

11. Explain how object literals store key-value pairs.


12. Explain how object constructors create multiple object instances.

13. Describe how a Set does not allow duplicate values.

14. Explain how Maps maintain insertion order.

15. Describe the structure of a two-dimensional array.

16. Explain the purpose of these array methods: push(), pop(), map(), filter(), reduce().

17. Explain the difference between forEach() and map().

18. Create an object using an object literal to store student details.

19. Create an object using a constructor function.

20. Create a Set and add multiple values including duplicates. Observe the result.

21. Create a Map to store employee IDs and names.

22. Declare a one-dimensional array and perform: add, remove, and update an element.

23. Create a two-dimensional array and access a specific value.

24. Use array methods to: find even numbers, transform array values, and calculate the sum
of elements.

25. Compare object literals and object constructors.

26. Compare: a) Arrays and Sets b) Objects and Maps

27. When would you use a Map instead of an object? Justify your answer.

28. Evaluate the advantages of using Sets over arrays for data validation.

29. Design a student management system using objects for student data and arrays to store
multiple students.

You might also like