Font size
Worksheetswpr midterm
Total questions: 82
Worksheet time: 41mins
How can you define a hyperlink to open in a new browser window or tab?
By adding 'new' in the href attribute
Using the target attribute with a value of '_blank'
It's not possible to open a new window/tab with HTML
Using JavaScript code
Which of the following statements in JavaScript will assign the value 5 to the variable productCost?
productCost = 5;
productCost => 5;
productCost <= 5;
productCost == 5;
Which property is used to control the space between characters in CSS?
C. letter-spacing
D. font-spacing
character-spacing
text-spacing
Complete the following code to enable access to files on the public folder via http://localhost:8080/. const express = require('express'); const app = express(); // Fill in the blank to serve static files from the "public" folder app.use(________('public')); app.listen(8080);
A. express.serve
B. express.static
C. app.static
D. app.serve
How do you make each word in a text start with a capital letter?
transform: capitalize;
text-transform: cap;
transform: cap;
text-transform: capitalize;
With the express module, how do you get the query string parameter named id?
let id = req.query.id
let id = req.get.id
const id = req.body.id
const id = req.params.id
How do you set the maximum width of an element?
A. max-width
B. max-size
C. width
D. max-height
Which method sends a JSON response in Express.js?
res.json()
res.send()
res.sendFile()
How to write an IF statement in JavaScript?
if i = 5
if i = 5 then
if (i == 5)
if i == 5 then
How do you create a shadow effect in CSS?
shadow
box-outline
box-shadow
text-shadow
What's the primary use of middleware in Express?
A. Frontend rendering
B. Data storage
C. Error handling
D. Execution of functions in the request-response cycle
What is the function to stop an interval timer?
shutdownTimer
clearTimer
stopTimer
clearInterval
Block elements are normally displayed without starting a new line.
false
What is the method that allows you to move a file to another directory?
fs.moveTo
fs.rename
fs.renameFile
fs.move
What is the purpose of the require() statement in Node.js?
To load a module
To compile a module
To create a new module
To delete a module
What is the output of the following code? function orderExecutor(resolve, reject) { }
console.log('1'); setTimeout(function () { resolve('2'); }, 1000); } let p1 = new Promise(orderExecutor); p1.then(console.log); console.log('3');
A. 1 3 2
B. 1 2 3
Which property is used to control the space between flex items?
gap
flex-spacing
flex-gap
spacing
How do you display a border like this: Top border = 10 pixels, bottom border = 5 pixels, left border = 20 pixels, and right border = 1 pixel?
border-width: 10px 1px 5px 20px;
border-width: 10px 5px 20px 1px;
border-width: 5px 20px 1px 10px;
Which of the following is not a valid HTTP method?
PUT
GET
POST
HEADER
Node.js is a runtime environment for running JavaScript programs outside of the _______.
browser
server
database
terminal
Which of the following is a browser?
browser
server
operating system
database
In HTML, which attribute is used to specify the visible width of a text input field?
size
length
width
visible
How do you select elements with the class name?
.test
#test
*test
.test
What is the correct way to write a JavaScript array?
let colors = (1:"red", 2:"green", 3:"blue")
let colors = "red", "green", "blue"
let colors = 1 = ("red"), 2 = ("green"), 3 = ("blue")
let colors = ["red", "green", "blue"]
Log "John" to the console by extracting information from the person object. const person = { firstName: "John", lastName: "Doe" }; console.log(__________); Fill in the blank to correctly log "John" to the console.
person.firstName
person.lastName
person["John"]
console.log(person)
Which of the following configures empty space between the content of the HTML element (typically text) and the border?
space property
border property
margin property
padding property
What is the correct HTML for creating a hyperlink that does not underline the text?
<a href="url" text-decoration="none">Link</a>
<a href="url" style="text-decoration=none",>Link</a>
<a href="url" no-underline>Link</a>
<a href="url" underline="none">Link</a>
Which of the following statements is correct?
The backend of an application is the supporting component that makes the frontend work.
The backend of an application uses the frontend for accessing data from the database.
The backend of an application is supported by the frontend and server through HTTP.
The frontend of an application is independent of the backend development.
Which CSS property is used to change the speed of an animation?
animation-duration
animation-name
animation-delay
animation-iteration-count
Which of the following is the correct CSS property for specifying the duration of an animation?
animation-duration
animation-speed
transition-speed
transition-duration
What is the correct HTML element for inserting a line break?
br
tr
hr
span
Which method of the window object can be used to display a message to the user?
display()
alert()
message()
status()
What JavaScript engine does Node.js use?
Nitro
SpiderMonkey
Chakra
V8
Which HTML tag is used to define a hyperlink, and what attribute is used to specify the URL?
url>, link
link>, href
hyperlink>, src
a>, href
Inline elements are normally displayed without starting a new line.
True
False
Which is the module used for handling the multipart/form-data POST request?
FormData
multer
upload
urlencoded
What is callback?
A. A function that is passed as an argument to another function.
B. An asynchronous equivalent for a function.
C. A backend endpoint's URL.
D. An API call to the backend.
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
By default, npm installs dependencies in?
There is no default; you select where to install each package.
Global node_modules directory
Local node_modules directory
Write the CSS to add a background color of #ececec for all h1> elements. (Write it in lowercase and without any unnecessary spaces)
h1{background-color:#ececec;}
h1{bg-color:#ececec;}
What value is logged to the console?
function executor(resolve, reject( {
resolve(1);
}
function add(value) { return value +5;}
fuction multiply(value) {return value*6;}
let myPromise = new Promise(executor);
myPromise
.then(add)
.then(mutiply)
.then(console.log);
36
12
24
48
A web page document is considered to be which of the following in the Document Object Model (DOM)?
Property
Method
Attribute
Object
How can you make a bulleted list?
list>
dl>
ul>
ol>
Which of the above is the correct HTML anchor tag to create a link to http://fit.hanu.vn with the text 'FIT HANU'?
a href="http://fit.hanu.vn">FIT HANU
address="http://fit.hanu.vn">HANU FIT
a url="http://fit.hanu.vn">fit.hanu.vn
a src="http://fit.hanu.vn">http://fit.hanu.vn
When the user moves the mouse pointer away from a link that they had been hovering over, the browser detects which one of these events?
mouseoff
mouseaway
mouseout
mouseup
Which of the following is a valid set of JavaScript data types?
Number, Text, Object
Number, String, Object
Number, String, Array
Integer, Text, Object
How to write an IF statement for executing some code if i is not equal to 5?
if (i != 5)
if (i <> 5)
if i =! 5 then
if i > 5
Where can you access the captured values of URL parameters?
From the req.body object
From the req.data object
From the req.query object
From the req.params object
What is the configuration file that contains a Node.js project's dependencies?
pom.xml
manifest.json
config.json
package.json
The default behavior of a button in a form is to submit the form. What is the JavaScript method that cancels this default behavior?
event.preventDeault();
event.getDeault();
Which of these correctly describes 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);
1
2
3
error
Which of these is correct about HTML inline-block elements?
Small amount of content, no height or width
Take up the full width of the page (flows top to bottom)
Large blocks of content, has height and width
Small amount of content, has height and width
Where in an HTML document is the preferred place to refer to an external CSS file?
At the end of the document
At the end of body> section
At the beginning of body> section
In the head> section
In NodeJS modules, the variables & functions can be exposed (to be accessed outside the module) using
require
expose default
module.exports
export
App and Present in the design below?
App can just call methods on Present since App has a list of the Present objects
App passes one or more of its methods to Present as parameters. Present calls them in response to corresponding actions.
Give Present a reference to App in its constructor. Present can use this reference to call methods from App
present dispatches custom evnt in respone to actions. App listens for these events, then call its coressponding methods
Which of these is NOT suggested to support a responsive website?
For height and width, prefer percentage
Always add the meta viewport tag
For fonts, prefer px
Use @media queries to add styles for devices with different screen width
how do you group css selectors
seperate each selector with a sapce
separate each selector with a phus sign
seperate each selector with a comma
Q1. Can <meta> tag not be defined in the <head> tag?
A. True
B. False
Q2. Can you have multiple paragraphs within a single HTML document?
A. No, HTML allows only one paragraph per document
C. Yes, but only if they are in separate sections
B. Yes, you can have as many paragraphs as needed
D. It depends on the HTML version being used
Q3. How can you make a bulleted list?
C. <ul>
A. <list>
D. <ol>
B. <dl>
Q4. What is the recommended file format for a favicon in HTML?
C..jpg
A..gi
D..ico
B..png
Q5. In HTML, which attribute is used to specify the visible width of a text input field?
A. length
C. size
B. width
D. visible
Q6. How can you define a hyperlink to open in a new browser window or tab?
A. By adding 'new' in the href attribute
C. Using JavaScript code
B. Using the target attribute with a value of'_blank'
D. It's not possible to open a new window/tab with HTML
Q7. Which tag indicates a form field where the user can enter large amounts of text?
A. <label>
C. <a>
B. <button>
D. <textarea>
Q8. What does the <iframe> tag define in HTML?
A. Image Frame
C. Internal Frame
B. Inline Frame
D. Internet Frame
Q9. HTML code written in a Mac PC can be browsed in a PC with Windows 7 installed. Users will be able to see the same design that was designed on the Mac PC.
A. True
B. False
Q10. What is the correct HTML for inserting an audio file?
A. <music src="audio.mp3">
C. <audio src="audio.mp3">
B. <sound src="audio.mp3">
D. <file src="audio.mp3">
Q11. Which CSS property is used to specify the transparency of an element?
A. visibility
B. filter
C. transparency
D. opacity
Q12. Which property is used to control the display of the border's individual sides?
A. border
C. border-style
B. border-sides
D. border-side-style
Q13. How do you add a background color for all <h1> elements?
A. h1 {background-color:#FFFFFF;}
C. all.h1 {background-color:#FFFFFF;}
D. all {h1-background-color:#FFFFFF;}
B. h1.all {background-color: #FFFFFF;}
Q14. How do you make a list that lists its items with squares?
A. list-type: square;
B. list-style-type: square;
C. list: square;
D. list-style: square;
Q15. What is the CSS property to control the alignment of flex items?
A. justify-content
C. align-items
B. align-content
D. align-self
Q16. Which property is used to change the font of an element?
A. font-family
C. font-weight
B. font-style
D. font-face
Q17. Which of the following is valid color code?
A. rgb(15, 25, 35)
B
D
C. #82154675
B. #fca2ef
D. #ffa5e4a9
Q18. How do you display a border like this: Top border = 10 pixels, bottom border = 5 pixels, left border = 20 pixels, and right border = 1 pixel?
A. border-width: 5px 20px 10px 1px;
B. border-width: 10px 20px 5px 1px;
C. border-width: 10px 5px 20px 1px;
D. border-width: 10px 1px 5px 20px;
Q19. What is npm?
A. A package manager
B. A task runner
C. A package publisher
D. Both a task runner and a package manager
Q20. Which of the following is NOT a feature of Node.js?
A. Event-driven architecture
B. Non-blocking I/O
C. Built on Chrome's V8 JavaScript engine
D. Supports multi-threading
Q21. How to send a urlencoded POST request with fetch?
A. fetch(URL, {method: 'POST', headers: ['Content-Type: application/x-www-form- urlencoded']})
B. fetch(URL, {method: 'POST', headers: {'Content-Type': 'application/x-www-form- urlencoded'}})
C. fetch(URL, {'method': 'POST, 'Content-Type': 'application/x-www-form-urlencoded'})
D. fetch(URL, {method: 'POST', 'Content-Type': {'application': 'x-www-form- urlencoded'}})
Q22. Which of the following is correct?
A. The backend of an application is the supporting component that makes the frontend work.
B. The backend of an application uses the frontend for accessing data from the database.
C. The backend of an application is supported by the frontend and server through HTTP.
D. The frontend of an application is independent of the backend development.
Q23. What is a web service?
A. A software application that runs on a local machine
B. A type of database service
C. A program that only works on a specific operating system
D. A software functionality that can be invoked over the Internet using common protocols
Q24. How do you retrieve the value of a specific cookie sent in a request in Express.js?
A. req.get('cookieName')
C. req.cookies [cookieName]
B.req.cookie.value
D. req.values.cookieName
Q25. What does the POST verb in an HTTP request signify?
A. A new resource is being created
C. A resource is being updated
B. A resource is being deleted
D. A resource is being fetched
