Practice A Test JavaScript Ciw questions
and answers
You want to include in your form a button labeled Edit, which changes to Save when in edit mode and
changes back to Edit when the form contents are saved. You are calling a function from the onclick event
handler to perform this task. Which of the following is the correct code for that function? - correct
answer ✔✔if(myButton.value =="Edit") {
myButton.value = "Save";
}
else{
myButton.value = "Edit";
}
Which of the following is a valid variable name in JavaScript? - correct answer ✔✔sink
Which of the following correctly defines an object with a property called height, a property called width,
and a method called getArea? - correct answer ✔✔function objRectangle(height, width) {
this.height = height;
this.width = width;
this.getArea = getArea;
}
Consider the following expression:
x = 25;
y = 10;
Which statement would evaluate to true? - correct answer ✔✔x > = y;
, You work for a mid-size company with a large Web site that has a very wide customer base. Which is the
best method for testing your JavaScript code for this site? - correct answer ✔✔Test in various browsers,
versions and operating systems.
Consider the following code:
<script type="text/javascript">
var v1 = "Blue";
function f ()
{
this.v1 = "Green";
alert (this.v1);
}
f();
alert (v1);
</script>
What is the expected result when this script is run in the browser? - correct answer ✔✔Two alert boxes,
both displaying Green
What is a pop-up blocker? - correct answer ✔✔A browser-level security feature
Consider the following statement:
Cookies can be used to store passwords so authentication is not necessary for returning users.
Which of the following choices about this statement is accurate? - correct answer ✔✔The statement is
true, but this practice poses a security risk.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller BravelRadon. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $14.99. You're not tied to anything after your purchase.