wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

wpr giữa kì

Total questions: 41

Worksheet time: 21mins

Name
Class
Date
1.

How do you select all p elements inside a div element

a)

div.p

b)

div + p

c)

div p

d)

div#p

2.

get the value "Volvo" from the cars array const cars = [ "Saab", "Volvo", "BMW"] let x = .......

a)

cars[1]

b)

cars[0]

c)

cars[2]

d)

cars[3]

3.

which HTML tag is used to define an internal style sheet

a)

<sheet type = "text/css">

b)

<CSS>

c)

<style>

d)

<script>

4.

choose the correct HTML element for the largest heading

a)

<heading>

b)

<head>

c)

<h6>
d)

<h1>

5.

Which of the following Node modules is required for working with files and directories on the server?

a)

files

b)

os

c)

fs

d)

system

6.

Where can you access the capture values of URL parameters?

a)

from the req.query object

b)

from the req.data object

c)

from the req.body object

d)

from the req.params object

7.

Use the correct math method to get the square root of 9 (do not add any unnecessary spaces). int x = Math.(......)

a)

sqrt(9)

b)

pow(9)

c)

abs(9)

d)

log(9)

8.

What is the command to create a Node.js project?

a)

npm install

b)

npm create

c)

npm init

d)

npm start

9.

What are the 2 native functions that run asynchronously in JavaScript?

a)

Session

b)

async

c)

setTimeout

d)

delay

e)

setinterval

10.

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

a)

upload

b)

urlencoded

c)

FormData

d)

multer

11.

Write the CSS to remove underline from all hyperlinks (write it in lowercase and without any unnecessary spaces)

a)

a{text-decoration:none;}

b)

a{text-decoration:underline;}

c)

a{font-weight:bold;}

d)

a{color:red;}

12.

Write the CSS to add a background color of #ececec for all

elements (write it in lowercase and without any unnecessary spaces)

a)

h1{background-color: #ececec;}

b)

h1{background: #ececec;}

c)

h1{backgroundcolor: #ececec;}

d)

h1{background-color:#ececec;}

13.

What is the output of this code console.log(1+ "2" + "2");

a)

122

b)

NaN2

c)

32

d)

NaN

14.

How to write an IF statement in JavaScript

a)

if i = 5 then

b)

if i = 5

c)

if i == 5 then

d)

if(i==5)

15.

What is the correct HTML for making a multi-line text field

a)

<input type = "text" multiline="yes">

b)

<input type = "textbox">

c)

<textarea>

d)

<input type = "textarea" >

16.

Make the function display "Hello" in the HTML element with ID "demo"

a)

document.getElementById("demo").innerHTML = "Hello";

b)

document.getElementByName("demo").innerHTML = "Hello";

c)

document.getElementById("demo").innerText = "Hello";

d)

document.getElementByClassName("demo").innerHTML = "Hello";

17.

In JavaScript, how do you display an alert box with the text

a)

alert('HelloWorld');

b)

console.log('HelloWorld');

c)

document.write('HelloWorld');

d)

prompt('HelloWorld');

18.

create an object called person with name = John, age = 50. then, access the object to log the text "John is 50" to the console

a)

name: "John", age: 50; console.log(person.name + " is " + person.age)

b)

var person = {name: "John", age: 50}; console.log(person)

c)

var person = {name: "John", age: 50}; console.log(name + " is " + age)

d)

var person = {name: "John", age: 50}; console.log(person.name + " is " + person.age)

19.

how do you install global packages with npm

a)

npm install -l

b)

npm install -g

c)

npm install-global

d)

npm global

20.

what is the console output if the button is clicked after 5 seconds

function buttonExecutor(resolve, reject) {

let myBtn = document. querySelector('button');

myBtn.addEventListener('click', function() {

resolve();

console.log('clicked"); });

setTimeout(reject, 5000); }

let betterClick = new Promise(buttonExecutor);

betterClick

.then(function() {console.log('Option A'); })

.catch(function() {console.log('Option B'); })

a)

clicked! Option A

b)

clicked! Option B

c)

clicked!

d)

Option B clicked!

21.

Change the text color of the

element to red (do not add any unnecessary spaces) Fill in the blank to correctly change the text color of the

element to red.

a)

style.color

b)

style.textColor

c)

color.style

d)

text.color

22.

Which of the following can describe JavaScript as used in a web page?

a)

a scripting language

b)

a language created by Microsoft

c)

an easy form of Java

d)

a markup language

23.

How do you run a js file with Node.js?

a)

node app

b)

node app.js

c)

npm start app.js

d)

node run app.js

24.

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

a)

font-style

b)

font-weight

c)

font-family

d)

font-face

25.

make the function display "Hello" in the HTML element with ID "demo" function myFunction(){ document.......("demo").………………………… = "Hello"; Fill in the blank to complete the code.

a)

getElementById("demo").innerHTML = "Hello";

b)

getElementsByClassName("demo").innerHTML = "Hello";

c)

querySelector("demo").innerHTML = "Hello";

d)

getElementByTagName("demo").innerHTML = "Hello";

26.

in HTML which attribute is used to specify that an input field must be filled out

a)

formvalidate

b)

validate

c)

required

d)

placeholder

27.

What is the correct console output order?

a)

123

b)

321

c)

231

d)

132

28.

create a date object and alert the current date and time (do not add any unnecessary spaces) const d..... alert(d) new Date();

a)

const d = new Date();

b)

const d = Date();

c)

const d = new date();

d)

const d = date();

29.

let x = await fetch(URL); which of the following best describes x

a)

a promise object

b)

the response text

c)

an object which was parsed from a JSON string sent by the server

d)

an object which contains the meta data of the response

30.

convert the text into an UPPERCASE text let txt = "Hello World"; txt txt........ Fill in the blank to convert the text to uppercase.

a)

txt.toUpperCase()

b)

txt.upperCase()

c)

txt.toUpper()

d)

txt.makeUpperCase()

31.

const obj = {

"members": [

{name: "David", age: 24},

{name: "James", age: 21 }, {name: "Kate", age: 21}, 1. }

"average-age": 22

Complete the following statement to get Kate's age

let age =………………………………

a)

obj.members[2].age

b)

obj.members[0].age

c)

obj.age[2]

d)

obj[2].members.age

32.

In JavaScript how to insert a comment that has more than one line

a)

// This comment has than one line //

b)

<!-- This comment has more than one line -->

c)

This comment has more than one line

d)

/*This comment has more than one line */

33.

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)

4

b)

5

c)

0

d)

5.1

34.

What is the correct HTML for inserting an image?

a)

<image src="image.gif" alt= "My Image">

b)

<image href="image.gif" alt= "My Image">

c)

<img alt="My Image">image.gif </img>

d)

<img src="image.gif" alt= "My Image">

35.

HTML comments start with and end with HTML comments start with <!-- and end with -->

a)

true

b)

false

36.

In JavaScript, what does an asynchronous function return?

a)

nothing

b)

the function's intended result

c)

a Timer

d)

a Promise

37.

Which CSS property controls the text size?

a)

text-size

b)

font-size

c)

font-width

d)

size

38.

What is the correct JavaScript syntax to make the following

element disappear

Hello, there!

a)

document.getElementById("demo").style.display = "invisible";

b)

document.getElementById("demo").visibility = false;

c)

document.getElementById("demo").style.display = "none";

d)

document.getElementById("demo").display = "invisible";

39.

Complete the following statement to import the asynchronous version of the file system module in Node.js. (do not add any unnecessary spaces) const fs = require('___')

a)

fs

b)

filesystem

c)

file-system

d)

fs-async

40.

How can you add a comment in JavaScript?

a)

This is a comment

b)

// This is a comment

c)

<!-- This is a comment -->

d)

#This is a comment

41.

What is the correct JavaScript syntax to change the content of the HTML element below

This is a demonstration.

a)

#demo.innerHTML = "Hello World!";

b)

document.getElementByName("p").innerHTML = "Hello World!";

c)

document.getElementById("demo").innerHTML = "Hello World!";