Docsity

JSA Certified Associate JavaScript Programmer Exam Questions, Exams of Technology

Toggle sidebar
bg1
JSA 41 01 JSA Certified Associate
JavaScript Programmer Exam
Question 1. What is the primary way to create a new object using literal
notation in JavaScript?
A) new Object()
B) {}
C) Object.create()
D) Object.new()
Answer: B
Explanation: {} is the literal notation used to create a new object in
JavaScript quickly and easily.
Question 2. How can you add a new property 'age' with value 30 to an
existing object 'person'?
A) person.addProperty('age', 30)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download JSA Certified Associate JavaScript Programmer Exam Questions and more Exams Technology in PDF only on Docsity!

JavaScript Programmer Exam

Question 1. What is the primary way to create a new object using literal notation in JavaScript? A) new Object() B) {} C) Object.create() D) Object.new() Answer: B Explanation: {} is the literal notation used to create a new object in JavaScript quickly and easily. Question 2. How can you add a new property 'age' with value 30 to an existing object 'person'? A) person.addProperty('age', 30)

JavaScript Programmer Exam

B) person['age'] = 30 C) person.set('age', 30) D) person.property('age', 30) Answer: B Explanation: Using bracket notation, you assign a value to a property dynamically or directly. Question 3. Which operator is used to check if an object has a specific property directly (not inherited)? A) in B) hasOwnProperty() C) exists() D) property()

JavaScript Programmer Exam

Question 5. How does the '==' operator compare objects in JavaScript? A) Checks deep equality B) Checks reference identity C) Converts objects to strings and compares D) Always returns false for objects Answer: B Explanation: '==' compares object references, not their content; objects are equal only if they reference the same object. Question 6. Which method creates a shallow copy of an object? A) Object.clone() B) Object.assign()

JavaScript Programmer Exam

C) Object.deepCopy() D) Object.copy() Answer: B Explanation: Object.assign() copies properties from source to target object, creating a shallow clone. Question 7. What does the spread operator (...) do when used with objects? A) Deep clones the object B) Creates a shallow copy of the object C) Merges objects into a string D) Converts object to array Answer: B

JavaScript Programmer Exam

Question 9. Which method is used to define a property with specific attributes, such as writable or configurable? A) Object.defineProperty() B) Object.setProperty() C) Object.property() D) Object.create() Answer: A Explanation: Object.defineProperty() allows detailed configuration of object properties. Question 10. What does Object.preventExtensions() do to an object? A) Prevents adding new properties B) Makes all properties non-writable

JavaScript Programmer Exam

C) Freezes the object completely D) Seals the object Answer: A Explanation: preventExtensions() prevents adding new properties but allows modification or deletion of existing ones. Question 11. How do you declare a class in JavaScript? A) function MyClass() { ... } B) class MyClass { ... } C) new class MyClass { ... } D) define MyClass { ... } Answer: B

JavaScript Programmer Exam

Question 13. How do you create an instance of a class named 'Car'? A) new Car() B) Car() C) create Car() D) instantiate Car() Answer: A Explanation: Using new with the class name calls the constructor to create a new object. Question 14. How can a subclass inherit from a parent class in JavaScript? A) extends keyword B) inherits keyword

JavaScript Programmer Exam

C) prototype Chain D) subclass keyword Answer: A Explanation: The extends keyword is used for inheritance between classes. Question 15. What is the purpose of the super keyword inside a subclass constructor? A) To call the parent class constructor B) To define a new property C) To override methods D) To indicate static context Answer: A

JavaScript Programmer Exam

A) They are called on the class, not instances B) They are inherited automatically C) They are private D) They cannot have parameters Answer: A Explanation: Static methods are called directly on the class, not on individual objects. Question 18. What is the core idea behind prototypes in JavaScript? A) Objects are linked via a prototype chain for inheritance B) Each object has a class C) Objects are created from classes only

JavaScript Programmer Exam

D) Prototype is used only for built-in objects Answer: A Explanation: JavaScript objects inherit properties through a prototype chain. Question 19. Which built-in object provides number-related constants and functions? A) Math B) Number C) MathObject D) NumberUtil Answer: B

JavaScript Programmer Exam

A) Math.round() B) Math.floor() C) Math.ceil() D) Math.trunc() Answer: B Explanation: Math.floor() rounds down towards negative infinity. Question 22. How do you generate a random number between 0 (inclusive) and 1 (exclusive)? A) Math.random() B) Math.randomNumber() C) Math.randomInt()

JavaScript Programmer Exam

D) Math.random(0,1) Answer: A Explanation: Math.random() returns a floating-point number in [0,1). Question 23. Which method is used to convert a string to uppercase? A) toUpperCase() B) toLowerCase() C) toLocaleUpperCase() D) convertToUpper() Answer: A Explanation: toUpperCase() converts all characters in a string to uppercase.

JavaScript Programmer Exam

B) search() C) find() D) locate() Answer: A Explanation: indexOf() returns the index of the first occurrence of a specified substring. Question 26. How can you trim whitespace from both ends of a string in JavaScript? A) trim() B) strip() C) removeSpaces() D) clean()

JavaScript Programmer Exam

Answer: A Explanation: trim() removes whitespace from both ends of a string. Question 27. How do you create a new Date object representing the current date and time? A) new Date() B) Date.now() C) Date() D) new Date.now() Answer: A Explanation: new Date() creates a date object for the current moment.