Javascript - Skill Assignment Quiz
Q1. Which operator returns true if the two compared values are not equal?
-
<>
-
~
-
==!
-
!==
Q2. How is a forEach statement different from a for statement?
- Only a for statement uses a callback function.
- A for statement is generic, but a forEach statement can be used only with an array.
- Only a forEach statement lets you specify your own iterator.
- A forEach statement is generic, but a for statement can be used only with an array.
Q3. Which statement is the correct way to create a variable called rate and assign it the value 100?
-
let rate = 100;
-
let 100 = rate;
-
100 = let rate;
-
rate = 100;
Q4. Which statement creates a new object using the Person constructor? Which statement creates a new Person object called "student"?
-
var student = new Person();
-
var student = construct Person;
-
var student = Person();
-
var student = construct Person();
Q5. How does a function create a closure?
- It reloads the document whenever the value changes.
- It returns a reference to a variable in its parent scope.
- It completes execution without returning.
- It copies a local variable to the global scope.
Q6. When would you use a conditional statement?
- When you want to reuse a set of statements multiple times.
- When you want your code to choose between multiple options.
- When you want to group data together.
- When you want to loop through a group of statement.
Q7. Which Object method returns an iterable that can be used to iterate over the properties of an object?
-
Object.get()
-
Object.loop()
-
Object.each()
-
Object.keys()
Q8. What is one difference between collections created with Map and collections created with Object?
- You can iterate over values in a Map in their insertion order.
- You can count the records in a Map with a single method call.
- Keys in Maps can be strings.
- You can access values in a Map without iterating over the whole collection.
Q9. 0 && hi
- ReferenceError
- true
- 0
- false
Q10. Which of the following operators can be used to do a short-circuit evaluation?
-
++
-
--
-
==
-
||
Q11. Which statement sets the Person constructor as the parent of the Student constructor in the prototype chain?
-
Student.parent = Person;
-
Student.prototype = new Person();
-
Student.prototype = Person;
-
Student.prototype = Person();
Q12. Why would you include a "use strict" statement in a JavaScript file?
- to tell parsers to interpret your JavaScript syntax loosely
- to tell parsers to enforce all JavaScript syntax rules when processing your code
- to instruct the browser to automatically fix any errors it finds in the code
- to enable ES6 features in your code
Q13. Which Variable-defining keyword allows its variable to be accessed (as undefined) before the line that defines it?
- all of them
-
const
-
var
-
let
Q14. Which of the following values is not a Boolean false?
-
Boolean(0)
-
Boolean("")
-
Boolean(NaN)
-
Boolean("false")
Q15. Which of the following is not a keyword in JavaScript?
-
this
-
catch
-
function
-
array
Q16. Which variable is an implicit parameter for every function in JavaScript?
- Arguments
- args
- argsArray
- argumentsList
Q17. Why is it usually better to work with Objects instead of Arrays to store a collection of records?
- Objects are more efficient in terms of storage.
- Adding a record to an object is significantly faster than pushing a record into an array.
- Most operations involve looking up a record, and objects can do that better than arrays.
- Working with objects makes the code more readable.
Q18. Which statement is true about the "async" attribute for the HTML script tag?
- It can be used for both internal and external JavaScript code.
- It can be used only for internal JavaScript code.
- It can be used only for internal or external JavaScript code that exports a promise.
- It can be used only for external JavaScript code.
Q19. How do you import the lodash library making it top-level Api available as the "_" variable?
-
import _ from 'lodash';
-
import 'lodash' as _;
-
import '_' from 'lodash;
-
import lodash as _ from 'lodash';
Q20. What type of function can have its execution suspended and then resumed at a later point?
- Generator function
- Arrow function
- Async/ Await function
- Promise function
Q21. Your code is producing the error: TypeError: Cannot read property 'reduce' of undefined. What does that mean?
- You are calling a method named reduce on an object that's declared but has no value.
- You are calling a method named reduce on an object that does not exist.
- You are calling a method named reduce on an empty array.
- You are calling a method named reduce on an object that's has a null value.
Q22. Which choice is not a unary operator?
-
typeof
-
delete
-
instanceof
-
void
Q23. Which keyword is used to create an error?
-
throw
-
exception
-
catch
-
error
Q24. Which collection object allows unique value to be inserted only once?
- Object
- Set
- Array
- Map
Q23. How does the for Each() method differ from a FOR statement?
- forEach allows you to specify your own iterator, whereas for does not.
- forEach can be used only with strings, whereas for can be used with additional data types.
- forEach can be used only with an array, whereas for can be used with additional data types.
- for loops can be nested; whereas forEach loops cannot.
Q24. Which choice is an incorrect way to define an arrow function that returns an empty object?
- =>
({})
- =>
{}
- =>
{ return {};}
- =>
(({}))
Q25. Which expression evaluates to true?
-
[3] == [3]
-
3 == '3'
-
3 != '3'
-
3 === '3'
Q26. Which method cancels event default behavior?
-
cancel()
-
stop()
-
preventDefault()
-
prevent()
Q27. Which method do you use to attach one DOM node to another?
-
attachNode()
-
getNode()
-
querySelector()
-
appendChild()
Q28. Which choice is a valid example for an arrow function?
-
(a,b) => c
-
a, b => {return c;}
-
a, b => c
-
{ a, b } => c
Q29. Which concept is defined as a template that can be used to generate different objects that share some shape and/or behavior?
- class
- generator function
- map
- proxy
Q30. How do you add a comment to JavaScript code?
-
! This is a comment
-
# This is a comment
-
\\ This is a comment
-
// This is a comment
Q31. If you attempt to call a value as a function but the value is not a function, what kind of error would you get?
- TypeError
- SystemError
- SyntaxError
- LogicError
Q32. Why would you choose an asynchronous structure for your code?
- To use ES6 syntax
- To start tasks that might take some time without blocking subsequent tasks from executing immediately
- To ensure that parsers enforce all JavaScript syntax rules when processing your code
- To ensure that tasks further down in your code aren't initiated until earlier tasks have completed
Q33. What is the HTTP verb to request the contents of an existing resource?
- DELETE
- GET
- PATCH
- POST
Q34. Which tag pair is used in HTML to embed JavaScript?
-
<script></script>
-
<js></js>
-
<javascript></javascript>
-
<code></code>
Q35. Which statement can take a single expression as input and then look through a number of choices until one that matches that value is found?
- else
- when
- if
- switch
Q36. Which method call is chained to handle a successful response returned by fetch()?
-
done()
-
then()
-
finally()
-
catch()
Q37. Which method do you use to attach one DOM mode to another?
- attachNode()
- appendChild()
- querySelector()
- getNode()
Q38. Which of the following are not server-side Javascript objects?
- Date
- FileUpload
- Function
- All of the above
Q39. Which collection object allows a unique value to be inserted only once?
- Map
- Array
- Set
- Object
READY TO GET STARTED?
Are you ready
Let’s Make Something Amazing Together



Need help? Contact our experts
Tell us about your project




