WorksheetsPage 1
Total questions: 20
Worksheet time: 10mins
What is a function in JavaScript?
A data type
A loop
A block of code used to perform a specific task
A variable
Which keyword is used to declare a function?
var
let
function
define
What is a function expression?
A function without name
A function stored in a variable
A function inside an object
A function with parameters
What are parameters in a function?
Values passed while calling a function
Variables used in function definition
Output of a function
Keywords
What does the return statement do?
Stops the program
Prints output
Sends a value back from a function
Calls another function
Which symbol is used in arrow functions?
=>
==
<=
!=
How are arrays created in JavaScript?
Using {}
Using ()
Using []
Using <>
Array index always starts from:
1
-1
0
Any number
Which method adds an element at the end of an array?
pop()
shift()
push()
unshift()
Which method removes the first element of an array?
pop()
shift()
slice()
splice()
What does array.length return?
Index number
Size in bytes
Total number of elements
Last element
Which method converts a string to uppercase?
toLowerCase()
upper()
toUpperCase()
capitalize()
What does indexOf() return if the value is not found?
0
null
-1
undefined
Which method checks whether a string contains a word?
match()
includes()
search()
find()
How are objects created in JavaScript?
Using []
Using ()
Using {}
Using <>
What are object keys called?
Variables
Properties
Methods
Values
Which notation is used to access object values?
Dot notation only
Bracket notation only
Both dot and bracket notation
None
Which object is used to get current date and time?
Time
Clock
Date
Calendar
What does Math.random() return?
Random integer
Random number between 0 and 1
Random number between 1 and 10
Random whole number
Which DOM method selects an element by ID?
getElementsByClassName()
getElementsByTagName()
querySelector()
getElementById()
