NEW
Font size
WorksheetsCoding Final Answer Sheet
Total questions: 54
Worksheet time: 54mins
What is a possible result of this code when it is run in a browser?
I looked outside and the weather report is true
I looked outside and the weather report is wrong
I looked outside and the weather report is canceled
I looked outside and the weather report is OK
What does the operator === mean?
The operands on either side are equal in value but not necessarily in data type
The operands on either side are equal in both value and data type
The operands on either side are equal in either value and data type
The value of the right operand is assigned to the left operand
What will the window alert box display when the script is run in the browser?
An error will occur because you cannot perform a Boolean operation on a string
It's before today
It's after today
It's before today/ It's after today
What is the result of clicking the button?
The form will disable itself
The button will become unresponsive
The text field will become unresponsive
Nothing will change
What will happen when the Confirm Box button is clicked?
Regardless of a user action, the alert box that says "The box is checked" will display due to a coding error
Regardless of a user action, the alert box that says "The box is not checked at the moment" will display due to a coding error
Depending on a user action, one of the two alert boxes will display
An error will return because the wrong form is identified in the if statement
In an AJAX transaction, which readyState value indicates that the HTTP response headers have been
received from the server, but the message body has not yet been completely received from the client?
value 2
value 1
value 0
value 3
Which of the following practices will you use for preventing cross-site scripting (XSS) attacks?
Avoiding the use of deprecated or unknown code
Writing code consistently and with liberal comments
Testing scripts thoroughly on various browsers
Using output encoding and input validation practices
What output will be displayed in the alert box when the script is run in the browser?
Sabrina, Kelly, Jill, Kris
Kris, Sabrina, Kelly, Jill
Kris, Kelly, Jill
Sabrina, Kris, Jill
Which code is the JavaScript equivalent of clicking a browser’s Back button?
history -= 1
history.rewind();
history.go(back);
history.go(-1);
How would you find the position of the last letter “a” in the given code?
.nurseryRhyme.lastIndexOf(“a”);
charAt(nurseryRhyme, "a");
nurseryRhyme.indexOf(“a”);
indexOf(nurseryRhyme, “a”);
What is the value of myVar after execution?
23
2
3
5
In one JavaScript-related security vulnerability, an attacker embeds malicious script into a link that
appears to be from a trusted site. Upon clicking the link, the embedded script is submitted in the
client’s HTTP request and can execute on the user’s computer, enabling the attacker to steal
information. What is the term for this security issue?
Signed script
Frame-to-frame URL changing
Client-side browser detection
Cross-site scripting
Choose the correct answer belowWhat will the alert box display when this script is run in the browser?
Sabrina, Kelly, JillKris
SabrinaKrisKellyKrisJill
KrisKellyJill
Kris, Sabrina, Kelly, Jill
You created a Webpage containing a form for users to join your company’s mailing list. You need to
validate user input with the minimum amount of bandwidth. Which technology should you use in the
given scenario?
PHP
Perl
Server-side JavaScript
Client-side JavaScript
What makes a scripting language different from a programming language?
Scripting languages are based on Windows, while programming languages are based on UNIX.
Scripting languages are based on UNIX, while programming languages are based on Windows.
Scripting languages are interpreted while programming languages are compiled.
Scripting languages are Web-based, while programming languages are not.
What is the term for a JavaScript function used to create a custom object?
Initializer
New
Loader
Constructor
Which of the following will select the third option in the list?
Which method will bring a window object to the top?
window.blur()
window.moveTo()
C window.moveBy()
window.focus()
Which JavaScript event handler is triggered when a user clicks her mouse button outside of a
particular field after typing input there?
onmouseout
onblur
onclick
Onfocus
What is the output when the script is run in the browser?
0+1+2+3+4+5+6+7+8+9+10+= 55
0+1+2+3+4+5+6+7+8+9+= 45
0+1+2+3+4+5+6+7+8+9+10 = 012345678910
0+1+2+3+4+5+6+7+8+9 = 0123456789
Which event handler of the select object specifies the JavaScript code to execute when the select
object loses focus after a user makes a selection, but only if the user selects an option other than the
default?
onclick
onblur
onchange
onfocus
What is the expected result when this script is run in the browser?
The background of the text box will change to blue.
The background of the button will change to blue.
The background of the page will change to blue.
The background of the form will change to blue.
What will be the result of this script when run in a browser?
Hello World
An error, because the variables are not properly declared
An error, because concatenation requires the & operator
Hello
Which statement about the protype property is true?
It is only available in DOM objects.
It is only available in custom objects.
It is only available in JavaScript predefined objects.
It is available in every JavaScript object
Which code snippet can be used to display the current date?
What is the purpose of the break statement in JavaScript?
To destroy unused variables
To terminate the current iteration and jump over the next iteration of the loop
To flush system memory
To exit a control structure
Which of the following is a tool that is used to help find errors in JavaScript code?
Compiler
Script library
Interpreter
Debugger
Which example demonstrates the correct syntax for declaring a variable?
var @lastName;
var 2lasstName;
var .last_name;
var _LAST_name
What does Y represent in this statement?
The condition under which the loop will execute
The loop counter increment or decrement
The highest value that the counter variable may reach
The loop counter variable initialization expression
Which of the following is a typical AJAX request?
Returning server variables from a server to a client
Converting XML data to CSS data
Informing the server of client configurations
Uploading variables from a client database to a server
Assume that you input the numbers 8 and 9 when the script is run in the browser. What is the possible
result of this script?
The sum of two numbers is undefined.
The sum of the two numbers is 8
The sum of the two numbers is 17.
The sum of the two numbers is 89
Which type of error are you most likely to debug using watchpoints?
Run-time
Syntax
Logic
Load-time
Which browser security consideration should a JavaScript developer remember when developing a
script?
JavaScript functionality is immune to viruses, trojans, and malware.
JavaScript can be disabled by a user and therefore cannot be relied upon to run.
JavaScript is a cross-platform scripting language and will generate consistent results regardless
of the client or server being used.
Certain JavaScript functionality is built into browsers and has been tested by the browser
developers so it cannot be disabled by a user because it is deemed safe.
Cross-site scripting (XSS) is a type of:
Same origin policy violation.
Security risk associated with signed scripts.
Phishing scam.
Code-injection attack
In an AJAX transaction, which readyState value indicates that the XMLHttpRequest has been sent but
no response has been received yet?
value 1
value 2
value 3
value 4
Which of the following will you add to the regular expression that allows the matching of the letters
in postal codes?
\s
\W
\w
\s
Which JavaScript object reflects information about the browser being used to view the Webpage?
Window
Navigator
Location
D. document
Which of the following will correctly retrieve the corresponding value of an HTML element’s
attribute within the DOM?
getAttribute(AttributeName)
setAttribute(AttributeName
setAttribute(AttributeName, NewValue)
getAttribute(AttributeName, NewValue)
What will be the output of the given code block?
My pet is a Frog
My pet is a Rabbit
I do not have a pet
I have a Rabbit and a Frog
What was Server-Side JavaScript (SSJS) originally called?
Perl
AJAX
JScript
LiveWire
Which of the following is a disadvantage of using the JavaSvript library?
Each library is browser-specific, thus the code provided will be browser-specific.
Using a JavaScript library does not guarantee high-quality, , secure code.
Libraries are not available to the public; you must either work for a company that provides one
or purchase a membership
Developing Progressive Web Applications with enhanced UI using JavaScript libraries will be a
complex task.
Which of the following is a disadvantage of using the JavaScript library?
Each library is browser-specific, thus the code provided will be browser-specific.
Using a JavaScript library does not guarantee high-quality, secure code.
Libraries are not available to the public; you must either work for a company that provides one
or purchase a membership.
Developing Progressive Web Applications with enhanced UI using JavaScript libraries will be a
complex task.
Which of the following is true about the do-while statement?
It executes only if the condition is true.
It always executes at least once regardless of the conditi
It can take an optional condition as an argument.
It tests a condition prior to running a block of code.
What is the expected result when this script is run in the browser?
The window alert box will not appear because there is an error in the code
The window alert box will display Good, then the user clicks the OK button it will display Bad.
The window alert box will display Bad.
The window alert box will display Good
Which data type is a variable that has no value assigned to it yet?
undefined
null
string
boolean
What is the value of myVar after the execution of this script?
35
2
3
5
Which JavaScript “flavor” attempts to diminish the differences between other JavaScript flavors and
standardize the language?
VBScript
JavaScript
ECMAScript
JScript
You work for a mid-size company with a large Website that has a very wide customer base. Which is
the best method for testing your JavaScript code for this site?
Determine the most frequently used browsers for your target audience, and test in those
browsers.
Test in various versions of the most popular browser.
Test in various browsers, versions and operating systems.
Test in various browsers, including various versions of the same browser.
What will the alert box display when this script is run in a browser?
Thursday
ThursdayWednesday
Wednesday
WednesdayThursday
What are cookies?
Small pieces of information sent to a client computer
Malicious JavaScript code
Compiled Java code with which JavaScript can interac
Small JavaScript applications
Which of the following methods could be used to change the value of the first radio button?
document.myForm.rdoGroup1[0].value = “Green”
document.getElementByld(rdoGroup1).value = “Green”
document.getElementByld(“rdoGroup1”).value = “Green”
document.rdoGroup1.value = “Green”
Which of the following is not a valid variable name in JavaScript?
_this
that
this
_that
Your site has a Webpage that uses AJAX to refresh a portion of the content based on the user’s
action. A user has made a selection on this page and is waiting for a response. While waiting, she
changes her mind and makes a different selection before receiving a response to her first selection. She
is confused when the eventual response does not seem to match her second action. This example
shows what type of disadvantage of using AJAX on a Webpage?
Server response issue
Script blocking issue
Usability issue
Security issue
What will the alert box display when this script is run in the browser?
SabrinaKellyJill
Sabrina, Kelly,
Sabrina
Jill
