Set 2-3

A modern and engaging illustration of a developer working on JavaScript code, surrounded by various coding concepts and symbols like brackets, fun<wbr>ctions, and algorithms.

JavaScript Proficiency Quiz

Welcome to the JavaScript Proficiency Quiz! Test your knowledge of JavaScript concepts, from semantic versioning to asynchronous programming. This quiz is designed to challenge both beginner and experienced developers alike.

With 10 engaging questions, you'll explore a range of topics, including:

  • Functional programming
  • Asynchronous concepts
  • Testing strategies
  • Debugging techniques
  • Data manipulation
10 Questions2 MinutesCreated by CodingMaster42
A developer publishes a new version of a package with bug fixes but no breaking changes. The old  version number was 2.1.1.
 
What should the new package version number be based on semantic versioning?
2.1.2
2.2.0
2.2.1
3.1.1
A developer has a fizzbuzz function that, when passed in a number, returns the following:
  • 'fizz' if the number is divisible by 3
  • 'buzz' if the number is divisible by 5
  • 'fizzbuzz' if the number is divisible by both 3 and 5
  • empty string if the number is divisible by neither 3 or 5
Which two test cases properly test scenarios for the fizzbuzz function?
 
Choose 2 answers
let res = fizzbuzz(3);
console.assert(res  === '');
let res = fizzbuzz(true);
console.assert(res  === '');
let res = fizzbuzz(5);
console.assert(res  === 'fizz');
let res = fizzbuzz(15);
console.assert(res  === 'fizzbuzz');
Given the code below:
 
let numValue = 1982;
 
Which three code segments result in a correct conversion from number to string?
 
Choose 3 answers
Let strValue = numValue.toString();
Let strValue = '' + numValue;
Let strValue = numValue.toText();
Let strValue = String(numValue);
Let strValue = (String)numValue;
Refer to the expression below:
let x = ('1' + 2) == (6 * 2);
 
How should this expression be modified to ensure that x evaluates to false?
Let x = (1+2) === (6/2);
Let x = ('1' + 2) === (6*2);
Let x = (1+2) == ('6'/2);
Let x = ('1' + '2') == (6*2);
A developer needs to test this function:
 
const sum3 = (arr) => {
    if(!arr.length) return 0;
    if(arr.length === 1) return arr[0];
    if(arr.length === 2) return arr[0] + arr[1];
    return arr[0] + arr[1] + arr[2];
};
 
Which two assert statements are valid tests for this function?
 
Choose 2 answers
Console.assert(sum3([0]) === 0);
Console.assert(sum3([-3,2]) === -1);
Console.assert(sum3(['hello', 2, 3, 4]) === NaN);
Console.assert(sum3([1, '2']) == 12);
Given the following code:
 
01 document.body.addEventListener('click', (event) => {
02      if(/* CODE REPLACEMENT HERE */) {
03             console.log('Button clicked!');
04      )
05 });
 
Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on the page is clicked?
Event.clicked
E.nodeTarget == this
Button.addEventListener('click')
Event.target.nodeName == 'BUTTON'
Given the code below:
 
const delay = async delay => {
return new Promise((resolve, reject)) => {
setTimeout(resolve, delay);
});
}
const callDelay = async() => {
const yup = await delay(1000);
console.log(1);
};
console.log(2);
callDelay();
console.log(3);
What is logged to the console?
1 2 3
1 3 2
2 1 3
2 3 1
Universal Container (UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions that might cause this problem. To verify this, the developer decides to execute everthing and log the time each of these three suspicious functions consumes.
 
console.time('Performance');
 
maybeAHeavyFunction();
 
thisCouldTakeTooLong();
 
orMaybeThisOne();
 
console.endTime('Performance');
 
Which function can the developer use to obtain the time spent by every one of the three functions?
Console.getTime();
Console.timeStamp();
Console.timeLog();
Console.trace();
A developer uses a parsed JSON string to work with user information as shown in the code block below:
 
const userInformation = (
       "id" : "user-01",
       "email" : "user01@universalcontainers.demo",
       "age" : 25
);
 
Which two options access the age attribute in the object?
 
Choose 2 answers
UserInformation.get('age');
UserInformation.age;
UserInformation('age');
Const (age) = userInformation;
Which two code snippets show working examples of a recursive function?
 
Choose 2 answers
let countingDown = function(startNumber) {
        if(startNumber > 0) {
                console.log(startNumber);
                return countingDown(startNumber - 1);
        } else {
                return startNumber;
        }
};
function factorial(numVar) {
     if(numVar < 0) return;
     if(numVar === 0) return 1;
     return numVar - 1;
}
const factorial = numVar => {
     if(numVar < 0) return;
     if(numVar === 0) return 1;
     return numVar * factorial(numVar - 1);
}
const sumToTen = numVar => {
     if(numVar < 0)
         return;
     return sumToTen(numVar + 1);
};
{"name":"Set 2-3", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Welcome to the JavaScript Proficiency Quiz! Test your knowledge of JavaScript concepts, from semantic versioning to asynchronous programming. This quiz is designed to challenge both beginner and experienced developers alike.With 10 engaging questions, you'll explore a range of topics, including:Functional programmingAsynchronous conceptsTesting strategiesDebugging techniquesData manipulation","img":"https:/images/course8.png"}
Powered by: Quiz Maker