0% found this document useful (0 votes)
5 views3 pages

MCQ Questions on JavaScript and XML

The document contains a series of questions related to npm, MongoDB, HTTP status codes, XML structure, JavaScript calculations, and server creation using Node.js. It includes multiple-choice questions that test knowledge on these topics. Key points include npm's role as a package manager, the functionality of the update() method in MongoDB, and how to create a basic HTTP server in Node.js.

Uploaded by

mubee940
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

MCQ Questions on JavaScript and XML

The document contains a series of questions related to npm, MongoDB, HTTP status codes, XML structure, JavaScript calculations, and server creation using Node.js. It includes multiple-choice questions that test knowledge on these topics. Key points include npm's role as a package manager, the functionality of the update() method in MongoDB, and how to create a basic HTTP server in Node.js.

Uploaded by

mubee940
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Select the true statement/s regarding npm


a. npm is the package manager for the Node JavaScript platform
b. it is used to publish, discover, install, and develop node programs
c. npm does not help in installing packages
d. npm init command can be used to generate [Link] file
e. npm init command can be used to install third party modules
2. The update() method in mongodb collection
a. Modifies an existing document
b. Adds a new document if a certain document does not exist in the collection
c. Is same as upsert
d. Is different from upsert
3. HTTP status code 200 means
a. Page not found
b. OK
c. Bad request
d. Good request
e. Created

Answer questions 4-6 using the following xml code

<?xml version="1.0" encoding="UTF-8"?>

<pencils>
<pencil>
<brand>Nataraj</brand>
<country>India</country>
<mfd>2005</mfd>
<price currency=”LKR”>15</price>
<website url=[Link]/>
</pencil>
</pencils>
4. The root element is:
a. Pencils
b. Pencil
c. <?xml version="1.0" encoding="UTF-8"?>
d. Both pencil and pencils
5. Select the atomic values:
a. Pencil
b. LKR
c. Mfd
d. Nataraj
e. India

6. Select the correct statement/s regarding the above xml


a. There are no empty elements
b. There is a syntax error
c. Currency attribute can be taken as a separate element
d. url attribute’s parent element is website
e. Multiple urls could be added if url was taken as a separate element
7. Which of the following javascript statements would calculate 22 and store it in a variable named
x?
a. Var x=2*2
b. X=2^2
c. X=2**2
d. X=2 *pow(2)
e. 2**2=x

Answer questions 8- 10 based on the below coding saved as [Link]


[Link](function (request, response) {

[Link](200, {'Content-Type': 'text/plain'});

[Link]('Hello World\n');
}).listen(8081);

[Link]('Server running at [Link]

8. Before creating the server, a required module needs to be imported to the above program. How
to do this correctly?
a. Var fs= require(‘fs’);
b. Var sass=require(“sass”);
c. Npm install http - -save
d. Var http=require(“http”);
e. Npm init
9. What would be displayed in the browser after the relevant url is typed in the address bar?
a. Cannot GET/
b. Hello world
c. Server running at [Link]
d. Bad request
e. OK
10. What would be displayed in the cmd when node server command is run?
a. File not found
b. Hello world
c. Server running at [Link]
d. Bad request
e. OK

You might also like