wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

WPR final

Total questions: 125

Worksheet time: 1hrs 4mins

Name
Class
Date
1.

Which of these correctly describe the output of the JS code below? const list = [0, 1, '0', 'a', false]; let count = 0; for (const item of list) { if (item==0) { count++; } } console.log(count);

a)

2

b)

1

c)

Error

d)

3

2.

Which of these correctly describe the output of the ExpressJS code below? async function demoData() { const response = await db.collection('words').updateOne({word: 'dog'}, { $set: {definition: 'friend'} }); }

a)

Insert a new entry for the word 'dog' if it doesn't exist

b)

Update the entry for the word 'dog' with new definition if it already exists or else insert a new entry

c)

Update the entry for the word 'dog' with new definition if it already exists

d)

Insert a new entry for the word 'dog' even when it already exists

3.

Which of these correctly describe the output of the CSS code below? @media (max-width: 768px) { .menu a:hover { padding-left: 15px; } }

a)

On devices with screen width greater than 768px, all the visited links move to the left 15px

b)

On devices with screen width greater than 768px, the menu link moves to the right 15px when you mouse over it

c)

On devices with screen width less than or equals 768px, the menu link moves to the right 15px when you mouse over it

d)

On devices with screen width less than or equals 768px, all the visited links move to the left 15px

4.

Which of these correctly describes the output of the ExpressJS code below? async function deleteDemoData() { const query = {}; const response = await db.collection('words').deleteOne(query); }

a)

Error

b)

Delete the first entry in the collection 'words'

c)

Delete all the entries in the collection 'words'

d)

No entry is deleted from the collection 'words'

5.

Which of these correctly describes the output of the JavaScript code below? // modifies count = no. even numbers in range [min, max] function countEvens(min, max) { count = 0; for (const i = min; i <= max; i++) { if (i % 2 == 0) { count++; } } } let count; countEvens(5, 10); console.log(count);

a)

3

b)

undefined

c)

0

d)

Error

6.

What do we call a data record in MongoDB?

a)

Table

b)

Row

c)

Collection

d)

Document

7.

React is a

a)

None of these

b)

JavaScript framework

c)

JavaScript library

8.

In ReactJS, props can be used to pass

a)

None of these

b)

Event handler to component

c)

Both of these

d)

Properties to the component

9.

Which of the following commands can be used in mongo shell to show all the databases in your MongoDB instance?

a)

show databases

b)

show dbs

c)

ls dbs

d)

show dbs-all

10.

In NodeJS modules, the variables & functions can be exposed (to be accessed outside the module) using *

a)

All of them

b)

expose default

c)

require

d)

module.exports

11.

Which of these lines of code FAILs to work in NodeJS?

a)

const name = 'V8';

b)

const button = document.querySelector('button');

c)

console.log("V8");

d)

None of these

12.

Complete the code below to serve static files (html, css, js, img) from the same server (http://localhost:3000) server.js const express = require('express'); const app = express(); // TODO: serve static files app.listen(3000, function() { console.log("Listening on port 3000!"); });

a)

app.use(express.static('public'))

b)

app.use(express.static('static'))

c)

require('express').static('/public')

d)

app.static('public')

13.

In JavaScript, a condition (productCost > 5) is used in an if statement. Which of the following values of productCost will result in this condition being evaluated as true?

a)

5

b)

5.1

c)

4

d)

0

14.

Which of these is correct about the JS code below? const response = { status: 201, student: {id: 1001040015, name: 'Cong Nguyen', courses: ['SE1', 'DBS', 'WPR', 'MPR']} }; const json = JSON.stringify(response); console.log(json);

a)

{'status':'201', 'student':{'id':'1001040015', 'name': 'CongNguyen', 'courses' : ['SE1', 'DBS', 'WPR', 'MPR']}}

b)

{'status':201, 'student': {'id':'1001040015', 'name': 'Cong Nguyen', 'courses': ['SE1', 'DBS', 'WPR', 'MPR']}}

c)

["status":"201", "student": {"id": "1001040015","name":"Cong Nguyen", "courses": {"SE1", "DBS", "WPR", "MPR"}}]

d)

["status":"201", "student": ["id":"1001040015", "name":" Cong Nguyen", "courses": {"SE1", "DBS", "WPR", "MPR"}]]

15.

Part of exception captured when we try to run the code below; what may cause this problem? const DATABASE_NAME = 'diary-db'; const MONGO_URL = mongodb://localhost:27017/$ {DATABASE_NAME}; let db = null; app.listen(8080, async function () { const mongoClient = await mongodb. MongoClient.connect(MONGO_URL); db= mongoClient.db(); }); Error: (node:572) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017] at Pool. (c:\nodes\server.js:431:11) at Pool.emit (events.js:189:13) at createConnection [...omitted...]

a)

None of these

b)

The database named 'diary-db' does not exist

c)

The MongoDB database management process is not running on port 27017

d)

Port 8080 is being used by another application (process)

16.

Which of these is correctly implemented to toggle (show/hide) the content div? // css // html .hidden { Show/Hide display: none; This is demo content. } // js class Toggler { constructor(button, content) { this.content content; this._onClick= this._onClick.bind(this); button.addEventListener('click', this._onClick); } _onClick() { // CODE HERE.. } } const button = document.querySelector('button'); const content = document.querySelector('div'); new Toggler (button, content);

a)

this.content.css.toggle('.hidden')

b)

this.content.classList.toggle('hidden')

c)

this.content.classList.add('hidden')

d)

this.content.style.add('.hidden')

17.

What is the correct HTML for creating an internal link (linked within the same webpage) to the bookmark named html?

a)

A. <link href = "html"> Lesson 1.HTML </a>

b)

B. <a id = "html"> Lesson 1.HTML </a>

c)

C. <a href = "#html"> Lesson 1.HTML </a>

d)

D. <a name = "html"> Lesson 1.HTML </a>

18.

Which of these is correctly implemented in ExpressJS to serve the fetch from client as below? fetch('/search?key=' + encodeURI('FIT Hanu'));

a)

app.get('/search', function(req, res) { const key= req.query.key; })

b)

app.post('/search', function(req, res) { const key req.query.key; })

c)

app.post('/search', function(req, res) { const key= req.body.key; })

d)

app.get('/search', function (req, res) { const key= req.params.key; })

19.

Which of these is correctly implemented in ReactJS to import our defined class Mobile Menu from file named App.js?

a)

import MobileMenu from './App.js';

b)

import MobileMenu from 'App.js';

c)

from 'App.js' import MobileMenu;

d)

from './App.js' import MobileMenu;

20.

Which of these correctly describe the output of the ReactJS code below? class Header extends React.Component { constructor(props) { super(props); this.state = { favoritecolor: "red" }; } componentDidMount() { setTimeout(() => { this.setState({ favoritecolor: "yellow" }) }, 1000) } render() { return My Favorite Color is {this.state.favoritecolor} } } ReactDOM.render( , document.getElementById('root'));

a)

Error

b)

"My Favorite Color is red", but changed to "My Favorite Color is yellow" after 1 second

c)

"My Favorite Color is red", and nothing change

d)

"My Favorite Color is yellow", and nothing change

21.

Which of these is NOT a preferred way to communicate between the two classes App and Present in the design below?

a)

Give Present a reference to App in its constructor. Present can use this reference to call methods from App

b)

Present dispatches custom events in response to actions. App listens for these events, then calls its corresponding methods

c)

App can just call methods on Present since App has a list of the Present objects

d)

App passes one or more of its methods to Present as parameters. Present calls them in response to corresponding actions.

22.

Whenever the state is changed, React component will

a)

be created again from scratch

b)

re-renders the component

c)

do nothing, you have to call render method to render the component again

d)

None of these

23.

In NodeJS, which of these below is used to execute the code of demo.js file?

a)

None of these

b)

nodejs demo.js

c)

demo.js

d)

node demo.js

24.

In the React component life cycle, the static method getDerivedStateFromProps(props, state) is called when ____

a)

None of these

b)

Component is created for the first time

c)

State of the component is updated

d)

Both of these

25.

Which of these correctly describe the output of the CSS code below? div { padding: 5px 10px; }

a)

Space between the border and the content of the div is respectively, top & bottom: 5px, left & right: 10px

b)

Space between the border of the div and the other elements is respectively, top & left: 5px, bottom & right: 10px

c)

Space between the border of the div and the other elements is respectively, top & right: 5px, bottom & left: 10px

d)

Space between the border and the content of the div is respectively, top & right: 5px, bottom & left: 10px

26.

How many errors need to be corrected in the code below to make it run normally? class Alert { constructor (button) { this.button button; this.button.addEventListener('click', this._onClick); } } function _onClick() { alert("clicked!"); } } new Alert();

a)

2

b)

No errors

c)

3

d)

1

27.

What is the correct JavaScript syntax to change the content of the HTML element below? This is a demonstration.

a)

document.querySelectorAll("demo").innerHtml = "Hello World!";

b)

document.querySelectorAll("#demo").innerHtml = "Hello World!"

c)

document.querySelector('p.demo').innerHTML = "Hello World!"

d)

document.querySelector("p#demo").innerHTML = "Hello World!"

28.

Which of these HTML element below is MOST used to define important text?

a)

A. <important>

b)

B. <i

c)

C. <b

d)

D. <strong>

29.

Which of these is correct to define an array in JavaScript?

a)

let list = [1,2,3]

b)

const list = (1,2,3);

c)

const list-list.add(1); list.add(2); list.add(3);

d)

int list = new int([1,2,3]);

30.

Which of these correctly describe the output of the code below? Note: image kitty-cat.jpg has width= height=200px; // css // html img { <img src ="images/kitty-cat.jpg/> display: block; <img src ="images/kitty-cat.jpg/> width: 50px; <img src ="images/kitty-cat.jpg/> } <img src ="images/kitty-cat.jpg/> <img src ="images/kitty-cat.jpg/>

a)

5 images display on 1 line, each image takes up 200px

b)

5 images display on 5 lines, each image takes up 200px

c)

5 images display on 5 lines, each image takes up 50px

d)

5 images display on 1 line, each image takes up 50px

31.

Which of these is INVALID built-in event in JavaScript?

a)

mousepress

b)

keyup

c)

keydown

d)

click

32.

Which of these is correctly implemented in ExpressJS to serve the fetch from client as below? fetch('/search?key=' + encodeURI("FIT Hanu"));

a)

app.get('/search', function(req, res) { const key req.query.key; });

b)

app.post('/search', function(req, res) { const key req.query.key; });

c)

app.post('/search', function(req, res) { const key req.params.key; });

d)

app.get('/search', function(req, res) { const key req.params.key; });

33.

Which of these is correctly implemented in JS to consume the API defined in ExpressJS server as below? app.post('/hello', function (req, res) { const name = req.body.name; res.json({ message: 'Hello ' + name + '!' }); });

a)

async function hello() { const name = 'Cong Nguyen'; const response = await fetch('/hello?name=' + encodeURI(name),{ method: 'POST', }); const json = await response.json(); console.log(json.message); }

b)

async function hello() { const name="Cong Nguyen"; const response = await fetch('/hello/$(name)'); const message = await response.text(); console.log(message); }

c)

async function hello() { const name 'Cong Nguyen'; const response await fetch('/"hello"', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({name: name}) }); const json = await response.json(); console.log(json.message); }

d)

async function hello() { const name "Cong Nguyen"; const response = await fetch('/"hello"', { method: 'POST', headers: { 'Content-Type': 'text/plain' }, body: (name: name) }); const message = await response.text(); console.log(message); }

34.

Which of these correctly describe the output of the ExpressJS code below? async function browseDemoData() { const query = {}; const response = await db.collection('words').find(query); }

a)

Return all the entries in the collection 'words'

b)

No entry is returned from the collection 'words'

c)

Return the first entry in the collection 'words'

d)

Error

35.

Which of these is correctly implemented in ExpressJS to serve static files (in a folder named public) from the same server?

a)

app.use(express.static('public'));

b)

app.use(app.static('public'));

c)

express.serveStatic('public');

d)

app.serveStatic('public');

36.

Which of these lines of code is correct to import the Handlebars template engine library for use in ExpressJS?

a)

const handlebars = require('express-handlebars');

b)

const handlebars = require('handlebars');

c)

const handlebars = import('express-handlebars');

d)

const handlebars = import('handlebars');

37.

Which of these correctly define a function component in React?

<AlertButton on={false} />

a)

A.
class AlertButton extends React.Component {
render() {
if (this.props.on)
return <button>ON</button>
return <button>OFF</button>}}

b)

function AlertButton(props) {
if (this.props.on) {
return <button>ON</button>}
return <button>OFF</button>}

c)

class AlertButton extends React.Component {
constructor(props) {
super(props);}
render() {
if (this.props.on)
return <button>ON</button>
return <button>OFF</button>}}

d)

function AlertButton(props) {
if (props.on)
return <button>ON</button>
return <button>OFF</button>}

38.

Which of these is correct about HTML inline-block elements?

a)

Small amount of content, no height or width

b)

Take up the full width of the page (flows top to bottom)

c)

Large blocks of content, has height and width

d)

Small amount of content, has height and width

39.

Where in an HTML document is the preferred place to refer to an external CSS file?

a)

At the end of the document

b)

At the end of <body> section

c)

At the beginning of <body> section

d)

In the <head> section

40.

In NodeJS modules, the variables and functions can be exposed (to be accessed outside the module) using

a)

require

b)

expose default

c)

module.exports

d)

export

41.

Fill in the blank: const http = require('http'); const server = http, (a)   ((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello, World!\n'); });

42.

Which of the following browser objects or functions are not accessible in Node.js?

a)

All of the above

b)

window

c)

document

d)

addEventListener

43.

What is a web service?

a)

A program that only works on a specific operating system

b)

A type of database service

c)

A software functionality that can be invoked over the Internet using common protocols

d)

A software application that runs on a local machine

44.

Which property is used to control the overflow of content that is too big to fit into an area?

a)

overflow-style

b)

overflow-control

c)

overflow

d)

overflow-size

45.

What is the correct HTML tag for making a drop-down list?

a)

A. <input type = "list'>

b)

B. <input type="dropdown">

c)

C. <list>

d)

D. <select>

46.

The file _____ contains metadata about the Node.js project, including dependencies and scripts.

a)

index.js

b)

app.js

c)

package.json

d)

server.js

47.

Which of these is not a core feature of Express?

a)

Templating

b)

Routing

c)

ORM

d)

Middleware

48.

How do you specify the space between words in a text?

a)

word-spacing

b)

letter-spacing

c)

text-spacing

d)

word-space

49.

The policy that disallows fetching data from a different website is called?

a)

BANS

b)

VARS

c)

IFPS

d)

CORS

50.

What is an HTML image map?

a)

A map showing the locations of various images on a webpage

b)

A map showing the geographical locations of images on a webpage

c)

A technique to divide an image into clickable areas with different links

d)

A graphical representation of an image in HTML

51.

What will next() function do in Express middleware?

a)

It will pass control to the next middleware function.

b)

It will restart the request-response cycle.

c)

It will throw an error.

d)

It will end the response cycle.

52.

What is the correct HTML for inserting an image?

a)

A. <img href="image.gif" alt="My Image">

b)

B. <img alt="image.gif">image.gif>

c)

C. <image src="image.gif" alt="My Image">

d)

D. <img src="image.gif" alt="My Image">

53.

What does the POST verb in an HTTP request signify?

a)

A resource is being updated

b)

A resource is being fetched

c)

A new resource is being created

d)

A resource is being deleted

54.

How do you make an element's text not wrap and stay on one line?

a)

text-wrap: nowrap;

b)

white-space: nowrap;

c)

text-overflow: nowrap;

d)

white-space: no-wrap;

55.

<button id="demo">Click me!</button>

<script>

document.getElementById("demo")._____("____", myFunction);

</script>

(a)  

56.

Which property is used to control the display of the border's individual sides?

a)

border-style

b)

border

c)

border-side-style

d)

border-sides

57.

Which of the following HTTP Status codes means "Internal Server Error"?

a)

406

b)

500

c)

401

d)

402

58.

Why was asynchronous processing introduced in Node.js?

a)

To reduce memory usage during application runtime

b)

To simulate multi-threading and handle I/O tasks efficiently in a single-threaded environment

c)

To enable Node.js to support multi-threading

d)

To allow Node.js to run multiple programming languages

59.

The file ______ contains metadata about the Node.js project, including dependencies and scripts.

a)

package.json

b)

node_modules

c)

server.js

d)

package-lock.json

60.

Cookies are simple, small files/data sent to the server with a client request and stored on the server-side. Choose one.

a)

True

b)

False

61.

Finish the following code to send a POST request using fetch. Do not add any unnecessary spaces. let params = new FormData(id("input-form")); fetch(url, { _____ : "POST", _____ : params })

(a)  

62.

What is the correct way to check if a variable x is of type "string" in JavaScript?

a)

if (x === "string")

b)

if (typeOf x === "string")

c)

if (typeof x === "string")

d)

if (x.type === "string")

63.

What will be the output of the following code snippet? var arr = [1, 2, 3, 4, 5]; var slicedArr = arr.slice(1, 4); console.log(slicedArr);

a)

[1, 2, 3]

b)

[2, 3, 4]

c)

[2, 3, 4, 5]

d)

[1, 2, 3, 4]

64.

What will be the output of the following code snippet? function delayLog() { for (var i = 1; i <= 5; i++) { setTimeout(function () { console.log(i); }, 1000); } } delayLog();

a)

1, 2, 3, 4, 5

b)

5, 5, 5, 5, 5

c)

6, 6, 6, 6, 6

d)

1, 6, 6, 6, 6

65.

What will be the output of the following code snippet?

function foo() {

return new Promise(function (resolve, reject) {

setTimeout(function () {

resolve("Promise resolved.");

}, 1000);

});

}

console.log("Start");

foo().then(function (result) {

console.log(result);

});

console.log("End");

a)

A. Start, Promise resolved., End

b)

B. Start, End, Promise resolved.

c)

C. Promise resolved., Start, End

66.

What will be the output of the following code snippet? async function foo() { return "Async function."; } console.log("Start"); foo().then(function (result) { console.log(result); }); console.log("End");

a)

Start, Async function., End

b)

Start, End, Async function.

c)

Async function., Start, End

67.

What will be the output of the following code snippet? Promise.resolve("First resolved.") .then(function (result) { console.log(result); return Promise.resolve("Second resolved."); }) .then(function (result) { console.log(result); return Promise.resolve("Third resolved."); }) .then(function (result) { console.log(result); return Promise.reject(new Error("Fourth rejected.")); }) .catch(function (error) { console.log(error.message); });

a)

First resolved., Second resolved., Third resolved., Fourth rejected.

b)

First resolved., Second resolved., Third resolved., Error: Fourth rejected.

c)

First resolved., Second resolved., Third resolved., Promise {: Error: Fourth rejected.}

d)

First resolved., Second resolved., Third resolved., Promise {: "Fourth rejected."}

68.

Consider the following code snippet:

async function asyncFunction() {

throw new Error("Error in async function.");

}

console.log("Start");

asyncFunction().catch(function (error) {

console.log(error.message);

});

console.log("End");

a)

Start, Error in async function., End

b)

Start, End, Error in async function.

c)

Error in async function., Start, End

69.

Which global object provides functionality to control the Node.js runtime process?

a)

Global

b)

Runtime

c)

Process

d)

NodeControl

70.

Which method is used to create a new instance of a server in Node.js?

a)

http.createServer()

b)

http.createInstance()

c)

http.newServer()

d)

http.createServerInstance()

71.

Which of the following is a core module for handling paths?

a)

url

b)

dir

c)

path

d)

location

72.

What does the stream module in Node.js provide?

a)

Tools for creating WebSockets

b)

Utilities for handling HTTP operations

c)

A way to handle streaming data

d)

Functions for dealing with promises

73.

Which of the following allows Node.js to be scalable?

a)

Multithreading

b)

Event-driven architecture

c)

Larger memory allocation

d)

High CPU usage

74.

What is the main difference between exports and module.exports in Node.js?

a)

They are the same.

b)

exports is for functions, while module.exports is for objects.

c)

exports is a reference to module.exports.

d)

module.exports is the legacy way to export modules.

75.

Which of the following is NOT a core module in Node.js?

a)

fs

b)

http

c)

express

d)

url

76.

Which method in the fs module is used to read a file asynchronously?

a)

fs.readFile()

b)

fs.readSync()

c)

fs.openFile()

d)

fs.read()

77.

In which object are all the environment variables stored in a Node.js application?

a)

env

b)

process.env

c)

node.env

d)

app.env

78.

Which of the following is used to import modules in Node.js?

a)

Import { module } from 'module-name'

b)

#include 'module-name'

c)

require('module-name')

d)

using module-name

79.

What is the purpose of the --save flag in the npm install command?

a)

To globally install a package

b)

To save a backup of the current project

c)

To save the package version in the package-lock.json

d)

To save the package in the package.json dependencies

80.

How do you retrieve the value of a specific cookie sent in a request in Express.js?

a)

req.cookie.value

b)

req.cookies[cookieName]

c)

req.get('cookieName')

d)

req.values.cookieName

81.

What is the purpose of the ORDER BY clause in SQL?

a)

It filters the rows returned by the SELECT statement.

b)

It specifies the columns to be retrieved.

c)

It creates a new table.

d)

It orders the results in ascending or descending order.

82.

What is the purpose of the GROUP BY clause in SQL?

a)

It filters the rows returned by the SELECT statement.

b)

It groups rows with the same values into summary rows.

c)

It orders the results in ascending or descending order.

d)

It specifies the columns to be retrieved.

83.

What is the purpose of the HAVING clause in SQL?

a)

It orders the results in ascending or descending order.

b)

It filters the rows returned by the SELECT statement.

c)

It specifies the columns to be retrieved.

d)

It filters the summary rows created by the GROUP BY clause.

84.

Which of the following best describes MongoDB?

a)

Relational database

b)

Spreadsheet program

c)

Document-based NoSQL database

d)

Graph database

85.

In MongoDB, a record is equivalent to a:

a)

Row

b)

Table

c)

Document

d)

Database

86.

Which of the following is the default port for MongoDB?

a)

27017

b)

8080

c)

3306

d)

5432

87.

Which MongoDB command is used to display the database you are currently using?

a)

show currentDatabase

b)

show db

c)

use db

d)

db

88.

To create or switch to a database in MongoDB, which command would you use?

a)

createDatabase(name)

b)

switchDatabase(name)

c)

C. use <database_name>

d)

D. db.<database_name>

89.

Which of the following commands will show you all the collections in your current database?

a)

show collections

b)

list collections

c)

display collections

d)

db.collections()

90.

How do you insert a new document into a collection in MongoDB?

a)

A. db.<collection_name>.insert()

b)

B. db.<collection_name>.newDocument()

c)

C. db.<collection_name>.add()

d)

D. db.<collection_name>.append()

91.

Which of the following commands deletes a MongoDB database?

a)

db.dropDatabase()

b)

removeDatabase()

c)

deleteDatabase()

d)

destroyDatabase()

92.

Which MongoDB method can be used to remove one or more documents from a collection?

a)

A. db.<collection_name>.delete()

b)

B. db.<collection_name>.remove()

c)

C. db.<collection_name>.discard()

d)

D. db.<collection_name>.drop()

93.

What is the BSON in MongoDB?

a)

A database engine

b)

A query language

c)

A backup tool

d)

Binary representation of JSON

94.

Which MongoDB command returns statistics about the database?

a)

db.stats()

b)

db.info()

c)

db.data()

d)

db.details()

95.

What format does MongoDB use for its queries?

a)

SQL

b)

XML

c)

BSON

d)

XQuery

96.

To update a document in a collection, which method is appropriate?

a)

A. db.<collection_name>.modify()

b)

B. db.<collection_name>.edit()

c)

C. db.<collection_name>.revise()

d)

D. db.<collection_name>.update()

97.

Which of the following operations provides a sorted list of the documents in a collection?

a)

A. db.<collection_name>.sort()

b)

B. db.<collection_name>.arrange()

c)

C. db.<collection_name>.listSorted()

d)

D. db.<collection_name>.orderBy()

98.

How can you backup your MongoDB database?

a)

mongodump

b)

mongobackup

c)

mongosave

d)

mongoarchive

99.

Which tool can be used to import content from a BSON file into a MongoDB database?

a)

mongoimport

b)

mongorestore

c)

mongoload

d)

mongofetch

100.

Which of the following commands lists all available MongoDB databases?

a)

show dbs

b)

list dbs

c)

show databases

d)

db.list()

101.

Which MongoDB function is used to limit the number of results returned?

a)

A. db.<collection_name>.count()

b)

B. db.<collection_name>.skip()

c)

C. db.<collection_name>.limit()

d)

D. db.<collection_name>.restrict()

102.

In which language is MongoDB written?

a)

Python

b)

Java

c)

C++

d)

Go

103.

If you wish to retrieve only the specified fields of a document, which method would you use?

a)

project()

b)

show()

c)

select()

d)

find()

104.

Which of the following ensures atomic transactions in MongoDB?

a)

WriteConcern

b)

Sharding

c)

Indexing

d)

Replication

105.

Which of the following is NOT a valid logical operator in MongoDB?

a)

$and

b)

$or

c)

$nor

d)

$between

106.

If you want to join collections in MongoDB, which operator would you use?

a)

$join

b)

$link

c)

$lookup

d)

$merge

107.

What type of index in MongoDB allows you to search text fields?

a)

Text index

b)

Compound index

c)

Unique index

d)

Sparse index

108.

Which MongoDB command provides execution statistics about query performance?

a)

A. db.<collection_name>.stats()

b)

B. db.<collection_name>.explain()

c)

C. db.<collection_name>.details()

d)

D. db.<collection_name>.analyze()

109.

How do you create a unique index on a field in MongoDB?

a)

{ uniqueKey: 1 }

b)

{ index: "unique" }

c)

{ type: "unique" }

d)

{ unique: true }

110.

What does the mongos command do?

a)

Starts the MongoDB server.

b)

Starts a shard server.

c)

Starts the MongoDB routing service.

d)

Dumps the MongoDB database.

111.

Which MongoDB shell method is used to rename a collection?

a)

A. db.<collection_name>.rename()

b)

B. db.<collection_name>.renameCollection()

c)

C. db.<collection_name>.changeName()

d)

D. db.<collection_name>.alter()

112.

Is JSON case-sensitive?

a)

Yes

b)

No

113.

In JSON, keys must always be of which data type?

a)

String

b)

Number

c)

Boolean

d)

Object

114.

What does the following JSON represent? { "firstName": "Ramesh", "lastName":"Fadatare", "age": 30, "isMarried": false }

a)

An object with four properties

b)

An array with four elements

c)

A string with JSON data

d)

A function with four arguments

115.

JSON can be parsed using which of the following functions in JavaScript?

a)

JSON.parse()

b)

JSON.stringify()

c)

JSON.decode()

d)

JSON.encode()

116.

What does the "null" value represent in JSON?

a)

An empty string

b)

Zero

c)

An undefined value

d)

No value or absence of value

117.

What is the declarative way to render a dynamic list of components based on values in an array?

a)

Using the reduce array method.

b)

Using the component.

c)

Using the Array.map() method.

d)

With a for/while loop.

118.

What will happen if you render an input element with disabled = {false}?

a)

It will be rendered as disabled.

b)

It will not be rendered at all.

c)

It will be rendered as enabled.

d)

You cannot set it false.

119.

How can you set a default value for an uncontrolled form field?

a)

By using the value property.

b)

By using the defaultValue property.

c)

By using the default property.

d)

It is assigned automatically.

120.

What is Callback?

a)

The callback is a technique in which a method calls back the caller method.

b)

The callback is an asynchronous equivalent for a function.

c)

Both of the above.

d)

None of the above.

121.

The Node.js modules can be exposed using:

a)

expose.

b)

module.

c)

exports.

d)

All of the above.

122.

Which of the following module is not a built-in node module?

a)

zlib.

b)

https.

c)

dgram.

d)

fsread.

123.

Which of the following statement defines Express?

a)

Express is an application framework that provides a robust set of features to develop desktop-based applications.

b)

Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications.

c)

Both of the above.

d)

None of the above.

124.

Which of the following is not a benefit of using modules in Express?

a)

It provides a means of dividing up tasks.

b)

It provides a means of reuse of program code.

c)

It provides a means of reducing the size of the program.

d)

It provides a means of testing individual parts of the program.

125.

What is the default scope in the Node.js application?

a)

Global.

b)

Local.

c)

Global Function.

d)

Local to object.