项目作者: Adrinlol

项目描述 :
LinkedIn JavaScript Assessment Answers - 2019-2020
高级语言:
项目地址: git://github.com/Adrinlol/linkedin-javascript-assessment.git
创建时间: 2019-07-19T08:35:07Z
项目社区:https://github.com/Adrinlol/linkedin-javascript-assessment

开源协议:

下载


LinkedIn JavaScript Assessment

LinkedIn Assessments - JavaScript 2019-2021

Overview

Answer 15-20 timed, multiple-choice questions

  • ~15 minutes duration
  • 70th percentile required to pass and get a badge
  • Retry in 3 months if you don’t pass

Q1. You’ve written the event listener shown below for a form button, but each time you click the button, the page reloads. Which statement would stop this from happening?

  1. button.addEventListener('click', function(e) {
  2. button.className = 'clicked';
  3. }, false);
  • e.preventDefault();

Q2. Which statement references the DOM node created by the code shown?

  1. <p class="pull">Lorem Ipsum </p>
  • document.querySelector(“.pull”);

Q3. Which statement is the correct way to create a variable called rate and assign it the value 100?

  1. let rate = 100;

Q4. When would the final statement in the code shown be logged to the console?

  1. let modal = document.querySelector('#results');
  2. setTimeout(function() {
  3. modal.classList.remove('hidden');
  4. }, 10000);
  5. console.log('Results shown');
  • Immediately

Q5. Which statement creates a new object using the Person constructor?

  • var student = new Person();

Q6. When would you use a conditional statement?

  • When you want your code to choose between multiple options.

Q7. How is forEach statement different from a for statement?

  • A for statement is generic but a forEach statement can be used only with an array.

Q8. Review the code below. Which statement calls the addTax function and passes 50 as the argument?

  1. addTax(50);

Q9. What is the result in the console of running the code shown?

  1. var Storm = function () {};
  2. Storm.prototype.precip = 'rain';
  3. var WinterStorm = function () {};
  4. WinterStorm.prototype = new Storm();
  5. WinterStorm.prototype.precip = 'snow';
  6. var bob = new WinterStorm();
  7. console.log(bob.precip);
  • ‘snow’

Q10. How does a function create a closure?

  • It returns a reference to a variable in its parent scope.

Q11. What is the result in the console of running this code?

  1. "use strict";
  2. function logThis() {
  3. this.desc="logger";
  4. console.log(this);
  5. }
  6. new logThis();
  • logThis { desc: ‘logger’ }

Q12. What is the result of running this statement?

  1. console.log(typeof(42));
  • ‘Number’

Q13. Which operator returns true if the two compared values are not equal?

  • !==

Q14. Which statement is the correct way to create a variable called rate and assign it the value 100?

  1. let rate = 100;

Q15. Which statement creates a new object using the Person constructor?

  1. var student = new Person();

Q16. How would you reference the text ‘avenue’ in the code shown?

  1. roadTypes[2]

Q17. Which property references the DOM object that dispatched an event?

  • target

Q18. Which method converts JSON data to a JavaScript object?

  1. JSON.parse()

Q19. When would you use a conditional statement?

  • When you want your code to choose between multiple options

Q20. What would be the result in the console of running this code?

  1. for(var i=0; i<5; i++){
  2. console.log(i);
  3. }
  • 01234

Q21. What is the name of a function whose execution can be suspended and resumed at a later point?

  • Generator

Q22. You’ve written the code shown to log a set of consecutive values, but it instead results in the value 5, 5, 5, and 5 being logged to the console. Which revised version of the code would result in the value 1, 2, 3 and 4 being logged?

  1. for (var i=1; i<=4; i++){
  2. setTimeout(function(){
  3. console.log(i);
  4. }, i*10000);
  5. }
  • for (var i = 1; i <= 4; i++) {{function(j) {setTimeout(function() {console.log(j);}, j * 1000);})(i)};

Q23. Which statement creates a new function called discountPrice?

  • let discountPrice = function(price) { return price * 0.85; };

Q24. You need to match a time value such as 12:00:32. Which of the following regular expressions would work for your code?

  • /\d\d:\d\d:\d\d/

Q25. How many prototype objects are in the chain for the following array?

  1. let arr = [];
  • 2

Q26. Which of the following is not a unary operator?

  • instanceof

Q27. What type of scope does the end variable have in the code shown?

  1. var start = 1;
  2. if (start === 1) {
  3. let end = 2;
  4. }
  • block

Q28. What will the value of y be in this code:

  1. const x = 6 % 2;
  2. const y = x ? 'One': 'Two';
  • Two

Q29. Which keyword is used to create an error?

  • throw

Q30. What’s one difference between the async and defer attributes of the HTML script tag?

  • The defer attribute will asynchronously load the scripts in order

Q31. The following program has a problem. What is it?

  1. var a;
  2. var b = (a = 3) ? true: false
  • The condition in the ternary is using the assignment operator.

Q32. Which statement references the DOM node created by the code shown?

  1. <p class="pull">lorem ipsum</p>
  • document.querySelector('.pull');

Q33. What value does the code return?

  1. let answer = true;
  2. if (answer === false) {
  3. return 0;
  4. } else {
  5. return 10;
  6. }
  • 10

Q34. What is the result in the console of running the code shown?

  1. var start = 1;
  2. function setEnd() {
  3. var end = 10;
  4. }
  5. setEnd();
  6. console.log(end);
  • ReferenceError

Q35. What will this code log in the console?

  1. function sayHello() {
  2. console.log("hello");
  3. }
  4. console.log(sayHello.prototype);
  • undefined

Q36. Which collection object allows unique value to be inserted only once?

  • Set

Q37. The following program has a problem. What is it?

  1. var a;
  2. var b = (a = 3) ? true: false
  • The condition in the ternary is using the assignment operator.

Q38. For the following class, how do you geet value of 42 from x?

  1. class X{
  2. get Y(){return 42;}
  3. }
  4. var x = new X();
  • x.Y

Q39. What is the result?

  1. sum(10,20);
  2. diff(10,20);
  3. function sum(x,y){
  4. return x+y;
  5. }
  6. let diff = function(x,y){
  7. return x-y;
  8. }
  • ReferenceError

Q40. Which variable is an implicit parameter for every function in JavaScript?

  • Arguments

Q41. What does the following expression evaluate to?

  1. [] == [];
  • False

Q42. Which statement is true about Functional Programming?

  • Side effects are not allowed.

Q43. Which choice is not a unary operator?

  • instanceof

Q44. What will the value of y be in this code:

  1. const x = 6 % 2;
  2. const y = x ? 'One' : 'Two';
  • Two

Q45. What value does this code return?

  1. let answer = true;
  2. if (answer === false) {
  3. return 0;
  4. } else {
  5. return 10;
  6. }
  • 10

Q46. What two values will this code print?

  1. function printA() {
  2. console.log(answer);
  3. var answer = 1;
  4. }
  5. printA();
  6. printA();
  • undefined then undefined

Q47. Why might you choose to make your code asynchronous?

  • to start tasks that might take some time without blocking subsequent tasks from executing immediately