The new flashcard feature is useful to memorize questions.
?Change your study mode
At any time, you can change the study mode, and alternate between the practice mode and the exam mode. In practice mode, you can configure for example the number of questions or tests, and other parameters to help you study.
Randomized | 10 Questions per Test | 20 Minutes | 70% to pass|
To re-configure your study mode again and change - for example - the number of tests, whether you have random questions and all other configuration parameters.
?Simulator Configuration
Auto-scroll: You can use the automatic scrolling of the questionnaire that occurs as soon as you answer one or all of the answers to a question correctly. Auto scrolling is activated if you answer a single answer, or as soon as you answer all the mandatory answers. Learning Mode: During learning mode you can get a real time result for your answer.
Free Test
Question: / 10
20:00Min. left
?Restart the current test
To restart the current test by clearing all your answers and the time used up to now. Warning: all answers will be lost.
Question: / 10
5.0(408 Votes)
Quiz
Question 1/101/10
Which of the following methods will correctly perform a deep clone of an object in JavaScript?
Select the answer:Select the answer
1 correct answer
A.
original.clone()
B.
JSON.parse(JSON.stringify(original))
C.
Object.create(original)
D.
Object.assign({}, original)
The correct answer is B. JSON.parse(JSON.stringify(original)). This method converts a JSON-compatible object into a JSON string and then parses that string into a new object. Nested objects and arrays are also recreated, so the result does not share those nested references with the original. Changes to the clone’s nested JSON-compatible data therefore do not affect the original. The other options do not perform a deep clone: A. original.clone() is not a standard JavaScript method for ordinary objects. It works only if a particular object type or library provides it. C. Object.create(original) creates a new object whose prototype is original. It does not make an independent copy of the original’s properties; inherited properties can still reflect changes to original. D. Object.assign({}, original) copies the original’s own enumerable properties into a new object, but only at the top level. Nested objects and arrays remain shared references, so this is a shallow copy. Important limitation: JSON.parse(JSON.stringify(original)) is suitable only for data that can be represented in JSON. It does not preserve values such as functions, undefined, symbols, or special object types such as Date; it also fails on circular references and BigInt. For more general deep cloning, structuredClone(original) is often a better choice where supported.
Right Answer: B
Quiz
Question 2/102/10
Consider the following JavaScript code snippet: 1. const book = { 2. title: 'The Great Gatsby', 3. author: 'F. Scott Fitzgerald', 4. getSummary: function() { 5. return `${this.title} by ${this.author}`; 6. } 7. }; 8. 9. const getBookSummary = book.getSummary; 10. console.log(getBookSummary()); // What will this log to the console?
Select the answer:Select the answer
1 correct answer
A.
ReferenceError: title is not defined
B.
null
C.
The Great Gatsby by F. Scott Fitzgerald
D.
undefined by undefined
The correct answer is D. undefined by undefined, assuming the code runs as a non-strict JavaScript script. When `book.getSummary()` is called directly, `this` refers to `book`. But line 9 assigns the method to a separate variable: `const getBookSummary = book.getSummary;` Calling `getBookSummary()` does not preserve its connection to `book`. In non-strict mode, `this` inside the function refers to the global object. Since that object has no `title` or `author` properties in this example, both expressions evaluate to `undefined`. The template string then produces: `undefined by undefined` In strict mode, `this` would instead be `undefined`, and accessing `this.title` would throw a TypeError. So answer D relies on the usual assumption that the snippet runs outside strict mode.
Right Answer: D
Quiz
Question 3/103/10
Consider the following JavaScript code snippet: 1. const obj = { 2. prop: 42, 3. func: function() { 4. return this.prop; 5. } 6. }; 7. 8. const extractedFunc = obj.func; 9. console.log(extractedFunc()); // What will this log to the console?
Select the answer:Select the answer
1 correct answer
A.
42
B.
TypeError: extractedFunc is not a function
C.
undefined
D.
null
The correct answer is C. undefined, assuming the code runs in non-strict mode and there is no global property named prop. When the function is called as obj.func(), this refers to obj, so this.prop is 42. But the assignment const extractedFunc = obj.func; copies the function reference; it does not preserve obj as the function’s receiver. Calling extractedFunc() is a plain function call, not a method call on obj. In non-strict mode, this in a plain function call refers to the global object. Since that object normally has no prop property, this.prop evaluates to undefined, and that is what console.log prints. There is an important strict-mode caveat: in strict mode, this in a plain function call is undefined. Then evaluating this.prop throws a TypeError instead. So option C is correct under the usual non-strict-mode assumption, but the result depends on the execution context.
Right Answer: C
Quiz
Question 4/104/10
You have an array of tasks, where each task is an object with properties id , title , and completed . Write a JavaScript function that returns a new array containing only the titles of the tasks that are not completed, sorted alphabetically. Which of the following functions correctly implements this?
Select the answer:Select the answer
1 correct answer
A.
function getIncompleteTaskTitles(tasks) { return tasks.sort((a, b) => a.title.localeCompare(b.title)) .filter(task => !task.completed) .map(task => task.title);}
B.
function getIncompleteTaskTitles(tasks) { return tasks.filter(task => task.completed) .map(task => task.title) .sort((a, b) => a.localeCompare(b));}
C.
function getIncompleteTaskTitles(tasks) { return tasks.map(task => task.title) .filter(task => !task.completed) .sort((a, b) => a.localeCompare(b));}
D.
function getIncompleteTaskTitles(tasks) { return tasks.filter(task => !task.completed) .sort((a, b) => a.title.localeCompare(b.title)) .map(task => task.title);}
D is the best answer: function getIncompleteTaskTitles(tasks) { return tasks .filter(task => !task.completed) .sort((a, b) => a.title.localeCompare(b.title)) .map(task => task.title); } It first keeps only tasks whose completed property is false (or otherwise falsy), then sorts those task objects alphabetically by title, and finally returns an array containing just their titles. There is a caveat: Option A also produces the requested titles in alphabetical order, but it calls sort directly on tasks. JavaScript’s sort method changes the original array, so A rearranges the caller’s tasks as a side effect. D filters first, creating a new array before sorting, and therefore leaves the original tasks array unchanged. If avoiding changes to the input is part of the intended requirement, D is the correct choice. The other options do not work as intended: B filters for completed tasks, the opposite of what is required. C converts the tasks to title strings before checking task.completed. At that point, the filter callback receives strings rather than task objects, so it cannot correctly test whether each task is incomplete.
Right Answer: D
Quiz
Question 5/105/10
You have the following JavaScript code: 1. let config = { 2. server: "localhost", 3. port: 8080, 4. options: { 5. secure: true, 6. timeout: 5000 7. }, 8. features: { 9. feature1: "enabled", 10. feature2: "disabled" 11. } 12. }; 13. 14. let key = "features"; 15. let subKey = "feature1"; 16. let dynamicKey = "timeout"; Which two of the following expressions correctly access the value 5000 from the config object?
Select multiple answer: (Choose 2)Select the answer
2 correct answers
A.
config["options"]["timeout"]
B.
config[key][subKey]
C.
config.options.timeout
D.
config[key].options[dynamicKey]
The value 5000 is stored at `config.options.timeout`: `options` is a property of `config`, and `timeout` is a property of `options`. A. `config` is correct. Bracket notation accesses the `options` property, then the `timeout` property, so it returns `5000`. C. `config.options.timeout` is also correct. Dot notation accesses the same two properties and returns `5000`. B. `config` uses `key`, whose value is `"features"`, and `subKey`, whose value is `"feature1"`. It therefore accesses `config.features.feature1`, which is `"enabled"`. D. `config.options` starts at `config.features`, because `key` is `"features"`. There is no `options` property inside `features`, so this expression does not access the value `5000`. Therefore, the correct answers are A and C.
Right Answer: A, C
Quiz
Question 6/106/10
Consider the following code snippet: 1. let sentence = new String(" JavaScript "); 2. let trimmedSentence = sentence.trim().padEnd(15, "."); 3. console.log(trimmedSentence); What will be the output?
Select the answer:Select the answer
1 correct answer
A.
"JavaScript..."
B.
"JavaScript"
C.
"JavaScript....."
D.
" JavaScript "
The correct answer is C. "JavaScript....." The String object initially contains a space before and after "JavaScript": " JavaScript " The trim() method removes those surrounding spaces, leaving "JavaScript", which has 10 characters. The padEnd(15, ".") method then adds periods until the string is 15 characters long. It adds 5 periods, so the result is: JavaScript.....
Right Answer: C
Quiz
Question 7/107/10
You are tasked with writing a JavaScript function that takes multiple arguments and returns the sum of those arguments. If no arguments are provided, the function should return a default value of 10. Which implementation correctly achieves this using default parameter values, the rest parameter, and the spread operator?
Select the answer:Select the answer
1 correct answer
A.
function sum(...args, defaultValue = 10) { return args.length ? args.reduce((a, b) => a + b, 0) : defaultValue;}
B.
function sum(args = [10]) { return args.reduce((a, b) => a + b, 0);}
C.
function sum(defaultValue, ...args = [10]) { return args.reduce((a, b) => a + b, 0);}
D.
function sum(defaultValue = 10, ...args) { return args.length ? args.reduce((a, b) => a + b, 0) : defaultValue;}
The stated answer, D, is valid JavaScript syntax, but it does not correctly sum all arguments under the usual interpretation of the question. In D: ```javascript function sum(defaultValue = 10, ...args) { return args.length ? args.reduce((a, b) => a + b, 0) : defaultValue; } ``` The first supplied argument is assigned to `defaultValue`, not to `args`. For example, `sum(1, 2, 3)` returns `5`, because `args` contains only ``. With no arguments, it does return `10`. So D meets the no-arguments requirement but omits the first argument from the sum. A corrected implementation is: ```javascript function sum(first = 10, ...args) { return .reduce((a, b) => a + b, 0); } ``` Here, `first` defaults to `10` when no argument is supplied. The rest parameter collects any additional arguments, and the spread operator puts `first` and those additional arguments into one array to sum. For example: ```javascript sum(); // 10 sum(1, 2, 3); // 6 sum(...); // 6 ``` The spread operator in the last example expands an array into individual function arguments. Why the other options do not work: A. Invalid syntax: a rest parameter must be the final parameter, so `...args` cannot come before `defaultValue`. B. Accepts a single array argument rather than multiple numeric arguments. Its default applies when the argument is omitted, but it does not use a rest parameter. C. Invalid syntax: rest parameters cannot have default values, so `...args = ` is not allowed. Therefore, if the intended meaning is that every supplied number must be included in the sum, none of the options is fully correct as written. D appears to be the intended answer, but it leaves out the first argument.
Right Answer: D
Quiz
Question 8/108/10
Consider the following JavaScript code: 1. class BankAccount { 2. static totalAccounts = 0; 3. 4. constructor(owner, balance) { 5. this.owner = owner; 6. this.balance = balance; 7. BankAccount.incrementAccounts(); 8. } 9. 10. static incrementAccounts() { 11. BankAccount.totalAccounts++; 12. } 13. } 14. 15. let account1 = new BankAccount('Alice', 1000); 16. let account2 = new BankAccount('Bob', 1500); 17. let account3 = new BankAccount('Charlie', 2000); 18. 19. console.log(BankAccount.totalAccounts); What will be the output of console.log(BankAccount.totalAccounts) ?
Select the answer:Select the answer
1 correct answer
A.
2
B.
1
C.
3
D.
0
The correct answer is C. 3. BankAccount.totalAccounts is a static property, so it belongs to the BankAccount class itself and is shared by all instances. Each time a BankAccount object is created, the constructor calls BankAccount.incrementAccounts(). That static method increases totalAccounts by 1. Three objects are created, so the value changes as follows: - Initially: 0 - After account1: 1 - After account2: 2 - After account3: 3 Therefore, console.log(BankAccount.totalAccounts) outputs 3.
Right Answer: C
Quiz
Question 9/109/10
Which two options correctly demonstrate different ways to create a new object with a name property set to "Gadget" without using a class?
Select multiple answer: (Choose 2)Select the answer
The correct answers are A and D. Both create an ordinary object with its own `name` property set to `"Gadget"`, and neither uses a class. A. `const obj2 = new Object(); obj2.name = "Gadget";` `new Object()` creates an object. The next statement adds an own property named `name` and assigns it the value `"Gadget"`. D. `const obj1 = { name: "Gadget" };` This object literal creates an object with an own `name` property already set to `"Gadget"`. It is the most direct option. Why the other options do not fit: B. `new Function()` creates a function object, not a regular object with a newly assigned `name` property. Function objects have a built-in, non-writable `name` property, so assigning to it does not reliably set it to `"Gadget"`. C. This defines a function; it does not create an object instance with `name` set to `"Gadget"` at that point. The assignment inside the function runs only when the function is called with an appropriate `this` value, such as when used as a constructor with `new`. E. `Object.create({ name: "Gadget" })` creates an object whose prototype has a `name` property. The object can read that inherited property, but it does not have its own `name` property. Under the usual interpretation of this question, the property must belong directly to the new object.
Right Answer: A, D
Quiz
Question 10/1010/10
Which of the following code snippets correctly initializes an array, adds a new element to the end, and removes the first element?
Select the answer:Select the answer
1 correct answer
A.
let arr = [1, 2, 3];arr.unshift(4);arr.shift();
B.
let arr = [1, 2, 3];arr.push(4);arr.shift();
C.
let arr = [1, 2, 3];arr.pop();arr.push(4);
D.
let arr = [1, 2, 3];arr.push(4);arr.pop();
The correct answer is B. In JavaScript, push() adds an element to the end of an array, while shift() removes the first element. Starting with , arr.push(4) changes the array to . Then arr.shift() removes 1, leaving . This both adds a new element at the end and removes the first element. Why the other options are incorrect: A. unshift(4) adds 4 to the beginning, not the end. Then shift() removes that newly added 4, leaving the original array unchanged. C. pop() removes the last element, 3. Then push(4) adds 4 to the end, resulting in . It does not remove the first element. D. push(4) adds 4 to the end, but pop() immediately removes the last element, 4. The array is left unchanged as .
JSA-41-01: JSA - Certified Associate JavaScript Programmer Practice test unlocks all online simulator questions
Thank you for choosing the free version of the JSA-41-01: JSA - Certified Associate JavaScript Programmer practice test! Further deepen your knowledge on JS Institute Simulator; by unlocking the full version of our JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator you will be able to take tests with over 240 constantly updated questions and easily pass your exam. 98% of people pass the exam in the first attempt after preparing with our 240 questions.
What to expect from our JSA-41-01: JSA - Certified Associate JavaScript Programmer practice tests and how to prepare for any exam?
The JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator Practice Tests are part of the JS Institute Database and are the best way to prepare for any JSA-41-01: JSA - Certified Associate JavaScript Programmer exam. The JSA-41-01: JSA - Certified Associate JavaScript Programmer practice tests consist of 240 questions and are written by experts to help you and prepare you to pass the exam on the first attempt. The JSA-41-01: JSA - Certified Associate JavaScript Programmer database includes questions from previous and other exams, which means you will be able to practice simulating past and future questions. Preparation with JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator will also give you an idea of the time it will take to complete each section of the JSA-41-01: JSA - Certified Associate JavaScript Programmer practice test . It is important to note that the JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator does not replace the classic JSA-41-01: JSA - Certified Associate JavaScript Programmer study guides; however, the Simulator provides valuable insights into what to expect and how much work needs to be done to prepare for the JSA-41-01: JSA - Certified Associate JavaScript Programmer exam.
JSA-41-01: JSA - Certified Associate JavaScript Programmer Practice test therefore represents an excellent tool to prepare for the actual exam together with our JS Institute practice test . Our JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator will help you assess your level of preparation and understand your strengths and weaknesses. Below you can read all the quizzes you will find in our JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator and how our unique JSA-41-01: JSA - Certified Associate JavaScript Programmer Database made up of real questions:
You can prepare for the JSA-41-01: JSA - Certified Associate JavaScript Programmer exams with our mobile app. It is very easy to use and even works offline in case of network failure, with all the functions you need to study and practice with our JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator.
Use our Mobile App, available for both Android and iOS devices, with our JSA-41-01: JSA - Certified Associate JavaScript Programmer Simulator . You can use it anywhere and always remember that our mobile app is free and available on all stores.
Our Mobile App contains all JSA-41-01: JSA - Certified Associate JavaScript Programmer practice tests which consist of 240 questions and also provide study material to pass the final JSA-41-01: JSA - Certified Associate JavaScript Programmer exam with guaranteed success.
Our JSA-41-01: JSA - Certified Associate JavaScript Programmer database contain hundreds of questions and JS Institute Tests related to JSA-41-01: JSA - Certified Associate JavaScript Programmer Exam. This way you can practice anywhere you want, even offline without the internet.