Criado por Kyle Peters
mais de 1 ano atrás
|
||
Questão | Responda |
What is the primary feature of Node's build model? | Node works on a model of asynchronous, non-blocking input and output. |
What is the concept of asychronicity? | In Node, asynchronicity refers to the fact that the server will not block progress through the program, rather it will call the next function while waiting for it's current function to complete. |
Does Node support multiple threads? | No, node is a single-thread model. That being said, its non-blocking nature allows a single thread to operate quicker and more smoothly than many traditional multi-thread model servers, such as with the LAMP stack. |
How does Node handle media buffering? | Node does not buffer data, rather providing it in chunks as soon as they are available. |
Why use Node rather than a traditional model like the LAMP stack? | Node is simple to use, easy to read and edit, and most importantly is designed to handle applications with heavy server interactions, such as high traffic and data-heavy operations. |
What is the method for including an installed Node module in a working file? | To do this, one must create a variable, give it a name and assign its value as the function require("module-name") |
What is a callback? | Callbacks are similar to functions in most programming languages, but are non-blocking by design. They are based on a concept of request and response. When a request is made, the callback performs its operations while the server continues down the list of remaining callbacks, then sends out its response when it's ready. |
What is the difference between an event and a callback? | Callback functions are called when an asynchronous function returns its result, whereas event handling works on the observer pattern, and executes when an event is fired. |
What is the basic syntax for binding an event handler? | eventEmmitter.on('event', eventHandler) |
What is a Node Buffer Object? | Node uses the Buffer class to create object instances allowing it to interact well with binary data. This is essential for Node to communicate with TCP and file systems. |
How do Buffer Objects work? | Buffer objects contain data in octets representing bytes. Node is a UNICODE based language, and requires this object class to properly parse binary data. |
How does one 'stringify' the encoded octets of a Buffer object? | .toString(encoding [, start][, end]) |
Can a Buffer object be parsed into JSON? | Yes, there is a simple method following the syntax Buffer.toJSON() that will populate a JSON doc with binary octet bytes representing the working Buffer object. |
What are the main strategies for state management in Node? | The best way to handle states, is by passing a local variable directly to the state-dependent function, or by acquiring a variable from cache, session, a file, a database, network, or other outside source. Global variable use should be avoided as much as possible. |
Is it possible to iterate through objects in Node? | As long as the object is available in memory, yes. Otherwise, there will be an error in the execution and return order for the callback. |
What are the 3 features intended to help ensure that callback nesting is handled cleanly and asynchronously? | Promises, Async and Await |
When will process.nextTick() execute? | process.nextTick() will run at the end of the event loop, before the next loop starts. |
What is the best method for handling cascading functions that may overlap in processing time? | To avoid overlapping processing for cascading functions, use recursive timeout, this will cause a delay between the end of the initial function and begining the execution of the next. |
What is the purpose of setImmediate()? | When you want to execute some piece of code asynchronously, but as soon as possible. Any function passed as the setImmediate() argument is a callback that's executed in the next iteration of the event loop. |
What is the order of queue execution in Node? | The process.nextTick queue comes first, then the promises.next microtask queue followed by the macrotask queue. |
Quer criar seus próprios Flashcards gratuitos com GoConqr? Saiba mais.