Javascript
JavaScript Mastery Quiz
Test your knowledge of JavaScript and Node.js with this engaging quiz designed for enthusiasts and professionals alike. With 29 challenging questions, you'll discover how well you understand key concepts such as asynchronous programming, Promises, calls to external modules, and much more.
Whether you're preparing for a job interview or simply want to gauge your skills, this quiz is for you. Get ready to dive into:
- Node.js Features
- Asynchronous Programming
- JavaScript Syntax
- Modern JavaScript Practices
In a Node program what does process.argv contain?
The version of Node being used
The command line arguments
The full path of the program
The name of the program
Which of the following is not available in a Node program?
File system
Operating system
HTTP
DOM
Mosh Hamedani compares an asynchronous program to a waiter in a restaurant who ...
Waits for one tables meal to be prepared before serving another table
Waits for all customers at a table to decide what they want before serving another table
Serves new tables while the meals for other tables are being prepared
Serves all tables at once
Serves the table with the most customers first
In Node, when you write a function in a JavaScript file where is it accessible by default?
Everywhere
In any file on the same server
In any file in the same folder
Only in the file where it is defined
What is the name of the built-in Node module that contains the function readFile?
Os
Path
Fs
Http
According to Mosh Hamedani the best description of Node is:
A JavaScript framework
A JavaScript-related programming language
A JavaScript library
A JavaScript runtime environment
Node programs are ...
Single-threaded and non-blocking
Multi-threaded and non-blocking
Single-threaded and blocking
Multi-threaded and blocking
If you call a Node program by entering 'node app 4' how does the program access the value 4 passed in?
Process.argv[0]
Process.argv[3]
Process.argv[2]
Process.argv[1]
What command is used to include functions from another module within a Node program?
Join
Require
Include
Using
What is the name of the object used to make functions in a module accessible to other modules?
Functions
Exports
Processes
Imports
What is a Promise?
A synchronous version of a callback
An object that will be completed in the future
An error handler for a callback function
An asynchronous function
The keyword 'await' is used to ...
Indicate that a function is asynchronous
Return a Promise to the caller
Delay a function until more system resources are available
Wait for a Promise to resolve
Which of the following statements about callback functions is false?
It is returned by another function
It is called in the future
It is called by the system
It is passed to another function
To make an AJAX request what is the modern alternative to using XMLHttpRequest?
Require
Fetch
Import
Async
Suppose a function, foo, returns a Promise. One way to get the data returned when the Promise resolves successfully is to write 'foo().then(function(data) { ... });' What is a more modern way of getting the data?
Async foo(data)
Data = await foo()
Foo(data.promise)
Data = fetch(foo())
Why is it a good idea to include a toJSON method in a JavaScript class?
To allow instances to be created with JSON.parse rather than the constructor
To allow JSON.stringify to work properly
To indicate that the class does not contain any non-standard data
To make it easy to display the data
When a section of code is described as 'callback hell', it means the code is difficult to understand because ...
It uses more callbacks than are required
Any callback is difficult to understand
The code will only work if the callbacks run in a certain order
It has nested callbacks
Function someFunc(x, y) { // do something } Now suppose that we call the function by writing someFunc(4). Which of the following is true?
Y will be ignored
The function will return an error message
X will contain 4 and y will be undefined
X and y will both contain 4
In a JavaScript class, how do you declare a 'get' function for a field called 'stuff' so that the function can be called on an instance, obj, by writing 'obj.stuff'?
Get stuff()
Get_stuff()
#getstuff()
GetStuff()
The name of the Node module used to capture command line input from the user is ...
Console
Readline
Fs
Path
In a terminal session (command line), what is the command to move to the parent folder?
Cd \
Cd \.
Cd ..
Cd .\
Cd .
What will happen if you call an aysnchronous function but forget to write 'await' in front of it?
The program will run very slowly
The program will run normally but maybe not asynchronously
The program will not run
The program will hang indefinitely
What is the name for a string that specifies the location and name of a file, including the name of the file and any sub folders that need to be navigated - for example: "..\src\db\ConnectionManager.js"?
Source
Filename
Path
Dirinfo
Route
In a terminal session (command line), what is the command to display the contents of a file?
Dir (Windows) or ls (Linux)
Type (Windows) or cat (Linux)
Cd .
Show (Windows) or sed (Linux)
Print (Windows) which (Linux)
What is the acronym that represents the four fundamental database operations?
RAGU: Remove-Add-Get-Update
CRUD: Create-Read-Update-Delete
FADE: Fetch-Add-Delete-Edit
FAIR: Find-Alter-Insert-Remove
What is the name of the tool that creates HTML pages from JavaScript comments?
Docgen
CommentDoc
GenHTML
Jsdoc
What is the Node command to create the 'package.json' file?
Npm build
Npm init
Npm install
Npm create
After you open a Mongo connection to a database, what else must you do before you can execute a query?
Set up a try/catch block to handle potential errors
Ensure that all other connections have been closed
Obtain a reference to a collection
Obtain a reference to a processing thread
Suppose you call an asynchronous function named 'foo' by writing 'await foo();' but you forget to use 'async' in the declaration of the enclosing function (the function that your code is in). What will happen?
The program will run very slowly
The program will hang indefinitely
The program will run normally but maybe not asynchronously
The program will not run
{"name":"Javascript", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of JavaScript and Node.js with this engaging quiz designed for enthusiasts and professionals alike. With 29 challenging questions, you'll discover how well you understand key concepts such as asynchronous programming, Promises, calls to external modules, and much more.Whether you're preparing for a job interview or simply want to gauge your skills, this quiz is for you. Get ready to dive into:Node.js FeaturesAsynchronous ProgrammingJavaScript SyntaxModern JavaScript Practices","img":"https:/images/course8.png"}