wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Software Development - End of the Year

Total questions: 60

Worksheet time: 34mins

Name
Class
Date
1.

Complete the code to get the length of the string "Hello".

let greeting = "Hello";
console.log(greeting.______);

a)
count
b)
length
c)
size
d)
getLength
2.

Complete the code to convert the string "123" to an integer.

let str = "123";
let num = ______;

a)
num = str * 1;
b)
num = Number(str);
c)
num = str.toInteger();
d)
num = parseInt(str);
3.

Complete the code to add "grape" to the end of the array.

let fruits = ["apple", "banana"];
fruits.______("grape");

a)
fruits.append('grape')
b)
fruits.insert('grape')
c)
fruits.addItem('grape')
d)
fruits.push("grape");
4.

You’re loading supplies for a lunar mission. Which creates an array of items?

a)
  1. ["oxygen", "food", "water"]

b)
  1. {"oxygen", "food", "water"}

c)
  1. ("oxygen", "food", "water")

d)
  1. <oxygen, food, water>

5.

Complete the code to get the number of items in the array.

let numbers = [1, 2, 3, 4];

console.log(numbers.______);

a)
count
b)
size
c)
total
d)
length
6.

Check if the cargo array contains "food".

let cargo = ["oxygen", "food", "water"];

console.log(cargo.______( "food" ));

a)
includes
b)
search
c)
find
d)
has
7.

Whats the difference between let and const

a)
'let' is used for constants; 'const' is for variables.
b)
'let' allows reassignment; 'const' does not.
c)
'let' cannot be redeclared; 'const' can be redeclared.
d)
'let' is block-scoped; 'const' is function-scoped.
8.

Complete the function to return the sum of two distances.

function travel(a, b) {

return ______;

}

a)
return a - b;
b)
return a + b;
c)
return a * b;
d)
return a / b;
9.

What will the following code output for

let age = 16;?

if (age >= 18) {

console.log("Adult");

}

else {

console.log("Minor");

}

a)
Minor
b)
Senior
c)
Child
d)
Teenager
10.

Convert the alien signal "3.14" to a decimal number for analysis. Which code works?

let signal = "3.14";

let num = ______;

a)
let num = parseFloat(signal);
b)
let num = parseInt(signal);
c)
let num = signal.toFixed(2);
d)
let num = Number(signal);
11.

Calculate the square root of 16 for the shield strength.

console.log(Math.______(16));

a)
abs
b)
sqrt
c)
pow
d)
log
12.

Complete the code to access the second item in the array.

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

console.log(colors[______]);

a)
0
b)
2
c)
1
d)
3
13.

Greater than or equal to

a)

> or =

b)

> || =

c)

>=

d)

<=

14.

What Javascript code matches this statement:

Their name is Kim and they are less than 16 years old

a)

if (name = "Kim" && age < 16 )

b)

if (name === "Kim" && age < 16 )

c)

if (name = "Kim" || age < 16 )

d)

if (name === "Kim" || age < 16 )

15.

What symbol represents the and operator in JavaScript?

a)

AND

b)

and

c)

&

d)

&&

16.

What symbol represents the or operator in JavaScript?

a)

OR

b)

or

c)

||

d)

|

17.
Comparision Operators
What is == ? 
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
18.
Comparision Operators
What is ! == ?
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
19.
The conditional statement, in Javascript, begins with the word _______.
a)
Then
b)
Else
c)
If
d)
OK
20.

What Javascript code matches this statement:

The score is not 0

a)

if (score != 0)

b)

if (score =! 0)

c)

if (score not 0)

d)

if (score !! 0)

21.

What Javascript code matches this statement:

The player's health is 0 and they still have a life remaining.

a)

if (health == "0" && lives > "0")

b)

if (health === 0 && lives > 0)

c)

if (health === 0 && lives >= 0)

d)

if (health <1 && lives > 0)

22.

Fill in the blank to match the statement:

The player has at least 2 lives remaining.


if( (a)   )


Do not use spaces.

23.

Fill in the blank to match the statement:

The score is no more than 20.


if( (a)   )


Do not use spaces.

24.

What is the role of addEventListener()?

a)

To fetch data

b)

To listen and respond to user actions

c)

To create HTML

d)

To style elements

25.

Which of these best describes an API?

a)

A bridge between applications

b)

A browser

c)

A programming language

d)

A database

26.

What code will result in the above?

a)

alert("Please enter your phone number:")

b)

confirm("Please enter your phone number:")

c)

prompt("Please enter your phone number:")

27.

Which skill does the Advice Generator project mainly help students practice?

a)

Graphic design

b)

File compression

c)

Working with APIs using JavaScript

d)

Database administration

28.

Allow functions to accept input and perform a task using the inputs.

a)

Global Namespace

b)

Parameter

c)

Argument

d)

Blocks

29.

A reusable block of code that groups together a sequence of statements to perform a specific task.

a)

Function

b)

Identifier

c)

Argument

d)

Blocks

30.

Which of the following is/are strings?

a)

4

b)

4.0

c)

'4'

d)

3.9

31.

What is the result of 2 + "2"?

a)

4

b)

"4"

c)

2

d)

22

32.
An array is;
a)
Shapes
b)
Sizes
c)
Options
d)
Lists of data
33.

What is first index value of an array?

a)

-1

b)

0

c)

1

d)

undefine

34.

The sort() method sorts in JavaScript will arrange an array alphabetically, but will not sort numbers in ascending or descending order.

a)

true

b)

false

35.

Which of these ways of creating a new Array is valid?

a)

var x = ["A", "B", "C"];

b)

var x = new Array["A", "B", "C"];

c)

var x = (A", "B", "C");

d)

var x = new Array("A", "B", "C");

36.

Which of the following will add a new element to the end of the array?

a)

push()

b)

pop()

c)

shift()

37.

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)  

38.

Which JavaScript function is used to generate a random number?

a)

ParseInt()

b)
Math.generateRandom()
c)
Math.getRandomNumber()
d)
Math.random()
39.

What does Math.floor() do in JavaScript?

a)
Math.floor() converts a number to a string format.
b)
Math.floor() calculates the square root of a number.
c)
Math.floor() rounds a number down to the nearest integer.
40.

What does document.getElementById() do?

a)
It removes an HTML element by its ID.
b)
It creates a new HTML element.
c)
It updates the content of an HTML element.
d)

Finds an HTML element by its ID

41.

Which JavaScript property is used to change text inside an HTML element?

a)
innerHTML
b)
textContent
c)
innerText
d)
htmlContent
42.

What is the purpose of CSS in these projects?

a)
CSS helps in managing database connections.
b)
CSS is primarily for writing JavaScript functions.
c)
CSS is used to create server-side scripts.
d)
The purpose of CSS in these projects is to style and layout web pages.
43.

Which HTML tag is used to add JavaScript to a webpage?

a)

<style>

b)

<script>

c)

<js>

d)

<java>

44.

The HTML attribute used to connect JavaScript to a button click is (a)  

45.

In the digital clock project, which object is used to get the current time?

a)

Date()

b)

Clock()

c)

Time()

46.

Which function allows the clock to update every second?

a)
refreshTime
b)
setInterval
c)
updateClock
d)
setTimeout
47.

What does new Date().getHours() return?

a)

The current day

b)

The current hour

c)

The current hour

d)

The current minute

48.

What is the main purpose of the Advice Generator App project?

a)

To fetch and display random advice from an API

b)
To generate random quotes for users.
c)
To track user habits and preferences.
d)
To connect users with professional advisors.
49.

Which API is used in the Advice Generator App project?

a)

GitHub API

b)

Google API

c)

Advice Slip API

d)

Weather API

50.

Based on the Advice Generator App Project, what does fetch() do?

a)

Styles the page

b)

Selects HTML elements

c)

Saves data to a database

d)

Requests data from a server or API

51.

In the Advice Generator App, why is 'async' used in the 'fetchData' function?

a)

To make code shorter

b)

To store variables

c)

'async' is just for aesthetics

d)

To handle tasks that take time without freezing the page

52.

Based on the Advice Generator App, which keyword allows JavaScript to wait for a response?

a)

wait

b)

pause

c)

await

d)

stop

53.

In the Advice Generator App, which HTML element displays the advice number?

a)

<p id="advice-id">

b)

<div>

c)

<span>

d)

<h1>

54.

In the Advice Generator App, Which HTML element displays the main advice text?

a)

<p>

b)

<div>

c)

<h1 id="advice">

d)

<span>

55.

In the Advice Generator App, what happens when the dice image is clicked?

a)

The page refreshes

b)

The app closes

c)

A new advice is fetched from the API

d)

Nothing happens

56.

What does innerText do?

a)
innerText gets or sets the text content of an element.
b)
innerText returns the attributes of an element.
c)
innerText modifies the style of an element.
d)
innerText retrieves the HTML structure of an element.
57.

Based on the Advice Generator App, where is the API URL placed?

a)

Inside the image tag

b)

Inside the fetch() function

c)

In HTML

d)

In CSS

58.

Whats the full meaning of API?

(a)  

59.

What format does the API return its data in?

a)

HTML

b)

CSS

c)

JSON

d)

XML

60.

Based on the Advice Generator App, how is the dice button selected in JavaScript?

a)

getElementById

b)

querySelector(".dice-btn")

c)

getElementsByClassName

d)

selectDice()