Worksheetswpr giữa kì
Total questions: 41
Worksheet time: 21mins
How do you select all p elements inside a div element
div.p
div + p
div p
div#p
get the value "Volvo" from the cars array const cars = [ "Saab", "Volvo", "BMW"] let x = .......
cars[1]
cars[0]
cars[2]
cars[3]
which HTML tag is used to define an internal style sheet
<sheet type = "text/css">
<CSS>
<style>
<script>
choose the correct HTML element for the largest heading
<heading>
<head>
<h6>
<h1>
Which of the following Node modules is required for working with files and directories on the server?
files
os
fs
system
Where can you access the capture values of URL parameters?
from the req.query object
from the req.data object
from the req.body object
from the req.params object
Use the correct math method to get the square root of 9 (do not add any unnecessary spaces). int x = Math.(......)
sqrt(9)
pow(9)
abs(9)
log(9)
What is the command to create a Node.js project?
npm install
npm create
npm init
npm start
What are the 2 native functions that run asynchronously in JavaScript?
Session
async
setTimeout
delay
setinterval
Which is the module used for handling the multipart/form-data POST request?
upload
urlencoded
FormData
multer
Write the CSS to remove underline from all hyperlinks (write it in lowercase and without any unnecessary spaces)
a{text-decoration:none;}
a{text-decoration:underline;}
a{font-weight:bold;}
a{color:red;}
Write the CSS to add a background color of #ececec for all
elements (write it in lowercase and without any unnecessary spaces)
h1{background-color: #ececec;}
h1{background: #ececec;}
h1{backgroundcolor: #ececec;}
h1{background-color:#ececec;}
What is the output of this code console.log(1+ "2" + "2");
122
NaN2
32
NaN
How to write an IF statement in JavaScript
if i = 5 then
if i = 5
if i == 5 then
if(i==5)
What is the correct HTML for making a multi-line text field
<input type = "text" multiline="yes">
<input type = "textbox">
<textarea>
<input type = "textarea" >
Make the function display "Hello" in the HTML element with ID "demo"
document.getElementById("demo").innerHTML = "Hello";
document.getElementByName("demo").innerHTML = "Hello";
document.getElementById("demo").innerText = "Hello";
document.getElementByClassName("demo").innerHTML = "Hello";
In JavaScript, how do you display an alert box with the text
alert('HelloWorld');
console.log('HelloWorld');
document.write('HelloWorld');
prompt('HelloWorld');
create an object called person with name = John, age = 50. then, access the object to log the text "John is 50" to the console
name: "John", age: 50; console.log(person.name + " is " + person.age)
var person = {name: "John", age: 50}; console.log(person)
var person = {name: "John", age: 50}; console.log(name + " is " + age)
var person = {name: "John", age: 50}; console.log(person.name + " is " + person.age)
how do you install global packages with npm
npm install -l
npm install -g
npm install-global
npm global
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'); })
clicked! Option A
clicked! Option B
clicked!
Option B clicked!
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.
style.color
style.textColor
color.style
text.color
Which of the following can describe JavaScript as used in a web page?
a scripting language
a language created by Microsoft
an easy form of Java
a markup language
How do you run a js file with Node.js?
node app
node app.js
npm start app.js
node run app.js
Which property is used to change the font of an element?
font-style
font-weight
font-family
font-face
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.
getElementById("demo").innerHTML = "Hello";
getElementsByClassName("demo").innerHTML = "Hello";
querySelector("demo").innerHTML = "Hello";
getElementByTagName("demo").innerHTML = "Hello";
in HTML which attribute is used to specify that an input field must be filled out
formvalidate
validate
required
placeholder
What is the correct console output order?
123
321
231
132
create a date object and alert the current date and time (do not add any unnecessary spaces) const d..... alert(d) new Date();
const d = new Date();
const d = Date();
const d = new date();
const d = date();
let x = await fetch(URL); which of the following best describes x
a promise object
the response text
an object which was parsed from a JSON string sent by the server
an object which contains the meta data of the response
convert the text into an UPPERCASE text let txt = "Hello World"; txt txt........ Fill in the blank to convert the text to uppercase.
txt.toUpperCase()
txt.upperCase()
txt.toUpper()
txt.makeUpperCase()
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 =………………………………
obj.members[2].age
obj.members[0].age
obj.age[2]
obj[2].members.age
In JavaScript how to insert a comment that has more than one line
// This comment has than one line //
<!-- This comment has more than one line -->
This comment has more than one line
/*This comment has more than one line */
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?
4
5
0
5.1
What is the correct HTML for inserting an image?
<image src="image.gif" alt= "My Image">
<image href="image.gif" alt= "My Image">
<img alt="My Image">image.gif </img>
<img src="image.gif" alt= "My Image">
HTML comments start with and end with HTML comments start with <!-- and end with -->
true
false
In JavaScript, what does an asynchronous function return?
nothing
the function's intended result
a Timer
a Promise
Which CSS property controls the text size?
text-size
font-size
font-width
size
What is the correct JavaScript syntax to make the following
element disappear
Hello, there!
document.getElementById("demo").style.display = "invisible";
document.getElementById("demo").visibility = false;
document.getElementById("demo").style.display = "none";
document.getElementById("demo").display = "invisible";
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('___')
fs
filesystem
file-system
fs-async
How can you add a comment in JavaScript?
This is a comment
// This is a comment
<!-- This is a comment -->
#This is a comment
What is the correct JavaScript syntax to change the content of the HTML element below
This is a demonstration.
#demo.innerHTML = "Hello World!";
document.getElementByName("p").innerHTML = "Hello World!";
document.getElementById("demo").innerHTML = "Hello World!";
