wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Grade 12A Final exam Semester 1

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

In what order do these functions run?

a)

hello(); world(); main();

b)

world(); hello(); main();

c)

main(); hello(); world();

d)

main(); world(); hello();

2.

Which of the following choices is a properly formed JavaScript variable name?

a)

user_age

b)

UserAge

c)

userAge

d)

User age

3.

What is printed if the user enters 5?

a)

5

b)

25

c)

30

d)

50

4.

Which statement reads a number from the user?

a)

let applesToBuy = readLine("How many apples would you like? ");

b)

let applesToBuy = console.log("How many apples would you like? ");

c)

let applesToBuy = readInt("How many apples would you like? ");

d)

let applesToBuy = nextInt("How many apples would you like? ");

5.

A store has 20 apples. How can you store this in a variable?

a)

let numApples == 20;

b)

20 = numApples;

c)

let numApples = 20;

d)

let num apples = 20;

6.

What is the correct keyword to create a constant?

a)

constant

b)

const

c)

let

d)

def

7.

User inputs Florence then Fernandez: What is printed?

a)

Fernandez Florence

b)

Florence Fernandez

c)

FlorenceFernandez

d)

Florence Fernandez

8.

Correct way to name a function that tells the day of the week:

a)

function dayofweek() {}

b)

function day_of_week() {}

c)

function DayOfWeek() {}

d)

function dayOfWeek() {}

9.

What is the result of the binary addition: 1101₂ + 0011₂?

a)

1110

b)

10000

c)

10100

d)

11000

10.

What is the decimal value of the binary number 10110₂?

a)

18

b)

22

c)

26

d)

30

11.

What is the decimal value of the binary number 100011₂?

a)

33

b)

34

c)

35

d)

39

12.

Which of the following is the correct binary representation of the decimal number 37?

a)

100001

b)

100101

c)

101101

d)

1001011

13.

Convert the decimal number 14 to binary.

a)

1100

b)

1110

c)

1010

d)

1001

14.

What does the following code print if the user enters 7?

a)

10

b)

"7 + 3"

c)

73

d)

"10"

15.

What is the value of total?

a)

12

b)

8

c)

16

d)

4

16.

What does this print? (User enters "Sara")

a)

Hello + name!

b)

Hello "Sara"!

c)

Hello Sara!

d)

HelloSara!

17.

Which option correctly declares two variables on separate lines?

a)

let a = 5, b = 10;

b)

let a = 5;
let b = 10;

c)

let a == 5; let b == 10;

18.

What is stored in the variable answer after this code?

a)

A number

b)

A boolean

c)

A string

d)

Nothing

19.

Which line reads a number from the user?

a)

readLine("Enter a number: ");

b)

readInt("Enter a number: ");

c)

input("Enter a number: ");

d)

getNumber("Enter a number: ");

20.

Which of the following correctly declares a variable in JavaScript?

a)

var age = 10;

b)

const age = 10;

c)

let age = 10;

d)

integer age = 10;