Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScript C15 Question 10 (1 point) Which of the following is allowed in a cook

ID: 3919905 • Letter: J

Question

JavaScript C15

Question 10 (1 point)

Which of the following is allowed in a cookie’s value?

Question 10 options:

space

number

comma

semicolon

Save

Question 11 (1 point)

Code example 15-1

var cookie = "username=mike2009";
cookie += "; max-age=" + 365 * 24 * 60 * 60;
cookie += "; path=/";
document.cookie = cookie;

(Refer to code example 15-1.) This code

Question 11 options:

creates a cookie that’s removed when the user closes the browser

creates a cookie that’s stored for 1 year

creates a cookie that’s stored for 365 minutes

does not create a cookie

Save

Question 12 (1 point)

Code example 15-1

var cookie = "username=mike2009";
cookie += "; max-age=" + 365 * 24 * 60 * 60;
cookie += "; path=/";
document.cookie = cookie;

(Refer to code example 15-1.) This code

Question 12 options:

creates a cookie with a name of “username” and a value of “mike2009”

creates a cookie with a name of “max-age” and a value of “31536000”.

creates a cookie with a name of “path” and a value of “/”.

does not create a cookie

Save

Question 13 (1 point)

Web storage stores data in the browser in

Question 13 options:

arrays

strings

key/value pairs

session

Save

Question 14 (1 point)

Which of the following statements is not true of web storage?

Question 14 options:

You can store up to 5MB of data.

It’s supported by every modern browser.

You can store data indefinitely or for the browser session.

The data in web storage is passed to the server with every HTTP request.

Save

Question 15 (1 point)

The main difference between local storage and session storage is

Question 15 options:

local storage is stored indefinitely; session storage is lost when the browser closes

session storage is stored indefinitely; local storage is lost when the browser closes

session storage has a shortcut syntax and local storage doesn’t

local storage has a clear() method and session storage doesn’t

Save

Question 16 (1 point)

Which of the following statements gets the same result as this statement?
localStorage.name = "Grace";

Question 16 options:

localStorage.setItem("name", "Grace");

localStorage.getItem("name");

localStorage.removeItem("name");

localStorage.clear();

Save

Question 17 (1 point)

Which of the following statements stores an item in the browser indefinitely?

Question 17 options:

sessionStorage.setItem("name", "Grace");

sessionStorage.getItem("name");

localStorage.setItem("name", "Grace");

localStorage.getItem("name");

Save

space

number

comma

semicolon

Explanation / Answer

Question 10: Number

semicolon(;), space, comma(,) are not accepted in cookie value.

Question 11: creates a cookie that’s stored for 1 year

max-age = 365*24*60*60 sets the time in seconds which is one year for when a cookie will be deleted.

Question 12: creates a cookie with a name of “username” and a value of “mike2009”

max-age is expiry date and path specifies for which web page it needs to set

Question 13: key/value pairs

Data will be stored in key-value pairs

Question 14: The data in web storage is passed to the server with every HTTP request.

Unlike cookies, in web storage data stored is not included in every HTTP request.

Question 15: local storage is stored indefinitely; session storage is lost when the browser closes

Question 16: localStorage.setItem("name", "Grace");

Question 17: localStorage.setItem("name", "Grace");

localStorage stores data indefinitely in browser. setItem() function set a value for a key.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote