1. What will be the response of below code?

    
        function fun(req,res) {

        var count=1;
        for(var i=0;i < 5;i++) {

          res.send(count);
          count++;
        }
      }
    
  
  1. client will receive 1,2,3,4,5 as response one by one
  2. client will receive 1,2,3,4 as response one by one
  3. Error
  4. client will receive 1 as response and then backend throws Error
  5. 1
  6. None of these

Ans: d

2. Is that possible to delete a record in GET method?

  1. Yes, it is really depends on the code what we write
  2. Yes, if we use a “delete” string in params
  3. No, only possible using DELETE method
  4. No, the server confuses and crashes
  5. Throws error
  6. None of the above

Ans: a

3. what response you will get from the below code, when you do a GET request?

    
        var Express = require('express');
        var app   = new Express();
        var port = 3000;
        app.listen(port);

        app.get('/', function(req, res){
          res.send(‘One’);
        });

        app.use('/', function(req, res){
          res.send('Two');
        });

    
  
  1. Two
  2. One
  3. One, Two
  4. Error
  5. None of the above

Ans: b

4. Best place to have a authorization / authentication logics in Express js application

  1. Configurations
  2. Middleware
  3. Inside api endpoint function
  4. Anywhere possibly
  5. None of the above

Ans: b

5. What are the different HTTP methods?

  1. GET, PUT, POST, DELETE
  2. GET, ADD, POST, DELETE
  3. GET, ADD, CREATE, DELETE
  4. GET, MAKE, PUT, POST, DELETE
  5. GET, PUT, POST
  6. All of the above

Ans: a

6.In express js, if we want to route the request whose url contain string “api” to handler B and others to handler A. In simple app.use(‘/api/*’, B), app.use(‘*’, A). Give the best option.

  1. app.use(‘/api/*’, B)first and after app.use(‘*’, A) will make it work.
  2. Writing a regular expression filtering will make it work
  3. Have a common function, from that common function route to appropriate handlers
  4. c&a
  5. b&a
  6. a&b&c
  7. None of the above

Ans: a, b, e

7. Is it possible to serve Nodejs application through Apache and IIS?

  1. Yes, we can serve
  2. Yes, if we configure IIS and apache properly we can do that
  3. No, we cannot
  4. Partially yes, we can serve through apache but apache is used for reverse proxy or load balancing, not through IIS
  5. Partially yes, we can serve through IIS but not apache.
  6. None of the above

Ans: c, d

8. Is it possible to make nodejs application run on all the CPU’s on the machine?

  1. Yes, Node already takes care of that by default
  2. No, Node always runs makes use of single CPU
  3. Yes, have to make use of modules like cluster
  4. No, we cannot do that

Ans: c

8. How Node inspector works in terms of debugging?

  1. Node inspector module will log the statement in debug mode.
  2. Running the application using node-debug will log on every line of code execution
  3. Running the application using node-debug will open a separate port in chrome browser
  4. None of the above

Ans: c

9. How Node inspector works in terms of debugging?

  1. Node inspector module will log the statement in debug mode.
  2. Running the application using node-debug will log on every line of code execution
  3. Running the application using node-debug will open a separate port in chrome browser
  4. None of the above

Ans: c

10. Is it possible to make the nodejs application to listen on two different port?

  1. No, Node will return the error and abort the application
  2. Yes, if we configure the application to listen on two different ports
  3. No, Node will return the error and keep listening on the first configured port number
  4. Yes, any one of the port works until another is not active
  5. None of the above

Ans: b

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.