WorksheetsQuiz No. 1 - Functions in JavaScript
Total questions: 25
Worksheet time: 14mins
JavaScript had many names before it became JavaScript, which of the following is NOT part of those names?
LiveScript
Ecma Script
JScript
Java
Which of the following is an example of Declaration?
var studentID;
var studentID = 2015205;
var studentID = 2015205;
console.log("Student ID: " + studentID);
var studentID = 2015205;
alert("Student ID: " + studentID);
Which of the following is an example of Initialization?
var studentID;
var studentID = 2015205;
var studentID = 2015205;
console.log("Student ID: " + studentID);
var studentID = 2015205;
alert("Student ID: " + studentID);
Which of the following is an example of Passing?
(You may select more than one answer)
var studentID;
var studentID = 2015205;
var studentID = 2015205;
console.log("Student ID: " + studentID);
var studentID = 2015205;
alert("Student ID: " + studentID);
Variables can be as short as one character, or they can be as long as you want—think thousands and thousands of characters.
True
False
Variables can start with a letter, underscore, or the $ character. They can also start with a number.
True
False
Outside of the first character, our variables can be made up of any combination of letters, underscores, numbers, and $ characters. We can also mix and match lowercase and uppercase to our heart’s content.
True
False
Values store data, and variables act as an easy way to refer to that data.
True
False
What are Fixed Variables called?
Literals
Variables
Numbers are written with or without decimals
Number Literal
String Literal
Boolean Literal
Strings are text, written within double or single quotes
Number Literal
String Literal
Boolean Literal
Can be true or false
Number Literal
String Literal
Boolean Literal
In JavaScript, it means an empty value and is also a primitive type in JavaScript
Null
Undefined
In JavaScript, it means the variable has been declared, but its value has not been assigned
Null
Undefined
Which is NOT a valid way to declare a variable?
var
let
const
use
is a combination of values, variables, and operators, which computes to a value
expression
computation
combination
calculation
Which of the following is a valid way to comment in JavaScript?
(You may choose more than one answer)
//
/* */
#
"
A browser parses a file from top to bottom.
True
False
The script element can only be added in the body section
True
False
HTML contains CONTENT and JavaScript contains BEHAVIOR
True
False
How do we add the .js file into our .html file?
<script src = "index.js"> </script>
<body src = "index.js"> </body>
<head src = "index.js"> </head>
<html src = "index.js"> </html>
Given the following code:
const square = function (number) {
return number * number; };
const x = square(4);
Which is considered as the function call?
square(4)
return number * number
function (number { .... }
const x and const square
Given the following code:
const square = function (number) {
return number * number; };
const x = square(4);
Which is considered as the function declaration?
square(4)
return number * number
function (number { return number * number; }
const x and const square
Given the following code:
alert("my argument");
The argument is the stuff between your opening and closing parentheses when calling the alert function.
True
False
If a function happens to take arguments and you don't provide any arguments as part of your function call, provide too few arguments, or provide too many arguments, things can still work.
True
False
