wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

wpr midterm

Total questions: 82

Worksheet time: 41mins

Name
Class
Date
1.

How can you define a hyperlink to open in a new browser window or tab?

a)

By adding 'new' in the href attribute

b)

Using the target attribute with a value of '_blank'

c)

It's not possible to open a new window/tab with HTML

d)

Using JavaScript code

2.

Which of the following statements in JavaScript will assign the value 5 to the variable productCost?

a)

productCost = 5;

b)

productCost => 5;

c)

productCost <= 5;

d)

productCost == 5;

3.

Which property is used to control the space between characters in CSS?

a)

C. letter-spacing

b)

D. font-spacing

c)

character-spacing

d)

text-spacing

4.

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)

A. express.serve

b)

B. express.static

c)

C. app.static

d)

D. app.serve

5.

How do you make each word in a text start with a capital letter?

a)

transform: capitalize;

b)

text-transform: cap;

c)

transform: cap;

d)

text-transform: capitalize;

6.

With the express module, how do you get the query string parameter named id?

a)

let id = req.query.id

b)

let id = req.get.id

c)

const id = req.body.id

d)

const id = req.params.id

7.

How do you set the maximum width of an element?

a)

A. max-width

b)

B. max-size

c)

C. width

d)

D. max-height

8.

Which method sends a JSON response in Express.js?

a)
A. res.render()
b)

res.json()

c)

res.send()

d)

res.sendFile()

9.

How to write an IF statement in JavaScript?

a)

if i = 5

b)

if i = 5 then

c)

if (i == 5)

d)

if i == 5 then

10.

How do you create a shadow effect in CSS?

a)

shadow

b)

box-outline

c)

box-shadow

d)

text-shadow

11.

What's the primary use of middleware in Express?

a)

A. Frontend rendering

b)

B. Data storage

c)

C. Error handling

d)

D. Execution of functions in the request-response cycle

12.

What is the function to stop an interval timer?

a)

shutdownTimer

b)

clearTimer

c)

stopTimer

d)

clearInterval

13.

Block elements are normally displayed without starting a new line.

a)
A. Đúng (True)
b)

false

14.

What is the method that allows you to move a file to another directory?

a)

fs.moveTo

b)

fs.rename

c)

fs.renameFile

d)

fs.move

15.

What is the purpose of the require() statement in Node.js?

a)

To load a module

b)

To compile a module

c)

To create a new module

d)

To delete a module

16.

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)

A. 1 3 2

b)

B. 1 2 3

17.

Which property is used to control the space between flex items?

a)

gap

b)

flex-spacing

c)

flex-gap

d)

spacing

18.

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: 10px 1px 5px 20px;

b)

border-width: 10px 5px 20px 1px;

c)

border-width: 5px 20px 1px 10px;

19.

Which of the following is not a valid HTTP method?

a)

PUT

b)

GET

c)

POST

d)

HEADER

20.

Node.js is a runtime environment for running JavaScript programs outside of the _______.

a)

browser

b)

server

c)

database

d)

terminal

21.

Which of the following is a browser?

a)

browser

b)

server

c)

operating system

d)

database

22.

In HTML, which attribute is used to specify the visible width of a text input field?

a)

size

b)

length

c)

width

d)

visible

23.

How do you select elements with the class name?

a)

.test

b)

#test

c)

*test

d)

.test

24.

What is the correct way to write a JavaScript array?

a)

let colors = (1:"red", 2:"green", 3:"blue")

b)

let colors = "red", "green", "blue"

c)

let colors = 1 = ("red"), 2 = ("green"), 3 = ("blue")

d)

let colors = ["red", "green", "blue"]

25.

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.

a)

person.firstName

b)

person.lastName

c)

person["John"]

d)

console.log(person)

26.

Which of the following configures empty space between the content of the HTML element (typically text) and the border?

a)

space property

b)

border property

c)

margin property

d)

padding property

27.

What is the correct HTML for creating a hyperlink that does not underline the text?

a)

<a href="url" text-decoration="none">Link</a>

b)

<a href="url" style="text-decoration=none",>Link</a>

c)

<a href="url" no-underline>Link</a>

d)

<a href="url" underline="none">Link</a>

28.

Which of the following statements 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.

29.

Which CSS property is used to change the speed of an animation?

a)

animation-duration

b)

animation-name

c)

animation-delay

d)

animation-iteration-count

30.

Which of the following is the correct CSS property for specifying the duration of an animation?

a)

animation-duration

b)

animation-speed

c)

transition-speed

d)

transition-duration

31.

What is the correct HTML element for inserting a line break?

a)

br

b)

tr

c)

hr

d)

span

32.

Which method of the window object can be used to display a message to the user?

a)

display()

b)

alert()

c)

message()

d)

status()

33.

What JavaScript engine does Node.js use?

a)

Nitro

b)

SpiderMonkey

c)

Chakra

d)

V8

34.

Which HTML tag is used to define a hyperlink, and what attribute is used to specify the URL?

a)

url>, link

b)

link>, href

c)

hyperlink>, src

d)

a>, href

35.

Inline elements are normally displayed without starting a new line.

a)

True

b)

False

36.

Which is the module used for handling the multipart/form-data POST request?

a)

FormData

b)

multer

c)

upload

d)

urlencoded

37.

What is callback?

a)

A. A function that is passed as an argument to another function.

b)

B. An asynchronous equivalent for a function.

c)

C. A backend endpoint's URL.

d)

D. An API call to the backend.

38.

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)

A. 5

b)

B. 5.1

c)

C. 4

d)

D. 0

39.

By default, npm installs dependencies in?

a)

There is no default; you select where to install each package.

b)

Global node_modules directory

c)

Local node_modules directory

40.

Write the CSS to add a background color of #ececec for all h1> elements. (Write it in lowercase and without any unnecessary spaces)

a)

h1{background-color:#ececec;}

b)

h1{bg-color:#ececec;}

41.

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);

a)

36

b)

12

c)

24

d)

48

42.

A web page document is considered to be which of the following in the Document Object Model (DOM)?

a)

Property

b)

Method

c)

Attribute

d)

Object

43.

How can you make a bulleted list?

a)

list>

b)

dl>

c)

ul>

d)

ol>

44.

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)

a href="http://fit.hanu.vn">FIT HANU

b)

address="http://fit.hanu.vn">HANU FIT

c)

a url="http://fit.hanu.vn">fit.hanu.vn

d)

a src="http://fit.hanu.vn">http://fit.hanu.vn

45.

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?

a)

mouseoff

b)

mouseaway

c)

mouseout

d)

mouseup

46.

Which of the following is a valid set of JavaScript data types?

a)

Number, Text, Object

b)

Number, String, Object

c)

Number, String, Array

d)

Integer, Text, Object

47.

How to write an IF statement for executing some code if i is not equal to 5?

a)

if (i != 5)

b)

if (i <> 5)

c)

if i =! 5 then

d)

if i > 5

48.

Where can you access the captured values of URL parameters?

a)

From the req.body object

b)

From the req.data object

c)

From the req.query object

d)

From the req.params object

49.

What is the configuration file that contains a Node.js project's dependencies?

a)

pom.xml

b)

manifest.json

c)

config.json

d)

package.json

50.

The default behavior of a button in a form is to submit the form. What is the JavaScript method that cancels this default behavior?

a)

event.preventDeault();

b)

event.getDeault();

51.

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);

a)

1

b)

2

c)

3

d)

error

52.

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

53.

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

54.

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

a)

require

b)

expose default

c)

module.exports

d)

export

55.

App and Present in the design below?

a)

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

b)

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

c)

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

d)

present dispatches custom evnt in respone to actions. App listens for these events, then call its coressponding methods

56.

Which of these is NOT suggested to support a responsive website?

a)

For height and width, prefer percentage

b)

Always add the meta viewport tag

c)

For fonts, prefer px

d)

Use @media queries to add styles for devices with different screen width

57.

how do you group css selectors

a)

seperate each selector with a sapce

b)

separate each selector with a phus sign

c)

seperate each selector with a comma

58.

Q1. Can <meta> tag not be defined in the <head> tag?

a)

A. True

b)

B. False

59.

Q2. Can you have multiple paragraphs within a single HTML document?

a)

A. No, HTML allows only one paragraph per document

b)

C. Yes, but only if they are in separate sections

c)

B. Yes, you can have as many paragraphs as needed

d)

D. It depends on the HTML version being used

60.

Q3. How can you make a bulleted list?

a)

C. <ul>

b)

A. <list>

c)

D. <ol>

d)

B. <dl>

61.

Q4. What is the recommended file format for a favicon in HTML?

a)

C..jpg

b)

A..gi

c)

D..ico

d)

B..png

62.

Q5. In HTML, which attribute is used to specify the visible width of a text input field?

a)

A. length

b)

C. size

c)

B. width

d)

D. visible

63.

Q6. How can you define a hyperlink to open in a new browser window or tab?

a)

A. By adding 'new' in the href attribute

b)

C. Using JavaScript code

c)

B. Using the target attribute with a value of'_blank'

d)

D. It's not possible to open a new window/tab with HTML

64.

Q7. Which tag indicates a form field where the user can enter large amounts of text?

a)

A. <label>

b)

C. <a>

c)

B. <button>

d)

D. <textarea>

65.

 

Q8. What does the <iframe> tag define in HTML?

a)

A. Image Frame

b)

C. Internal Frame

c)

B. Inline Frame

d)

D. Internet Frame

66.

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)

A. True

b)

B. False

67.

Q10. What is the correct HTML for inserting an audio file?

a)

A. <music src="audio.mp3">

b)

C. <audio src="audio.mp3">

c)

B. <sound src="audio.mp3">

d)

D. <file src="audio.mp3">

68.

Q11. Which CSS property is used to specify the transparency of an element?

a)

A. visibility

b)

B. filter

c)

C. transparency

d)

D. opacity

69.

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

a)

A. border

b)

C. border-style

c)

B. border-sides

d)

D. border-side-style

70.

Q13. How do you add a background color for all <h1> elements?

a)

A. h1 {background-color:#FFFFFF;}

b)

C. all.h1 {background-color:#FFFFFF;}

c)

D. all {h1-background-color:#FFFFFF;}

d)

B. h1.all {background-color: #FFFFFF;}

71.

Q14. How do you make a list that lists its items with squares?

a)

A. list-type: square;

b)

B. list-style-type: square;

c)

C. list: square;

d)

D. list-style: square;

72.

Q15. What is the CSS property to control the alignment of flex items?

a)

A. justify-content

b)

C. align-items

c)

B. align-content

d)

D. align-self

73.

Q16. Which property is used to change the font of an element?

a)

A. font-family

b)

C. font-weight

c)

B. font-style

d)

D. font-face

74.

Q17. Which of the following is valid color code?

a)

A. rgb(15, 25, 35)
B
D

b)

C. #82154675

c)

B. #fca2ef

d)

D. #ffa5e4a9

75.

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)

A. border-width: 5px 20px 10px 1px;

b)

B. border-width: 10px 20px 5px 1px;

c)

C. border-width: 10px 5px 20px 1px;

d)

D. border-width: 10px 1px 5px 20px;

76.

Q19. What is npm?

a)

A. A package manager

b)

B. A task runner

c)

C. A package publisher

d)

D. Both a task runner and a package manager

77.

Q20. Which of the following is NOT a feature of Node.js?

a)

A. Event-driven architecture

b)

B. Non-blocking I/O

c)

C. Built on Chrome's V8 JavaScript engine

d)

D. Supports multi-threading

78.

Q21. How to send a urlencoded POST request with fetch?

a)

A. fetch(URL, {method: 'POST', headers: ['Content-Type: application/x-www-form- urlencoded']})

b)

B. fetch(URL, {method: 'POST', headers: {'Content-Type': 'application/x-www-form- urlencoded'}})

c)

C. fetch(URL, {'method': 'POST, 'Content-Type': 'application/x-www-form-urlencoded'})

d)

D. fetch(URL, {method: 'POST', 'Content-Type': {'application': 'x-www-form- urlencoded'}})

79.

Q22. Which of the following is correct?

a)

A. The backend of an application is the supporting component that makes the frontend work.

b)

B. The backend of an application uses the frontend for accessing data from the database.

c)

C. The backend of an application is supported by the frontend and server through HTTP.

d)

D. The frontend of an application is independent of the backend development.

80.

Q23. What is a web service?

a)

A. A software application that runs on a local machine

b)

B. A type of database service

c)

C. A program that only works on a specific operating system

d)

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

81.

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

a)

A. req.get('cookieName')

b)

C. req.cookies [cookieName]

c)

B.req.cookie.value

d)

D. req.values.cookieName

82.

Q25. What does the POST verb in an HTTP request signify?

a)

A. A new resource is being created

b)

C. A resource is being updated

c)

B. A resource is being deleted

d)

D. A resource is being fetched