Mock Ad
Mock Ad
ANS:{}
2)Microservices promote
ANS:TRUE
5)Mthod helps in starting the HTTP server and listens for connections
ANS:Listen()
ANS:JSON
ANS:-V8
8)Assume a schema for with the name “BLOGSCHEMA” is created. How do we compile the schema with
model
ANS:False
ANS:API Gateway
1.________ method is used to bundle the code in an object and allows it to be reused.
Ans. Export
Ans. Accepted
let test=()=>{
return new Promise((resolve, reject)=>{
reject();
})
test()
.then(()=>console.log("Resolved"))
.catch(()=>console.log("Rejected"))
Ans: Rejected
5. Which of the following is equivalent for the below code but in a non-blocking way?
var contents=fs.readFileSync('/etc/hosts');
console.log(contents)
Ans:
6.Middleware functions the express are functions that have access to the request object (req), to
response object(res), and the next function in the application’s request-response cycle
Ans: True
Ans: require('express')
10.Suchi, a backend developer is building API’s using NodeJS with Express. She would like to make use of
the images in the application provided by her organization which are maintained in the
folder/assets/images. Choose the correct syntax to make use of these images
Ans: app.use(express.static(path.join(__dirname,'/assets/images')));
var express=require('express')
app=new express();
app.get('student/:id',function(req,res){
res.render('student'+req.parmas.id);
})
Ans:
12. In Mongoose,_________ represents documents which can be saved and retrieved from our
database.
14. Choose the appropriate code snippet to be added below that retrieves books details from mongodb
and display on console:
MongoClient.connect('mongodb://localhost:27017',function(err,client){
var db=client.db('store')
}}
Ans:db.collection(‘books’).find().toArray
15. Ritu wants to use mongoose for employee data insertion, which should also give appropriate error
messages and successful messages. From the given options identify valid way to achieve this?
Ans: app.save
17. RabbitMQ uses Advances Message Queuing Protocol (AMQP) protocol for messaging State true or
false
Ans: True
Ans: http
1. Resilient a.Less time to build, deploy, and test per each release
ANS:app.use()
2)const.express= require(‘express’)
Const app=________
App.get(“/”,(req,res)=>res.send(“hello world”))
App._____(3000,()=>
ANS:-express(),listen
ANS:-app.use(express.static(path.join(_dirname,’/assets/images’));
ANS:-True
ANS:-Require
9)Why node js is suitable for developing applications using microservices architural style?
d)Microservices involve intensive computational tasks that node can handle efficiency
ANS:-emp.create(function(err){
If(err){
Console.log(err);
}else{
}});
13)_____method helps in starting the HTTP server and listens for connections?
ANS:-listen()
console.log("1");
fs.readFile("sample.txt",'utf8',function(error,data){
if(error){
throw error;
}
console.log("2");
});
console.log("3");
ANS:-132
ANS:-header
ANS:-mongoose.connect()
ANS: