Unit 3 Exam Questions
Exam questions for Unit 3.
Exam questions for Unit 3.
Endsem Exam Questions: Unit 3 Functions and Parameter Passing Q1. Contrast pass-by-value and pass-by-reference execution in JavaScript. JavaScript executes pass-by-value strictly for primitive types (Number, String, Boolean). The execution engine sends a discrete copy of the data into the function scope. Modifications to this parameter inside the function do not alter the original variable in the global scope. JavaScript executes pass-by-reference for composite types (Objects, Arrays). The function does not receive a copy of the object; it receives the memory address. Modifying the properties of the passed object within the local function permanently mutates the original object in the global state. This architecture demands rigorous side-effect management. ...