Tentti sisälsi melkein kokonaan kysymyksiä plussan monivalintatehtävistä, tässä ne mitä tentin jälkeen muistin kysyttäneen (ainakin itseltäni):
---------------------------------------------------------------------------------
What command merges branches “feature/exercises” and “master”?
git pull feature/exercises -d master
git merge feature/exercises master
git checkout feature/exercises -m master
---------------------------------------------------------------------------------
With what command do you start a new Node.js project in your project directory?
npm init
node init
node start
node npm start
---------------------------------------------------------------------------------
Which Node module the createServer() method is from?
server
http
async
request
---------------------------------------------------------------------------------
Which of the following arguments are correct in case of a local server?
It runs on the host via the loopback network interface.
It is a server which runs on remote server.
You need internet connection to access local files through a local server.
---------------------------------------------------------------------------------
Which of the following servers listen to a localhost?
server1.on(8080, '127.0.0.1');
server2.listen(8000);
server3.initialize(3000, '172.16.254.1');
---------------------------------------------------------------------------------
Which of the following is valid and well-formed HTML?
Some text
---------------------------------------------------------------------------------
element…
is used to mark the body part of an HTML document.
is used to group the body content of an HTML table.
must be accompanied by both __ and __.
---------------------------------------------------------------------------------
What three elements can be used for ordered, unordered, and description lists?
, - ,
, ,
, ,
, ,
---------------------------------------------------------------------------------
Which of the following is valid CSS code?
.nav.main {display: inline-block;}
{"main": {"display": block, "padding": 1em}}
p, li {em {color: deeppink;}}
.container {display: flexbox;}
---------------------------------------------------------------------------------
What box-model edge is shown in the picture with green color?
../../_images/box-model.png
Border edge
Padding edge
Content edge
Margin edge
---------------------------------------------------------------------------------
Can JavaScript functions contain functions?
Yes
No
---------------------------------------------------------------------------------
Choose the options where this refers to the global object:
inside of an arrow function
inside of a function in a strict mode
inside of a class constructor
---------------------------------------------------------------------------------
const people = [
{id: 1, firstName: "Adam", lastName: "Smith", age: 16},
{id: 2, firstName: "Amy", lastName: "Johnson", age: 45},
{id: 3, firstName: "Barbara", lastName: "Jackson", age: 18},
{id: 4, firstName: "Bill", lastName: "Norton", age: 12}
];
const people2 = [];
for (let person of people) {
const newPerson = {
id: person.id, name: `${person.firstName} ${person.lastName}`
};
people2.push(newPerson);
}
An alternative for the for-of loop above could be:
const people2 = people.map(person => { id: person.id, name: `${person.firstName} ${person.lastName}` });
const people2 = people.map(person => ({ id: person.id, name: `${person.firstName} ${person.lastName}` }));
const people2 = people.filter(person => { return { id: person.id, name: `${person.firstName} ${person.lastName}` }; });
---------------------------------------------------------------------------------
Callbacks are…
the only way to accomplish asynchronicity.
put on the task queue in selected Web API calls (such as events, timeouts).
the basis of continuation-passing style.
one form of closures.
---------------------------------------------------------------------------------
Promise…
has two tracks: success and failure.
has many states: pending, bound, fulfilled, rejected.
Promise.resolve(123) returns a resolved Promise, e.g., 123 in this case.
Promise.reject("mrrr") returns “mrrr”.
---------------------------------------------------------------------------------
async function…
must always include an await statement.
must be used to be able to use await statements.
always returns a Promise.
---------------------------------------------------------------------------------
XSS…
can be blocked by validating user input.
runs in the domain of the malicious website.
cannot alter the page in any way.
cannot read users’ cookies.
---------------------------------------------------------------------------------
Which of the following can be used to mitigate against SQL attacks?
Using fetch
Using parameterized queries
Accepting only JSON in request payloads
---------------------------------------------------------------------------------
Which of the following statements are true about cookies used for managing sessions?
Server can send a Set-Cookie header with the response
Client requests a session cookie with Get-Session-Cookie header in the request
The cookie expires in 24 hours
---------------------------------------------------------------------------------
You have created a LocalStorage at https://tuni.fi. From which URLs is it accessible?
http://tuni.fi
http://localhost
https://tuni.fi
https://localhost
---------------------------------------------------------------------------------
In which situations is SessionStorage cleared?
When localStorage.clear() is called
After 24 hours
When the browser is closed
---------------------------------------------------------------------------------
Analogical concepts in MongoDB and relational DB include
collections and databases
documents and rows
none, since MongoDB can save any JSON file, thus no analogies can be found
---------------------------------------------------------------------------------
Mongoose is ..
ORM modeling tool
one means to make more structure to MongoDB documents with schemas
another NoSQL database like MongoDB
---------------------------------------------------------------------------------
If you would like to explicitly bind an object to this, which is a valid option:
obj.use()
obj.bind()
obj.METHOD()
obj.object()
---------------------------------------------------------------------------------
mocha…
is very robust and all-contained test environment
has a fixed set of assertions and cannot be extended
is complemented with chai
---------------------------------------------------------------------------------