Font size
Worksheetsjavascript
Total questions: 100
Worksheet time: 55mins
x++;
Which of these is a loop?
if(x<10)
while(x<10)
var x=10;
text(x,10;10)
Which of the following will decrease the value of x?
x--;
x-1;
x=x;
x=-x;
Greater than or equal to
> or =
> || =
>=
<=
His name is Fred and he is less than 16 years old
if (name = "fred" && age < 16 )
if (name === "fred" && age < 16 )
if (name = "fred" || age < 16 )
if (name === "fred" || age < 16 )
Repeat something 10 times
repeat 10
for (var i=0; i<10; i++)
repeat { } until 10;
while (i = 10)
When we are done with a line what do we put at the end?
a colon :
a semi-colon ;
a period .
a quotation mark "
When we surround a word with quotes "David" it's called ?
a program
a loop
a string
a command
Javascript is _________ language.
Programming
Scripting
Application
applet
JavaScript is ______ Side Scripting Language.
JSP
Servlet
Server
Browser
JavaScript is designed for following purpose -
To Style HTML Pages
To Perform Server Side Scripting Opertion
To add interactivity to HTML Pages.
To Execute Query Related to DB on Server
JavaScript Code is written inside file having extension __________.
.jsc
.jvs
.js
.javascript
Local Browser used for validations on the Web Pages uses __________.
HTML
CSS
js
java
var typeOfApples="Fuji";
JavaScript is an ________ language.
compiled
interpreted
What attribute/value do we use to make a button execute JavaScript when clicked?
onclick="doSomething;"
on-click="doSomething;"
onclick="doSomething();"
onclick=doSomething();
What is the correct syntax for referring to an external JavaScript script?
<script src="myscript.js"></script>
<script href="myscript.js"></script>
<js href="myscript.js"></js>
<js src="myscript.js"></js>
The simplest data-storing structure in any programming language
Lists
Array
Queue
List
These are any variable names listed within a function's argument definition.
example: myFunction(x, y)
Parameter
Literals
Constraints
Variables
This allows JS Scripts and applications to perform different actions based on given conditions.
Variables
Loops
Conditional Statement
Stacks
Which of the following is NOT a valid component of a function declaration?
Function keyword
Function name
Pair of Square Braces
Pair of Curly Braces
Method used to select the element with a given identifier represented by the HTML element property ID
getElementByClassName() method
getElementById() method
getId()
getElementByTagName()
Which of the following operator is used for the Assignment Operator?
==
!
=
+
What is the symbol pair used to write a new line within a string values?
\*
\'
\n
\br
What is the symbol used for the INCREMENT operator in JS?
+
++
=
==
Using object constructors what specific keyword is used to create new object?
if
var
new
this
Conditions return values of which data type?
Integer
boolean
floating-point
string
built in object in JS that allows a script to perform mathematical task
Arithmetic
Math Object
Operation Object
Mathematics Object
Which type of array declaration allows for greater simplicity?
Dynamic array
Array Literals
Standar Array Syntax
Specified array declaration
What is the name of the JavaScript standard?
JavaScript
ECMA Script
JS
PEP
What is first index value of an array?
2
-1
0
1
What will this code display?
8, 2, 1, 4, 7
82147
Myarray.length
5
What will this code display?
Hello Emma
Hello user
Hello+user
nothing
What would this piece of code do?
change the background color of the word demo to red
change the font color of the demo element to red
this is not correct
styles the element with the class demo
Which of these is a method?
getElementById( )
style
document
color
Which line is missing to return the result of the multiplication 10 x 5 ?
result
number 1 * number 2 ;
let result = 10 x 5 ;
var result = number 1 * number 2 ;
Which of these methods removes the last element of an array?
pop( )
splice( );
push( )
split( )
What would this piece of code display?
10
20
30
40
1
2
3
4
10
20
30
40
50
11
22
33
44
What would this piece of code display?
text
John, Joe, Greg, Ruth
John
Joe
Greg
Ruth
4
How would you declare a variable in JavaScript?
var myName = "Sally"
myName = "Sally"
myName var = "Sally"
var myName = Sally
What would alert(6 + '2') show?
8
62
6+'2'
6'2'
Look at the following code:
let attendees = 568;
attendees++
document.write(attendees)
What will print to the browser?
568
570
569
An error message
Look at the following code:
let total_price = 40;
total_price--
--total_price
document.write(total_price)
What will print to the browser?
39
40
38
42
These are used to put information that can be useful later, and in JavaScript these are ignored by the browser.
Comments
Case Sensitivity
Data Types
Statements
It can be Numeric, String, Boolean or Null.
Comments
Case Sensitivity
Data Types
Statements
Developed by William Oughtred, the device consists of two movable rulers placed side by side.
Pascal Calculator
Abacus
Slide Rule
Leibnitz Calculator
Determine what x would be when assignment operators are used given that ×=6 y=12 z=18
x−=3
x%=4
4 and 5
3 and 2
3 and 7
1 and 2
Perform the operation on operands of different data types given that a = 4 , b = happy , c= people, d = 9 , e = memories
Solve: b + c
happy people
people happy
happy memories
happy plus
Find the value of Z
var x = 5;
var y = x;
y++;
x--;
var z = x +y;
z++;
10
9
11
12
Find the value of X
var i;
var x=0;
for(i =0; i>=10; i++){
x++;
}
10
11
9
12
What is Javascript?
programming language
HTML tags
CSS
A web page
Where do the <script></script> tags go in your document
Within <img> tags
In the <p></p> tags
In the <title>
In the <head> or <body>
Choose the right Javascript event
inmouseout
anmouseout
enmouseout
onmouseout
Javascript can:
Interact with HTML
Check or validate user input
Can make your web pages dynamic
All of the above
Choose the correct Javascript mouse event
inmouseover
andmouseover
enmouseover
onmouseover
JavaScript is used to enhance what kind of document?
JS
HTML
Brackets
How to get access to number 8 in the following array?
const arr = [[1, 2, 3], [[5, 6, 7, 8], 9]]
arr[[[1,0,3]]]
arr[1][0][3]
arr[1,0,3]
arr[1[0[3]]
What would be the result of this?
const a = 20;
a = 10;
console.log(a)
10
20
it would throw an error
undefined
What would the following comparison produce?
2 == "2"
true
false
undefined
error
How to convert number n to string?
n+''
n.toString()
toString(n)
String(n)
What would be the result of the following?
var arr = [1,2,3];
console.log(arr[0]);
1
2
3
undefined
What is formatting in HTML?
The HTML contains six types of headings which are defined with the <h1> to <h6> tags.
a process of format the text for a better look and feel
There are some HTML tags that don't need a closing tag.
Content is placed between tags to display data on the web page.
Identify the incorrect difference between HTML and DHTML?
HTML is a mark-up language, while DHTML is a collection of technology
HTML sites will be fast upon client-side technologies, while DHTML sites will be slow enough upon client-side technologies.
DHTML creates dynamic web pages, whereas HTML creates static web pages.
HTML cannot have any server side code but DHTML may contain server side code.
DHML is basically using JavaScript and style sheets in an HTML page.
What is the length of this array?
Which definition below best describe an array?
An array is a function identifier that can hold more than one parameter.
An array is a beam of light.
An array is a special variable, which can hold more than one value at a time.
An array is a special function, which can hold more than one value at a time.
Which of the variables below is an array?
var names="array"
var names = array;
var names = [];
var names[];
What will be the output to the console for the following code:
var colors =["Red", "Green", "Yellow", "Orange", "Blue"];
colors.splice(0,3, "Purple");
console.log(colors);
["Purple", "Green", "Yellow"]
["Purple", "Green", "Yellow", "Orange", "Blue"]
["Red", "Green", "Yellow", "Orange", "Blue"]
["Purple", "Orange", "Blue"]
What is the highest position in this array?
HINT: Remember arrays start at position 0!
arr = [1,2,3,4,5];
What would the array look like after we execute this?:
array.splice(0, 1);
The length() method for an array will return _____.
the number of elements in the array
the last index value of the array.
the length of the name of the array variable
the capacity of the array
JavaScript was originally developed under the name _______.
ActionScript
Mocha
Sencha
Oak
JavaScript is designed for following purpose –
To Style HTML Pages
To Perform Server Side Scripting Operation
To add interactivity to HTML Pages
To Execute Query Related to DB on Server
var numApples = 2;
var age = "5"
