cd
ls
pwd
None of above
cd
ls
pwd
None of above
cd
ls
cd ..
None of above
SpiderMonkey
Microsoft Chakra
Chrome V8
Node En
False
True
Module
Library
Package
Function
module.exports
module.expose
module.imports
module.spread
None of the above
include();
require();
attach();
None of the above
node init
node create
npm init
npm create
False
True
False
True
var http = require("http");
var http = new require("http");
var http = new server();
none of the above
const http = require('http'); const port = 3000; const server = http.createServer(); server.listen(port, function(err){ console.log("Server is up and running on port:", port); });
const http = require('http'); const port = 3000; const server = http.newServer(); server.listen(port, function(err){ console.log("Server is up and running on port:", port); });
const http = require('http'); const port = 3000; const server = http.createServer(); server.start(port, function(err){ console.log("Server is up and running on port:", port); });
const http = require('http'); const port = 3000; const server = createServer(); server.listen(port, function(err){ console.log("Server is up and running on port:", port); });
401
403
402
404
res.sendHeader(200, {'content-type': 'text/html'});
res.write(200, {'content-type': 'text/html'});
res.writeHead(200, {'content-type': 'text/html'});
res.writeHeader(200, {'content-type': 'text/html'});
path
fs
http
None of the above
fs.readFile('./file.txt', (err, data)=>{
if(err) {
console.log("Inside gets printed.");
}
console.log("Outside gets printed.");
});
What will be the output shown in the terminal/console?
Inside gets printed.
Outside gets printed.
Inside gets printed. Outside gets printed. None of the above
error occurs and gets printed on the console
It overwrites the data already stored in the file
Creating the file if it does not yet exist
Copies data from a source file and appends that data to a destination file
None of the above
Data of the file
Error
Any of the two
None of them
req.url()
req.url
req.get(url);
req.get(url());
node install nodemon
node install -g nodemon
npm install -g nodemon
npm install nodemon
Suppose you have assigned port number: 8000)
switch(request.url) {
case '/home':
filePath = './index.html';
break;
case '/profile':
filePath = './profile.html';
break;
default:
filePath = './404.html';
}
What will happen if the URL -‘127.0.0.1: 8000' gets hit?
'index.html' file gets displayed on the browser
'profile.html' file gets displayed in the browser
'404.html' file gets displayed in the browser
the code will not work, so nothing is displayed in the browser
Yes
No
Model Visual Control
Model Visual Controller
Model View Controller
None of the above
True
False
Allows to set up middlewares to respond to HTTP Requests
Defines a routing table which can work as per HTTP Method and URL
Dynamically render HTML Pages
All of the above
Libraries that Node.js requires
Contains the application structure
Libraries that Express requires
None of the above
node install express
node install -g express
node install express save
npm install express
dirname
__dirname
module
module_name
<% x %>
<%_ x %>
<%= x %>
<%# x %>
type
placeholder
input
name
type
placeholder
input
name
Execute any code.
Make changes to the request and the response objects.
End the request-response cycle
Call the next middleware function in the stack.
All of the Above
app.use(function(req, res, next){
console.log('middleware 1 called');
});
app.use(function(req, res, next){
console.log('middleware 2 called');
next();
});
app.use(function(req, res, next){
console.log('middleware 3 called');
next();
});
middleware 1 called
middleware 1 called middleware 2 called
middleware 1 called middleware 2 called middleware 3 called
None of the Above
True
False
app.get('/delete-contact/', function(req, res){
console.log(req.query.phone);
console.log(req.query.name);
return res.redirect('back');
}
What will get printed in the console?
123456789 Coding Ninjas
123456789 Coding%20Ninjas
123456789 Undefined
phone: '12131321321' name: 'Coding Ninjas'
None of the Above
MongoDB
SqLite 3
Firebase
None of the Above
Wide Column Stores
Document databases
Graph databases
None of the Above
mongoose.connect('contact_list_db');
mongoose.connect('mongodb://localhost/contact_list_db');
mongoose.connection('mongodb://localhost/contact_list_db');
mongoose.connect('localhost/contact_list_db');
String
Number
Date
Integer
Boolean
Mixed
Float
ObjectId
Array
id
type
versionkey
None of the Above
Record Control
Code Control
Version Control
None of the mentioned
git add .
git add -u
git add new
None of the Above
push
add
update
None of the Mentioned
var router = express.Router()
let router = express.Router()
var router = express.newRouter()
var router = Router()
True
False
True
False
npm install express-ejs-layouts
npm i ejs
npm i express-layout
npm i express-ejs-layout
Assets
Config
Models
Routes
Authorization
Authentication
Authentication
Authorization
True
False
passport-github
passport-twitter
passport-local
passport-facebook
passport-ninjas
False
True
To create a session cookie
To store the logged in user’s information in an encrypted format in the cookie
To make the server run faster
User was logged in even after refresh
User was logged out after every server restart
Sign in page was inaccessible
Sign out page was visible
Deleting a user from the database
Replacing the user’s session cookie with a dummy one to fake the identity of the user
Resetting the user’s password
Removing the user’s session cookie to remove the identity
1. SCSS
2. Indented
3. Quoted
4. French
1
1 and 2
3
3 and 4
True
False
a. #linked-list a:hover{ color: blue; color: red; }
b. #linked-list{
a{
color: red;
&:hover{
color: blue;
}
}
}
a
b
Student : Class
Book : Author
Date : Week
Train : User
Student : Class
Book : Author
Date : Week
Train : User
Student : Class
Book : Author
Date : Week
Train : User
Post.where({id: user_id}, function(err, post){})
Post.find({user: user_id}, function(err, post){})
Post.findByIdAndUpdate({user: user_id}, function(err, post){})
User.findByIdAndDelete(10, function(err){console.log(‘deleted’);});
User.deleteOne({age: 10}, function(err){console.log(‘deleted’);});
User.deleteMany({age: 10, function(err){console.log(‘deleted’);});
User.deleteMany({age: {$gte: 10}, function(err){console.log(‘deleted’);});
Comment.find({}).populate(‘user’, ‘post’).exec()
Comment.find({}).populate(‘user, post’).exec()
Comment.find({}).populate(‘user’).populate(‘post’).exec()
Post.find({}).populate(‘user’, ‘comment, user’).exec();
Post.find({}).populate(‘user’).populate({path: ‘comments’, populate: {path: ‘user’}}).exec();
Post.find({}).populate(‘comments’).populate(‘user’).exec();
Authorization
Authentication
Verification
Confirmation
User.findByIdAndDelete(10, function(err){console.log(‘deleted’);});
User.deleteOne({age: 10}, function(err){console.log(‘deleted’);});
User.deleteMany({age: 10, function(err){console.log(‘deleted’);});
User.deleteMany({age: {$gte: 10}, function(err){console.log(‘deleted’);});
a) <%- include("_post", {content: “My first post”}) %>
b) It gets passed from the parent template
Only a is correct
Only b is correct
Both a and b are correct
None of the above
They are the same
user.id gets the string of user._id and user._id is of type ObjectId
{insert : true}
{create_new: true}
{Upsert: true}
Asynchronous
Synchronous
Promises
Difficult
a) Behaviour of using promises synchronously
b) Callback hell
c) Execution of async code
d) All of the above
a,c
a,b
b,d
b,c
a) node-sass-middleware
b) express-session
c) cookie-parser
d) Passport
a,b
b,c
c,d
d,a
False
True
a) express-flash-messages
b) connect-flash
c) session-flash
d) Express-flash-2
a,b,c
a,b,d
a,c,d
b,c,d
alert
important
success
Info
a. function(req, res, next){
res.locals.flash = {
success: req.flash('success'),
error: req.flash('error')
}
next();
}
b. function(req, res, next){
res.locals.flash = {
success: req.flash('success'),
error: req.flash('error')
}
}
a
b
XMLHttpRequest (XHR)
JavaScript
HTML
CSS
XML
JSON
C++
HTML
Uploading files to the server
Submitting a form and sending that data to the server
Dynamically adding content to a web page using JavaScript from JSON received from the server
All of the above
$(‘#new-post-form’).serialize()
var data = new FormData(document.getElementById(‘new-post-form’))
JSON.stringify($(‘#new-post-form’))
None of the above
req.json
req.xhr
res.status
res.send
res.status(200).json({data: {post_id: req.params.id}, message: "Unauthorized"});
res.status(404).json({data: {post_id: req.params.id}, message: "Unauthorized"});
res.status(500).json({data: {post_id: req.params.id}, message: "Unauthorized"});
res.status(401).json({data: {post_id: req.params.id}, message: "Unauthorized"});
Date.second()
Date.now()
Date.Exit()
Date.Time()
False
True
destination or storage fileFilter
limits
preservePath
All of the Above
None of the Above
destination
filename
landing
None of the Above
2000
100 bytes
1MB
Infinity
Requesting Data from the Database
Getting a response back from Application
Changing the functions of the Application
None
Chrome Extension
Web Application
Native Application
All of the above are correct
Javascript Web Token
Javascript Web Terminal
JSON Web Token
None of the Above
True
False
_____ method creates a new extractor that looks for the JWT in the authorization header with the scheme 'bearer'. You can go through this link to explore more about different methods available in passport-jwt.
https://www.npmjs.com/package/passport-jwt
fromAuthHeaderAsBearerToken()
jwt.sign(user.toJSON(), 'codeial')
jwt.signIn(user.toJSON(), 'codeial', { expiresIn: '1000' })
jwt.sign(toJSON(), secret-key, { expiresIn: '1000' })
None of the Above
False
True
Authorized JavaScript origins
Authorized Redirect URL
Authorized Javascript Start
None of the Above
Authorized JavaScript origins
Authorized Redirect URL
Authorized Javascript Start
None of the Above
Access Token
Refresh Token
Reload Token
None of the Above
SMTP
POP3
FTP
MIME
IMAP
HTTP
25
26
587
None of the Above
25
26
587
None of the Above
authenticator
auth
authentication
credentials
None of the Above
mailTo()
sendMail()
transportMail()
None of the Above
kue
redis
queue
None of the Above
ref: ‘onModel’
refPath: ‘onModel’
reference: ‘onModel’
None of the above
Like.deleteMany(likeable: post, onModel: ‘Post’);
Like.deleteMany(id: {$in: post.comments});
polling
Observer
Subscriber
connect
connection
newConncetion
None of the Above
sockets.addUser(room_name)
sockets.addClient(room_name)
sockets.join(room_name)
None of the Above
Globally accessible values/commands
Hiding secure data from the developer
All of the above
False
True
To make the file names unique
To prevent the browser from caching if the asset is already present in the browser
It just looks more technical
It’s not important
Redux
Webpack
Grunt
None, Gulp is unique
1
22
333
4444
Lemon mode
Background mode
Daemon mode
BG Mode
False
true
False
True
TXT
DNS
A
AA
Assets
Config
Models
Routes
==
===
isEqual()
isEqualNode()
18
20
22
24
To get the last used command
to get the last result
to store the result
None
static
node-static
http
node-http
Duplex
All of the above
Readable
Writable