• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 42 pages
Exam (elaborations)

Javascript Study Questions With All Correct Answers

Document preview thumbnail
Preview 4 out of 42 pages

JAVASCRIPT STUDY QUESTIONS WITH ALL CORRECT ANSWERS

Content preview

JAVASCRIPT STUDY QUESTIONS
WITH ALL CORRECT ANSWERS

What is the DOM? - Answer-Document Object Model

What is AJAX? - Answer-Asynchronous JavaScript And XML

Is JavaScript case sensitive? - Answer-Yes

How do statements end in JavaScript? - Answer-With a semicolon ";"

How do you create a single line comment in JavaScript? - Answer-With two forward
slashes "//"

How do you create a multi-line comment in JavaScript? - Answer-Start with a forward
slash and asterisk, and then end with an asterisk and forward slash. "/*" "*/"

What are the valid characters for an identifier in JavaScript? - Answer-Letters, Numbers,
Underscores, and Dollar Signs

How do you denote a string in JavaScript - Answer-With either single or double quotes
surrounding the data

What is the string escape sequence to start a new line in JavaScript? - Answer-\n


Calling an external javascript file syntax? - Answer-<script type="text/javascript"
src="javascript.js"> </script>

Is javascript case sensitive? - Answer-yes!

Javascript comment syntax? - Answer-/**/ for multiple lines
// for a single line

If a variable is not a function and does not have var then it is? - Answer-a global
variable

Can variables include other variables? - Answer-yes

x=x+y is the same as what? or x=x/y? - Answer-x+=y or x/=y

,numbers + strings =?
5+"5" = ? - Answer-strings
55

javascript starts counting on what? - Answer-0

numerical comparison operators? - Answer-x==y [x is equal to y]
x===y [x is exactly equal to y]
!= [not equal to]
> [greater than]
< [less than]
>= [greater than or equal to]
<= [less than or equal to]

logical operators? - Answer-&& [and]
|| [or]
! [not]
? ternary operator

conditional variable syntax? - Answer-z=(x==y)?5:6
z = 5 if x=y;
z = 6 if x!=y;

else if conditional syntax? - Answer-if(condition)
{
code
}
else if(condition)
{
code
}

switch statement syntax? - Answer-switch(variable)
{
case 1;
code
break;

case "example";
code
break

default;
code
}

,alert box syntax? - Answer-alert("message");

confirm box syntax? - Answer-r=confirm("press a button")
if(r==true)
{
alert('you pressed ok!');
}
else
{
alert('you pressed cancel');
}

prompt box syntax? - Answer-x="prompt("text here","default value");
if(x!="null" && x!="")
{
alert("hello "+x+" how are you today?")
}

syntax for line breaks in an alert box? - Answer-'/n' + " here"

function syntax and purpose? - Answer-function functionName(var1,var2,..,var99)
{
some code
}
functions allows scripts to be executed when called.

return statement syntax? - Answer-function product(a,b)
{
return a*b;
}
alert(product(4,3)) <-- will alert 12
return function gives a value back based on function variables.

javascript syntax for a (limited loop based on specifications) syntax? - Answer-
for(variable=startvalue;variable<=endvalue;variable=variable+increment)
{
code to be run until loop is complete.
}

The while loop (a loop executed when a specific condition is met) syntax? - Answer-
while(variable<=endvalue)
{
code to be executed
}

the break and continue statement? - Answer-if(i==3)

, {
break;
}
breaks loop

if(i==3)
{
continue;
}
breaks loop and restarts at next value;

for... in statement syntax? - Answer-var person={fname:"john",lname:"doe",age:"25"};
var x;
for (x in person)
{
document.write(person[x]+" ");
}
-------
loops through all variables attached to person;

HTML DOM mouse events? - Answer-onclick
ondblclick
mousedown
mousemove
mouseover
mouseout
mouseup

onsubmit should be used for what and where? - Answer-validating form fields
ex. <form action="blah.asp" method="post" onsubmit="return checkForm()">

special text insertions? - Answer-\' single quote
\" double quote
\n new line
\r carriage return
\t tab
\b backspace
\f form feed

properties of methods defined? - Answer-properties - are values associated with an
object i.e. length

methods - are actions (functions) that can be performed on objects ie toUpperCase [an
uppercase method]

Document information

Uploaded on
July 14, 2025
Number of pages
42
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$13.89

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Scholarsstudyguide
3.8
(169)
Sold
853
Followers
476
Items
16410
Last sold
1 week ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions