Categories
Angular JavaScript NodeJS UI

BARCO – MEAN Architect – NodeJS developer Interview Questions and Answer

BARCO – MEAN Architect – NodeJS developer Interview Questions and Answer

what is tail call optimization ?
TCO (Tail Call Optimization) is the process by which a smart compiler can make a call to a function and take no additional stack space.

Recursive function approach has a problem. It builds up a call stack of size O(n), which makes our total memory cost O(n). This makes it vulnerable to a stack overflow error, where the call stack gets too big and runs out of space. Tail Cost Optimization (TCO) Scheme. Where it can optimize recursive functions to avoid building up a tall call stack and hence saves the memory cost.

what is Map, Set, WeakMap and WeakSet ?
Map is a collection of keyed data items, just like an Object. But the main difference is that Map allows keys of any type.

A Set is a collection of values, where each value may occur only once means it will contain unique set of keys. 

WeakSet is a special kind of Set that does not prevent JavaScript from removing its items from memory. WeakMap is the same thing for Map.
WeakMap does not support iteration and methods keys(), values(), entries(), so there’s no way to get all keys or values from it.

Map – is a collection of keyed values.

The differences from a regular Object:

Any keys, objects can be keys.
Iterates in the insertion order.
Additional convenient methods, the size property.
Set – is a collection of unique values.

Unlike an array, does not allow to reorder elements.
Keeps the insertion order.
Collections that allow garbage-collection:

WeakMap – a variant of Map that allows only objects as keys and removes them once they become inaccessible by other means.

It does not support operations on the structure as a whole: no size, no clear(), no iterations.
WeakSet – is a variant of Set that only stores objects and removes them once they become inaccessible by other means.

Also does not support size/clear() and iterations.
WeakMap and WeakSet are used as “secondary” data structures in addition to the “main” object storage. Once the object is removed from the main storage, if it is only found in the WeakMap/WeakSet, it will be cleaned up automatically.

how to do peer to peer communication in ANgular ?

what is directive & components in angular ?

if loop functions are removed from script, how can you achieve same functionality ?

how to drop both data and collection in mongodb ?

what is generic types in Typescript ? advantages ?

how to define custom types in Typescript ?

how to capture the process specific exceptions in NodeJS ?

how do you print name of file currently executing in NodeJS ?

how to use custom pipes in Angular ? can you pass additional parameters in custom pipes ?

what is the max data can be stored in a mongodb document ?

how to achieve variable length documents in mongodb ?

how do you set auto increment field in mongodb ?