Font size
WorksheetsJavaScript
Total questions: 80
Worksheet time: 44mins
What programming language did we learn in class this week?
Karel
Java
JavaScript
Visual Basic
Which of these is a loop?
if(x<10)
while(x<10)
var x=10;
text(x,10;10)
Which command provides a random color?
Randomizer.color
Randomizer.nextColor()
RandColor;
nextColor.Randomizer()
Which of these will increase the value of the variable X?
increment (x)
x++;
x=x;
x+1;
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
What is a variable
Store values in containers so we can use them later.
Store values in containers so we can use them never.
Store values in containers so we can use them once.
Store values in containers so we can't use them later.
A short form writing the word variable is
rav
VAR
var
varia
The "stroke" command means
color inside shape
color outside shape
color of blocks
border
What does the "fill" command do
put letters in the shape
put pictures in the shape
put color in the shape
put code in the shape
draw = function(){
......
}
This saves a value, which can be then assigned when writing code
Parameter
Function
Variable
Which tag indicates the presence of javascript
<css>
<script type="text/javascript">
<?php>
<style>
javascript can be written within
<head> tag only
<body> tag only
it can be written within both <head> and <body> tag
none of the above
When the javascript code is written inside html it will be saved as
.html
.css
.js
none of the above
in javascript what command is equivalent to print statement of c program
alert
write
echo
does javascript have functions
yes
no
<html>
<head>
<script>
function add(){
var a=10;
var b=20;
document.write("sum is "+c);
</script></head>
<body>
<button onclick="add()">add 2 numbers</button>
</body>
</html>
30
40
error
none of the above
WHAT IS THE OUTPUT
<html>
<head>
<script>
function add(){
document.getElementById("one").innerhtml="AFTER CHANGE";
</script></head>
<body>
<p id="one">BEFORE CHANGE</p>
<button onclick="add()">change</button>
</body>
</html>
PARAGRAPH CONTENT CHANGED TO AFTER CHANGE
PARAGRAPH CONTENT REMAINS SAME
ERROR
ONLY BUTTON WILL APPEAR
Javascript is
client side scripting language
server side scripting language
both client and server side scripting language
none of the above
Which of the following is correct
document.getElementByID(" ")
document.getElementByName(" ")
document.getElementByClass(" ")
all of the above
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 is can be written -
directly into JS file and included into HTML
directly into HTML pages
directly on the Server Script
None of these
JavaScript is an ________ language.
compiled
interpreted
Why JavaScript is called as Lightweight Programming Language ?
because JS can provide programming functionality inside but up to certain extend.
because JS is client side scripting
because JS is available free of cost.
because we can add programming functionality inside JS
Local Browser used for validations on the Web Pages uses __________.
HTML
CSS
js
java
JavaScript Code can be called by using _________.
RMI
Function / Method
Triggering Event
Preprocessor
Is this correct syntax to include JS Code inside HTML Page ?
<script type="text/javascript">
...
</script>
Yes
No
We cannot Place JS Code in the body tag . Say true/false.
True
False.
What is the value of “a” in the following statement?
var a;
undefined
null
0
NaN
What is the value of:
”41” + 1
42
“42”
411
“411”
What is the value of:
”31” - 1
“30”
30
“311”
NaN
JavaScript is a simpler form of Java.
True
False
What is the extension for a JavaScript file?
.java
.jar
.js
.sj
JavaScript functions can access variables defined in the same scope?
True
False
Variables defined inside of functions are accessible outside of the function?
True
False
The syntax for JavaScript objects is similar to the syntax for Python dictionaries?
True
False
In JavaScript strings must be defined using only double quotes (“).
True
False
What is the name of the JavaScript standard?
JavaScript
ECMA Script
JS
PEP
It can be an assignment operation, a function call, or a control structure
Comments
Case Sensitivity
Data Types
Statements
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
Names that refer to commands, functions, variables and keyword should be written correctly, variable “A” and “a” are two different variables.
Comments
Case Sensitivity
Data Types
Statements
A type of network that is limited to a school or a similar location.
LAN
MAN
WAN
CAN
Developed by William Oughtred, the device consists of two movable rulers placed side by side.
Pascal Calculator
Abacus
Slide Rule
Leibnitz Calculator
Inside which HTML element do we put the JavaScript?
<js>
<script>
<scripting>
<javascript>
The external JavaScript file must contain the <script> tag
true
false
What other languages are typically used with JavaScript?
Python
Ruby
HTML & CSS
SQL
What are the different ways to include JavaScript in your application? Choose all that apply.
<script> alert('Hello'); </script>
<link src='myjavascript.js'></link>
<link href="myjavascript.js></link>
<script src="myjavascript.js"></script>
How would you declare a variable in JavaScript?
var myName = "Sally"
myName = "Sally"
myName var = "Sally"
var myName = Sally
What is the difference between var and let in JavaScript?
There are no differences, they are both the same.
let is visible through blocks and accessed globally, var isn't.
var is visible through blocks and accessed globally, let isn't.
let is used more frequently, var isn't.
What would alert(6 + '2') show?
8
62
6+'2'
6'2'
What would alert('6'-2) show:
An error Message
62
'6'-2
4
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
Read the code below:
alert(true || false);
What would the output be?
True
False
Read the code below:
alert(!false);
What would the output be?
True
False
