Font size
WorksheetsSoftware Development - End of the Year
Total questions: 60
Worksheet time: 34mins
Complete the code to get the length of the string "Hello".
let greeting = "Hello";
console.log(greeting.______);
Complete the code to convert the string "123" to an integer.
let str = "123";
let num = ______;
Complete the code to add "grape" to the end of the array.
let fruits = ["apple", "banana"];
fruits.______("grape");
You’re loading supplies for a lunar mission. Which creates an array of items?
["oxygen", "food", "water"]
{"oxygen", "food", "water"}
("oxygen", "food", "water")
<oxygen, food, water>
Complete the code to get the number of items in the array.
let numbers = [1, 2, 3, 4];
console.log(numbers.______);
Check if the cargo array contains "food".
let cargo = ["oxygen", "food", "water"];
console.log(cargo.______( "food" ));
Whats the difference between let and const
Complete the function to return the sum of two distances.
function travel(a, b) {
return ______;
}
What will the following code output for
let age = 16;?
if (age >= 18) {
console.log("Adult");
}
else {
console.log("Minor");
}
Convert the alien signal "3.14" to a decimal number for analysis. Which code works?
let signal = "3.14";
let num = ______;
Calculate the square root of 16 for the shield strength.
console.log(Math.______(16));
Complete the code to access the second item in the array.
let colors = ["red", "blue", "green"];
console.log(colors[______]);
Greater than or equal to
> or =
> || =
>=
<=
What Javascript code matches this statement:
Their name is Kim and they are less than 16 years old
if (name = "Kim" && age < 16 )
if (name === "Kim" && age < 16 )
if (name = "Kim" || age < 16 )
if (name === "Kim" || age < 16 )
What symbol represents the and operator in JavaScript?
AND
and
&
&&
What symbol represents the or operator in JavaScript?
OR
or
||
|
What is == ?
What is ! == ?
What Javascript code matches this statement:
The score is not 0
if (score != 0)
if (score =! 0)
if (score not 0)
if (score !! 0)
What Javascript code matches this statement:
The player's health is 0 and they still have a life remaining.
if (health == "0" && lives > "0")
if (health === 0 && lives > 0)
if (health === 0 && lives >= 0)
if (health <1 && lives > 0)
Fill in the blank to match the statement:
The player has at least 2 lives remaining.
if( (a) )
Do not use spaces.
Fill in the blank to match the statement:
The score is no more than 20.
if( (a) )
Do not use spaces.
What is the role of addEventListener()?
To fetch data
To listen and respond to user actions
To create HTML
To style elements
Which of these best describes an API?
A bridge between applications
A browser
A programming language
A database
What code will result in the above?
alert("Please enter your phone number:")
confirm("Please enter your phone number:")
prompt("Please enter your phone number:")
Which skill does the Advice Generator project mainly help students practice?
Graphic design
File compression
Working with APIs using JavaScript
Database administration
Allow functions to accept input and perform a task using the inputs.
Global Namespace
Parameter
Argument
Blocks
A reusable block of code that groups together a sequence of statements to perform a specific task.
Function
Identifier
Argument
Blocks
Which of the following is/are strings?
4
4.0
'4'
3.9
What is the result of 2 + "2"?
4
"4"
2
22
What is first index value of an array?
-1
0
1
undefine
The sort() method sorts in JavaScript will arrange an array alphabetically, but will not sort numbers in ascending or descending order.
true
false
Which of these ways of creating a new Array is valid?
var x = ["A", "B", "C"];
var x = new Array["A", "B", "C"];
var x = (A", "B", "C");
var x = new Array("A", "B", "C");
Which of the following will add a new element to the end of the array?
push()
pop()
shift()
Which of these creates an array in Javascript named myNumber that contains the following numbers:
5, 7, 11, 23, 1
Use the var keyword to create variables
(a)
Which JavaScript function is used to generate a random number?
ParseInt()
What does Math.floor() do in JavaScript?
What does document.getElementById() do?
Finds an HTML element by its ID
Which JavaScript property is used to change text inside an HTML element?
What is the purpose of CSS in these projects?
Which HTML tag is used to add JavaScript to a webpage?
<style>
<script>
<js>
<java>
The HTML attribute used to connect JavaScript to a button click is (a)
In the digital clock project, which object is used to get the current time?
Date()
Clock()
Time()
Which function allows the clock to update every second?
What does new Date().getHours() return?
The current day
The current hour
The current hour
The current minute
What is the main purpose of the Advice Generator App project?
To fetch and display random advice from an API
Which API is used in the Advice Generator App project?
GitHub API
Google API
Advice Slip API
Weather API
Based on the Advice Generator App Project, what does fetch() do?
Styles the page
Selects HTML elements
Saves data to a database
Requests data from a server or API
In the Advice Generator App, why is 'async' used in the 'fetchData' function?
To make code shorter
To store variables
'async' is just for aesthetics
To handle tasks that take time without freezing the page
Based on the Advice Generator App, which keyword allows JavaScript to wait for a response?
wait
pause
await
stop
In the Advice Generator App, which HTML element displays the advice number?
<p id="advice-id">
<div>
<span>
<h1>
In the Advice Generator App, Which HTML element displays the main advice text?
<p>
<div>
<h1 id="advice">
<span>
In the Advice Generator App, what happens when the dice image is clicked?
The page refreshes
The app closes
A new advice is fetched from the API
Nothing happens
What does innerText do?
Based on the Advice Generator App, where is the API URL placed?
Inside the image tag
Inside the fetch() function
In HTML
In CSS
Whats the full meaning of API?
(a)
What format does the API return its data in?
HTML
CSS
JSON
XML
Based on the Advice Generator App, how is the dice button selected in JavaScript?
getElementById
querySelector(".dice-btn")
getElementsByClassName
selectDice()
