Keyword

Result: 191 questions

Which are the different languages supported by MongoDB?

Answer:

MonggoDB provides official driver support for C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Scala, Go and Erlang.

You can use MongoDB with any of the above languages. There are some other community supported drivers too but the above mentioned ones are officially provided by MongoDB.

View

What is the difference between MongoDB and Redis database?

Answer:

Difference between MongoDB and Redis:

  • Redis is faster than MongoDB.
  • Redis has a key-value storage whereas MongoDB has a document type storage.
  • Redis is hard to code but MongoDB is easy.

For more information: click here

View

What is the difference between MongoDB and CouchDB?

Answer:

Difference between MongoDB and CouchDB:

  • MongoDB is faster than CouchDB while CouchDB is safer than MongoDB.
  • Triggers are not available in MongoDB while triggers are available in CouchDB.
  • MongoDB serializes JSON data to BSON while CouchDB doesn't store data in JSON format.

For more information: click here

View

What is the difference between MongoDB and Cassandra?

Answer:

Difference between MongoDB and Cassandra:

  • MongoDB is cross-platform document-oriented database system while Cassandra is high performance distributed database system.
  • MongoDB is written in C++ while Cassandra is written in Java.
  • MongoDB is easy to administer in the case of failure while Cassandra provides high availability with no single point of failure.

For more information: click here

View

Is there any need to create database command in MongoDB?

Answer:

You don't need to create a database manually in MongoDB because it creates automaically when you save the value into the defined collection at first time.

For more information: click here

View

Explain what is the scalar data and scalar variables in Perl?

Answer:

Scalar in Perl means a single entity like a number or string. So, the Java concept of int, float, double and string equals to perls scalar and the numbers and strings are exchangeable. While scalar variable is used to store scalar data. It uses $ sign and followed by one or more alphanumeric characters or underscore. It is a case sensitive.

View

Consider the following JavaScript code:

console.log("first");
setTimeout(function() {
    console.log("second");
}, 0);
console.log("third");

The output will be:

first
third
second

Assuming that this is the desired behavior, and that we are using Node.js version 0.10 or higher, how else might we write this code?

Answer:

Node.js version 0.10 introduced setImmediate, which is equivalent to setTimeout(fn, 0), but with some slight advantages.

setTimeout(fn, delay) calls the given callback fn after the given delay has ellapsed (in milliseconds). However, the callback is not executed immediately at this time, but added to the function queue so that it is executed as soon as possible, after all the currently executing and currently queued event handlers have completed. Setting the delay to 0 adds the callback to the queue immediately so that it is executed as soon as all currently-queued functions are finished.

setImmediate(fn) achieves the same effect, except that it doesn’t use the queue of functions. Instead, it checks the queue of I/O event handlers. If all I/O events in the current snapshot are processed, it executes the callback. It queues them immediately after the last I/O handler somewhat like process.nextTick. This is faster than setTimeout(fn, 0).

So, the above code can be written in Node as:

console.log("first");
setImmediate(function(){
    console.log("second");
});
console.log("third");
View

How does Node.js handle child threads?

Answer:

Node.js, in its essence, is a single thread process. It does not expose child threads and thread management methods to the developer. Technically, Node.js does spawn child threads for certain tasks such as asynchronous I/O, but these run behind the scenes and do not execute any application JavaScript code, nor block the main event loop.

If threading support is desired in a Node.js application, there are tools available to enable it, such as the ChildProcess module.

View

Consider following code snippet:

{
    console.time("loop");
    for (var i = 0; i < 1000000; i += 1){
        // Do nothing
    }
    console.timeEnd("loop");
}

The time required to run this code in Google Chrome is considerably more than the time required to run it in Node.js. Explain why this is so, even though both use the v8 JavaScript Engine.

Answer:

Within a web browser such as Chrome, declaring the variable i outside of any function’s scope makes it global and therefore binds it as a property of the window object. As a result, running this code in a web browser requires repeatedly resolving the property i within the heavily populated window namespace in each iteration of the for loop.

In Node.js, however, declaring any variable outside of any function’s scope binds it only to the module’s own scope (not the window object) which therefore makes it much easier and faster to resolve.

View

What is the use of iframe tag?

Answer:

An iframe is used to display a web page within a web page.

Syntax:

<iframe src="URL"></iframe>

Example:

<iframe src="demo_iframe.html" width="200px" height="200px"></iframe>

Target to a link:

<iframe src="http://www.javatpoint.com" name="iframe_a"></iframe>

 

View

How tags are migrated from HTML4 to HTML5?

Answer:

No. Typical HTML4 Typical HTML5
1) <div id="header"> <header>
2) <div id="menu"> <nav>
3) <div id="content"> <section>
4) <div id="post"> <article>
5) <div id="footer"> <footer>

Header and Footer Example

HTML 4 Header and Footer:

<div id="header">  
  <h1>Monday Times</h1>  
</div>  
.  
.  
.  
<div id="footer">  
  <p>&copy; JavaTpoint. All rights reserved.</p>  
</div>

HTML 5 Header and Footer:

<header>  
  <h1>Monday Times</h1>  
</header>  
.  
.  
.  
<footer>  
  <p>© JavaTpoint. All rights reserved.</p>  
</footer>

Menu Example

HTML 4 Menu:

<div id="menu">  
  <ul>  
    <li>News</li>  
    <li>Sports</li>  
    <li>Weather</li>  
  </ul>  
</div>

HTML 5 Menu:

<nav>  
  <ul>  
    <li>News</li>  
    <li>Sports</li>  
    <li>Weather</li>  
  </ul>  
</nav>

 

View

Inside which HTML element do we put the JavaScript?

Quiz

What is the correct JavaScript syntax to change the content of the HTML element below?

<p id="demo">This is a demonstration.</p>

Quiz

Where is the correct place to insert a JavaScript?

Quiz

The external JavaScript file must contain the <script> tag.

Quiz

How do you create a function in JavaScript?

Quiz

How to write an IF statement in JavaScript?

Quiz

How can you add a comment in a JavaScript?

Quiz

What is the correct way to write a JavaScript array?

Quiz

What is the correct JavaScript syntax for opening a new window called "w2" ?

Quiz

© 2017 QuizBucket.org