JS+Node

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

JavaScript

1. _____ is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages. The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.

Strict

23. _____ mode is a way to introduce better error-checking into your code. When you use _____ mode, you cannot use implicitly declared variables, or assign a value to a read-only property, or add a property to an object that is not extensible.

apply()

24. The _____ method lets you invoke the function with arguments as an array TheFunction._____(valueForThis, arrayOfArgs) (mnemonic is "A for array and C for comma.")

call()

25. The _____ method requires the parameters be listed explicitly TheFunction._____(valueForThis, arg1, arg2, ...) (mnemonic is "A for array and C for comma.")

Context

26. It refers to the object within which a function is executed. When you use the JavaScript keyword "this", that word refers to the object that the function is executing in. Executional _____ refer to where and how the function was invoked and is created during the execution time

Prototype

27. The _____ property allows you to add properties and methods to an object.

IIFE (Immediately Invoked Function Expression)

28. JavaScript function that runs as soon as it is defined, contains two major parts. The first is the anonymous function with lexical scope enclosed within the Grouping Operator (). This prevents accessing variables within the _____ idiom as well as polluting the global scope. var result = (function () { var name = "Barry"; return name; })(); // Immediately creates the output: result; // "Barry"

Spread (...)

29. _____ syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected

Advantages

3. Followebd are JS_____: - Less server interaction − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server. - Immediate feedback to the visitors − They don't have to wait for a page reload to see if they have forgotten to enter something. - Increased interactivity − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard. - Richer interfaces − You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.

Hoisting

30. JavaScript's default behavior of moving declarations to the top.

JSON

31. _____ syntax: { "first_name" : "Sammy", "last_name" : "Shark", "location" : "Ocean", "online" : true, "followers" : 987 }

Arrow

32. var materials = [ 'Hydrogen', 'Helium', 'Lithium', 'Beryllium' ]; Next is called _____ function: console.log(materials.map(material => material.length));

map()

33. The _____ method creates a new array with the results of calling a provided function on every element in the calling array.

filter()

34. The _____ method creates a new array with all elements that pass the test implemented by the provided function.

reduce()

35. The _____ method reduces the array to a single value, executes a provided function for each value of the array (from left-to-right). The return value of the function is stored in an accumulator (result/total).

undefined

36. A variable can be declared but not defined. When we try to access it, It will result _____.

not defined

37. A variable can be neither declared nor defined. When we try to reference such variable then the result will be _____

typeof

38. _____ is an operator that returns a string with the type of whatever you pass. The _____ operator checks if a value belongs to one of the seven basic types: number, string, boolean, object, function, undefined or Symbol. _____(null) will return object

instanceof

39. _____ works on the level of prototypes. In particular, it tests to see if the right operand appears anywhere in the prototype chain of the left. _____ doesn't work with primitive types. It _____ operator checks the current object and returns true if the object is of the specified type, for example:

Object

4. JS _____ syntax: var object = { foo: 1, "bar": "some string", baz: { } };

Methods

40. _____ in JavaScript are nothing more than object property that is function.

Constructor

41. Unlike function calls and method calls, a _____ call new Employee('John Doe', 28) creates a brand new object and passes it as the value of this, and implicitly returns the new object as its result. The primary role of the constructor function is to initialize the object.

Function

42. A _____ is a piece of code that is called by name and _____ itself not associated with any object and not defined inside any object. It can be passed data to operate on (i.e. parameter) and can optionally return data (the return value).

Singleton

43. The _____ pattern is an often used JavaScript design pattern. It provides a way to wrap the code into a logical unit that can be accessed through a single variable. The Singleton design pattern is used when only one instance of an object is needed throughout the lifetime of an application.

Singleton

44. In JavaScript, _____ pattern have many uses, they can be used for NameSpacing, which reduce the number of global variables in your page (prevent from polluting global space), organizing the code in a consistent manner, which increase the readability and maintainability of your pages.

Promise

45. We use _____ for handling asynchronous interactions in a sequential manner. They are especially useful when we need to do an async operation and THEN do another async operation based on the results of the first one. For example, if you want to request the list of all flights and then for each flight you want to request some details about it. The _____ represents the future value. It has an internal state (pending, fulfilled and rejected) and works like a state machine.

Object.assign()

46. Copies the values of all enumerable own properties from one or more source objects to a target object.

Object.create()

47. Creates a new object with the specified prototype object and properties.

Object.entries()

48. Returns an array of a given object's own enumerable property [key, value] pairs.

Object.freeze()

49. Freezes an object: other code can't delete or change any properties.

Scope

5. The _____ of a variable is the region of your program in which it is defined. JavaScript variable will have only two _____.

Negative infinity

50. _____ is a number in JavaScript which can be derived by dividing negative number by zero.

"==="

51. _____ is a stricter equality test and returns false if either the value or the type of the two variables are different.

DELETE

52. The _____ keyword is used to delete the property as well as its value.

Node.js

53. _____ is a web application framework built on Google Chrome's JavaScript Engine (V8 Engine). _____ comes with runtime environment on which a Javascript based script can be interpreted and executed (It is analogus to JVM to JAVA byte code). This runtime allows to execute a JavaScript code on any machine outside a browser. Because of this runtime of _____ , JavaScript is now can be executed on server as well.

Error-first

54. _____ callbacks are used to pass errors and data. The first argument is always an error object that the programmer has to check if something went wrong. Additional arguments are used to pass data.

Aynchronous and Event Driven

55. (Node.js benefit) All APIs of Node.js library are _____ that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Very Fast

56. (Node.js benefit) Being built on Google Chrome's V8 JavaScript Engine, Node.js library is _____ in code execution.

Single Threaded but highly Scalable

57. (Node.js benefit) Node.js uses a _____ model with event looping. Event mechanism helps server to respond in a non-bloking ways and makes server _____ as opposed to traditional servers which create limited threads to handle requests. Node.js uses a single threaded program and same program can services much larger number of requests than traditional server like Apache HTTP Server.

No Buffering

58. (Node.js benefit) Node.js applications never buffer any data. These applications simply output the data in chunks.

Concurrency

59. Node.js handles _____. When Node gets I/O request it creates or uses a thread to perform that I/O operation and once the operation is done, it pushes the result to the event queue. On each such event, event loop runs and checks the queue and if the execution stack of Node is empty then it adds the queue result to execution stack.

Global

6. A _____ variable has _____ scope which means it is visible everywhere in your JavaScript code.

Callback hell

60. To avoid _____: modularization: break callbacks into independent functions, use Promises, use yield with Generators and/or Promises

Event loop

61. _____ is what allows Node.js to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible.

Event loop

62. Every I/O requires a callback - once they are done they are pushed onto the _____ for execution. Since most modern kernels are multi-threaded, they can handle multiple operations executing in the background. When one of these operations completes, the kernel tells Node.js so that the appropriate callback may be added to the poll queue to eventually be executed.

Blocking code

63. Node prevents _____ by providing callback function. Callback function gets called whenever corresponding event triggered.

Event Emmitter

64. Events module in Node.js allows us to create and handle custom events. The Event module contains "_____" class which can be used to raise and handle custom events.

NODE_ENV

65. Node encourages the convention of using a variable called _____ to flag whether we're in production right now. This determination allows components to provide better diagnostics during development, for example by disabling caching or emitting verbose log statements. Setting _____ to production makes your application 3 times faster.

Timing features

66. These are _____ in Node: setTimeout/clearTimeout, setInterval/clearInterval, setImmediate/clearImmediate, process.nextTick

setTimeout/clearTimeout

67. (Timing features in Node) _____ can be used to schedule code execution after a designated amount of milliseconds

setInterval/clearInterval

68. (Timing features in Node) _____ can be used to execute a block of code multiple times

setImmediate/clearImmediate

69. (Timing features in Node) _____ will execute code at the end of the current event loop cycle

Local

7. A _____ variable will be visible only within a function where it is defined. Function parameters are always local to that function.

process.nextTick

70. (Timing features in Node) _____ used to schedule a callback function to be invoked in the next iteration of the Event Loop

LTS (Long Term Support)

71. An _____ version of Node.js receives all the critical bug fixes, security updates and performance improvements.

REPL (Read-Eval-Print-Loop)

72. _____ is a virtual environment that comes with Node.js. We can quickly test our JavaScript code in the Node.js REPL environment.

Asynchronous

73. We are making HTTP requests which are _____, means we are not waiting for the server response. We continue with other block and respond to the server response when we received.

non-blocking

74. _____ read/write calls return with whatever they can do and expect caller to execute the call again. Read will wait until it has some data and put calling thread to sleep.

package.json

75. This file holds various metadata information about the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.

libuv

76. _____ is a multi-platform support library with a focus on asynchronous I/O.

Modules (of Node.js, some of most popular)

77. Express, async, browserify, socket.io, bower, gulp, Grunt

Streams

78. _____ are special types of objects in Node that allow us to read data from a source or write data to a destination continuously. There are 4 types of _____ available in Node.js, they are

readFile

79. _____ is for asynchronously reads the entire contents of a file. It will read the file completely into memory before making it available to the User.

Engine

8.A Javascript _____ is a program that converts code written in Javascript to something that computer processor understands.

createReadStream

80. It will read the file in chunks of the default size 64 kb which is specified before hand.

crypto

81. The _____ module in Node.js provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions

Timers

82. The _____ module in Node.js contains functions that execute code after a set period of time. Timers do not need to be imported via require(), since all the methods are available globally to emulate the browser JavaScript API.

Callback

83. A _____ is a function called at the completion of a given task; this prevents any blocking, and allows other code to be run in the meantime.

Passport

84. _____.js is a simple, unobtrusive Node.js authentication middleware for Node.js.

Modules

85. _____ is reusable block of code whose existence does not impact other code in any way. _____ introduced in ES6. _____ is important for Maintainability, Reusability, and Namespacing of Code.

Threaded

86. Node Js is single _____ to perform asynchronous processing. Doing async processing on a single thread could provide more performance and scalability under typical web loads than the typical thread-based implementation.

require()

87. _____ is used to include modules from external files in Node Js. It is the easiest way to include a module in Node. Basically require is a function that takes a string parameter which contains the location of the file that you want to include. It reads the entire javascript file, executes the file, and then proceeds to return the exports object.

Node.js

88. _____ is written in C, C++,JavaScript.It uses Google's open source V8 Javascript Engine to convert Javascript code to C++.

Zlib

89. _____ in Node.js is Cross-platform data compression library

V8

9. _____ is Google's open source high-performance JavaScript engine, written in C++ and used in Google Chrome and in Node.js,

Asynchronous

90. Normally NodeJs reads the content of a file in non-blocking, _____ way. Node Js uses its fs core API to deal with files. The easiest way to read the entire content of a file in nodeJs is with fs.readFile method.

Streams

91. Next are types of _____: - Readable − For reading operation. - Writable − For writing operation. - Duplex − Used for both read and write operation. - Transform − A type of duplex stream where the output is computed based on the input.

Callback

92. In Node.js all core modules, as well as most of the community-published modules, follows a pattern where the first argument to any _____ handler is an error object. this object is optional, if there is no error then in that case null or undefined is passed to the _____.

Server

93. Next used to create a _____: var http =require('http');http.createServer(function(req,res){}

Event

94. An _____ is an action or occurrence recognized by software/app that is handled by event handler by writing a code that will be executed when the event fired.

Event loop

95. In Node Js processes are single threaded, to supports concurrency it uses events and callbacks. An _____ is a mechanism that allows Node.js to perform non-blocking I/O operations.

Ryan Dahl

96. Node.js is written by _____

NPM (node package manager)

97. It is default Package Manager for JavaScript programming language. Used for installing/updating packages and modules of Javascript.

module.exports

98. The method or variable defined in modules cannot be directly accessible by the outer world, that means you cannot call a module member from the external file. In order to access module member, we need to export the functions or variables of modules using _____ method.

libuv

99. Node.js has an optimized design which utilizes both JavaScript and C++ to guarantee maximum performance. JavaScript executes at the server-side by Google Chrome v8 engine. And the C++ _____ library takes care of the non-sequential I/O via background workers.

ECMAScript

10. _____ is the standard on which Javascript is based on. It was created to standardize Javascript. It is commonly used for client-side scripting on the World Wide Web and used by Node Js for writing server applications and services.

app.js

100. _____ is the entrypoint for the Node.js application

Paradigm

11. JavaScript is a multi-_____ language, supporting imperative/procedural programming along with OOP (Object-Oriented Programming) and functional programming. JavaScript supports OOP with prototypal inheritance.

THIS

12. The JavaScript _____ keyword refers to the object it belongs to. It has different values depending on where it is used. In a method, _____ refers to the owner object and in a function, _____ refers to the global object.

Callback

13. A _____ is a plain JavaScript function passed to some method as an argument or option. It is a function that is to be executed after another function has finished executing. In JavaScript, functions are objects. Because of this, functions can take functions as arguments, and can be returned by other functions.

Closure

14. A _____ is a function defined within another scope that has access to all the variables within the outer scope. Global variables can be made local (private) with _____.

Attributes

15. _____ provide more details on an element like id, type, value etc.

Property

16. _____ is the value assigned to the property like type="text", value='Name' etc.

JavaScript

17. _____ involving in HTML ways: Inline, Internal, External

Local

18. For _____ storage the data is not sent back to the server for every HTTP request (HTML, images, JavaScript, CSS, etc) - reducing the amount of traffic between client and server. It will stay until it is manually cleared through settings or program.

Session

19. For _____ storage data stored in local storage has no expiration time, data stored in session storage gets cleared when the page session ends. _____ will leave when the browser is closed.

Data Types

2. Followed are JS _____: Undefined, Null, Boolean, String, Symbol, Number, Object

NaN

20. This property indicates that a value is not a legal number.

Value

21. Passing in functions by _____ means creating a COPY of the original. Picture it like twins: they are born exactly the same, but the first twin doesn't lose a leg when the second twin loses his in the war.

Reference

22. Passing in functions by _____ means creating an ALIAS to the original. When your Mom calls you "Pumpkin Pie" although your name is Margaret, this doesn't suddenly give birth to a clone of yourself: you are still one, but you can be called by these two very different names.


Ensembles d'études connexes

Business ethics for Managers Test 2

View Set

Career Choices Useful Vocabulary Карпюк 9 клас

View Set

INTO THE WOODS SONG AND LYRIC CUES

View Set

Chapter 39: Activity and Exercise

View Set