Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

JS track exam questions – generation 2020/2021

1. Class constructor is executed by __________ when new instance is


created.
a) default
b) itself
c) delay of 1 second
d) It’s name
Single choice answer / Correct answer: a

2. Prototype is:
a) Variable of the object
b) Object that describes the properties of the function
c) Is part of every variable in JavaScript
d) Is function in JavaScript
Single choice answer / Correct answer: b

3. What does MVC means


a) Mathematics Vectors Constructors
b) Model Vertical Class
c) Model View Controller
Single choice answer / Correct answer: c

4. Looking at following statement, what is the correct flow of execution:

1. console.log(1) ;
2. setTimeout(()=>{ console.log(2) });
3. Promise.resolve(() => {console.log(3)});
4. setTimeout(() => {console.log(4)}, 1);
5. console.log(5);

a) 1-2-3-4-5
b) 1-5-3-2-4
c) 2-4-3-1-5
d) 3-4-5-2-1
Single choice answer / Correct answer: b

5. What is the output of the code:


const a = [10,1,5,3,6,7,4,2,2,6,9,0];
const b = a.filter(x => x%2 === 0);
console.log(b);

a) It will output all even numbers in array.


b) It will output all odd numbers in array.
c) It will filter numbers that can be divided with 0 (zero)
d) It will return empty array.

Single choice answer / Correct answer: a

6. What is the value of x when following code is executed:


var x = 23;
(function(){
var x = 43;
(function random(){
x++;
console.log(x);
var x = 21;
})();
})();

a) x = 44.
b) x = 24.
c) NaN
d) undefined

Single choice answer / Correct answer: c

7. What is NaN property in JavaScript?

a) Not a Name.
b) Not a Number.
c) Nothing.
d) Short of `NaNaNaNa Batman!`

Single choice answer / Correct answer: b

8. What will the code below output:


console.log(0.1 + 0.2);
console.log(0.1 + 0.2 == 0.3);

a) 0.3 and true


b) “0.1+0.2” and true.
c) 0.3 and false.
d) “0.1+0.2” and “0.1+0.2 == 0.3”

Single choice answer / Correct answer: c

9. What is a pure function?

a) A Pure function is a function where the return value is only


determined by its arguments without any side effects.
b) Clean function that accepts no arguments and has no return.
c) Function without any comments within to describe it.
d) There is no such a thing as pure function.

Single choice answer / Correct answer: a

10. What are modules?

a) Modules are part of NodeJS only.


b) Modules refer to small units of independent, reusable code and also
act as the foundation of many JavaScript design patterns.
c) Modules are sections in HTML that distinct different content on the
page.
d) JavaScript doesn’t have modules.

Single choice answer / Correct answer: b

11.What does NPM means?

a) No Progress at the Moment.


b) Nudget Package Manager.
c) Node Package Manager.
d) Null Pointer Merge.

Single choice answer / Correct answer: c


12.What is an Event Loop in Node.js?

a) Event loop handle asynchronous callbacks in Node.js. It is the


foundation of the non-blocking input/output in Node.js, making it
one of the most important environmental features.
b) Event loop catches the events in Node, like when user clicks on
button.
c) Event loop will put execution of code in a loop and will trigger new
event on each loop.
d) NodeJS doesn’t have event loop.

Single choice answer / Correct answer: a

13.What is the package.json file?

a) The package.json is a json file that keeps a package within.


b) The package.json file is the heart of a Node.js system. This file holds
the metadata for a particular project..
c) The package.json is a file used to run backend server that will
execute our code.
d) The package.json is same thing as package-lock.json file.

Single choice answer / Correct answer: b

14.Which API is used to work with a file in NodeJS?

a) Const fs = require(‘fs’);
b) Const fs = require(‘file-system’);
c) fs.open(fileURL);
d) require(fileURL);

Single choice answer / Correct answer: a

15.What is middleware in NodeJS?


a) A method that is executed before execution of the actual function.
b) Reusable piece of code that can be applied before the execution of
any function or route.
c) A helper function that helps in code performance;
d) Pre-defined method in NodeJS;

Single choice answer / Correct answer: b

16.How would you configure a RESTful URL parameter that supports a


search for a book based on its ID?
a) GET /{id}/books/
b) GET /books/{id}
c) GET /book?id={id}
d) GET /books?id={id}

Single choice answer / Correct answer: b

17.How can you change "Thomas" into "Michel" in the "LastName"


column in the Users table?
a) UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel'
b) MODIFY Users SET LastName = 'Michel' WHERE LastName = 'Thomas'
c) MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel'
d) UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas'

Single choice answer / Correct answer: d

18.What is ‘this’ keyword in JavaScript?

a) ‘This’ keyword refers to the object from where it was called.


b) ‘This’ refers to ‘this variable’ that we are executing.
c) ‘This’ is custom variable in JavaScript.
d) ‘This’ is reference to the current tab in browser.

Single choice answer / Correct answer: a


19.What is an undefined value in JavaScript?

a) Undefined value means the value is not defined.


b) Undefined value means the value is not defined or variable doesn’t
exist or property doesn’t exist.
c) Undefined value means that we have empty array.
d) Undefined value means that browser haven’t decided which value to
assign.

Single choice answer / Correct answer: b


20.How do you create an object with prototype?

a) let a = {}.
b) let a = {“hello”: “world”}.
c) let a = Object.create({}).
d) let a = Object.create({}, {“hello”:”world”}.

Single choice answer / Correct answer: c

21. Within an exam question list, 3 marks is awarded for every correct
answer and (-1) for every wrong answer. If the student got 38 marks
after attempting all questions, find the number of questions answered
correctly assuming that the total questions were 70.
a) 43
b) 21
c) 27
d) 34
Single choice answer / Correct answer: c
22. Find all divisible numbers with 4 or 6 from 4 to 1000. What is the
sum of all those numbers?
a) 122328
b) 122382
c) 166846
d) 166834
Single choice answer / Correct answer: d

23. What should be added within the following source code part:
var express = require("express");
var app = express();
app.listen(3000, () => {
console.log("Server running on port 3000");
});
in order to configure a REST API request handler that returns array of
students containing Michel and Thomas?
a) app.get("endpoint”, return ["Michael","Thomas"]);
b) app.get("/url", (req, res, next) => { res.json(["Michael","Thomas"]); });
c) return ["Michael","Thomas"];
d) None of the above

24. Which SQL operator is used to filter the result set by the result of
aggregate function?
a) FILTER
b) CHECK
c) WHERE
d) HAVING
Single choice answer / Correct answer: d

25. Node.js Express framework supports which of the following


request/response data formats by default?
a) JSON
b) XML
c) BSON
d) None of the above
Single choice answer / Correct answer: a

You might also like