D278A ITSW 2113
Scripting & Programming Foundations
Objective Assessment (Qns & Ans)
2025
General Instructions
1. Read All Questions Carefully: Make sure you understand each question.
2. Time Management: You have a specific amount of time to complete the exam.
Keep an eye on the clock and pace yourself.
3. Allowed Materials: Only use materials that are explicitly allowed. Unauthorized
materials can lead to disqualification.
4. ANS Format: Follow the required format for your ANS. For example, multiple-
choice questions might need you to select the best ANS, while essay questions
require detailed responses.
5. Academic Integrity: Adhere to the university's honor code. Any form of cheating or
plagiarism is strictly prohibited.
6. Technical Requirements: Ensure your computer and internet connection are
stable. For online exams, you might need a webcam and microphone for proctoring
purposes.
7. Submission: Submit your ANS before the time expires. Late submissions might
not be accepted.
©2024/2025
,1. Which of the following features is included in ES6
(ECMAScript 2015)?
- A) Var declaration
- B) Block-scoped variables
- C) NaN property
- D) Functions as declarations
Correct Answer: B) Block-scoped variables
Rationale : ES6 introduced `let` and `const`, which allow for
block-scoping, improving variable management.
2. In JavaScript, which method is used to convert a string to a
number?
- A) parseString()
- B) Number()
- C) toString()
- D) convertToNumber()
Correct Answer: B) Number()
©2024/2025
, Rationale : The `Number()` function converts a string
representation of a number into an actual number.
3. What will the following code output? `console.log(typeof
NaN);`
- A) "number"
- B) "undefined"
- C) "NaN"
- D) "object"
Correct Answer: A) "number"
Rationale : In JavaScript, `NaN` is considered a type of
number, and its type is returned as "number."
4. Which of the following is NOT a valid way to define a
function in JavaScript?
- A) function myFunction() {}
- B) const myFunction = function() {};
- C) const myFunction: () => {};
- D) const myFunction = () => {};
Correct Answer: C) const myFunction: () => {};
©2024/2025
, Rationale : The syntax in C is incorrect; it should use the `=`
operator instead of `:`.
5. What does the `this` keyword refer to in the global context of
a function?
- A) The global object
- B) The current object instance
- C) An undefined value
- D) The strict mode context
Correct Answer: A) The global object
Rationale : In non-strict mode, `this` in the global context
refers to the global object, typically `window` in browsers.
Fill-in-the-Blank Questions
6. The primary purpose of a __________ is to handle
asynchronous operations in JavaScript.
Correct Answer: Promise
Rationale : Promises provide a cleaner way to work with
asynchronous code, making it more manageable.
©2024/2025
Scripting & Programming Foundations
Objective Assessment (Qns & Ans)
2025
General Instructions
1. Read All Questions Carefully: Make sure you understand each question.
2. Time Management: You have a specific amount of time to complete the exam.
Keep an eye on the clock and pace yourself.
3. Allowed Materials: Only use materials that are explicitly allowed. Unauthorized
materials can lead to disqualification.
4. ANS Format: Follow the required format for your ANS. For example, multiple-
choice questions might need you to select the best ANS, while essay questions
require detailed responses.
5. Academic Integrity: Adhere to the university's honor code. Any form of cheating or
plagiarism is strictly prohibited.
6. Technical Requirements: Ensure your computer and internet connection are
stable. For online exams, you might need a webcam and microphone for proctoring
purposes.
7. Submission: Submit your ANS before the time expires. Late submissions might
not be accepted.
©2024/2025
,1. Which of the following features is included in ES6
(ECMAScript 2015)?
- A) Var declaration
- B) Block-scoped variables
- C) NaN property
- D) Functions as declarations
Correct Answer: B) Block-scoped variables
Rationale : ES6 introduced `let` and `const`, which allow for
block-scoping, improving variable management.
2. In JavaScript, which method is used to convert a string to a
number?
- A) parseString()
- B) Number()
- C) toString()
- D) convertToNumber()
Correct Answer: B) Number()
©2024/2025
, Rationale : The `Number()` function converts a string
representation of a number into an actual number.
3. What will the following code output? `console.log(typeof
NaN);`
- A) "number"
- B) "undefined"
- C) "NaN"
- D) "object"
Correct Answer: A) "number"
Rationale : In JavaScript, `NaN` is considered a type of
number, and its type is returned as "number."
4. Which of the following is NOT a valid way to define a
function in JavaScript?
- A) function myFunction() {}
- B) const myFunction = function() {};
- C) const myFunction: () => {};
- D) const myFunction = () => {};
Correct Answer: C) const myFunction: () => {};
©2024/2025
, Rationale : The syntax in C is incorrect; it should use the `=`
operator instead of `:`.
5. What does the `this` keyword refer to in the global context of
a function?
- A) The global object
- B) The current object instance
- C) An undefined value
- D) The strict mode context
Correct Answer: A) The global object
Rationale : In non-strict mode, `this` in the global context
refers to the global object, typically `window` in browsers.
Fill-in-the-Blank Questions
6. The primary purpose of a __________ is to handle
asynchronous operations in JavaScript.
Correct Answer: Promise
Rationale : Promises provide a cleaner way to work with
asynchronous code, making it more manageable.
©2024/2025