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

1. Http was originally designed to be which means that web browsers stored no pe

ID: 655359 • Letter: 1

Question

1.   Http was originally designed to be    which means that web browsers stored no persistent data about a visit to a website.
Hidden
A.   Hidden
B.   Encryptes
C.      Stateless
D.   Stateful

2. What character is used to separate individual name-value pairs within a query string?
   A.   &
   B.   $
   C.   ?
   D.   %

3. To concatenate names and values into a query string you can use methods of the      class.
   A.   Array  
   B.   String
   C.   Number
   D.   Date

4. The (blank) method of a form automatically creates query string from its feild values.
   A.   reset
   B.   String
   C.   click
   D.   Date
5. Which type value for the input element creates a feild that is not displayed by web browsers?
   A.   hidden
   B.   invisbile
   C.   none
   D.   text
6. Which is the only required attribute of the cookies property?
   A.   path
   B.   domain
   C.   expires
   D.   name
7. you can use special characters in your cookies if you use (blank).
   A.   secure coding
   B.   encoding
   C.   a CDN
   D.   the secure attribute
8.Cookies created without a(n) attribute are available from the current browser session only.
   A.   path
   B.   domain
   C.   expires
   D.   name
9. Which functioin do you use as part of the process of parsing a cookie?
   A.   encodeURI()
   B.   decodeURI()
   C.   encodeURIComponent()
   D.   decodeURIComponent()
10. To delete cookies in your code you change the value of which cookie attribute?
   A.   path
   B.   domain
   C.   expires
   D.   name
11. Which property of the Web Storage APi do you use to store data that remains until you run code to delete it, similar to presistent cookies?
   A.   localStorage  
   B.   sessionStorage
   C.   persistentStorage
   D.   webStorage
12. Which method do you use to delete a specific item from Web Storage?
   A.   clear()  
   B.   getItem()
   C.   removeItem()
   D.   setItem()
13. Your first line of defense in securing your JavaScript programs is to (blank)?
   A.   require a login for every user  
   B.   validate all user input
   C.   encode all data
   D.restrict acess to a single subdomain
14. An attack in which program or user enters javascript code that changes the function of a web page is known as a(n) (blank) attack.
   A.   code injection  
   B.   secure coding
   C.   cross-site
   D.   SSL
15. Its important to (blank) characters in form feild values that could be part of malicious code which involves converting the characters to their character code equivalents.
   A.   encrypt  
   B.   decrypt
   C.   encode
   D.   escape
16. Why should a password never be Stored in a cookie?

17. What is the difference between a temporary and presistent cookies?

18. Explain how to modify an existing cookie.

19.Describe one advantage and one disadvantage of using Web Storage rather than cookies.

20. Explain what a code injection attack is, and one step you can take to prevent such attacks.

Explanation / Answer

1.Hidden
2. %
3. String
4. reset
5. invisible
6. name
7. encoding
8. expires
9. encodeURI()
10.name
11.sessionStorage
12.removeItem() with the data key
13.encoding all data
14.cross-site scripting
15.encrypt
16.It is not safe to store passwords in cookies because they are stored as plain text and can be easily available to everyone.
17.Temporary cookies are erased when the browser is closed whereas persistent cookies stay in one of the browser's sub folders until they are deleted explicitly.
18.Set-Cookie: name=Nicholas; domain=nczonline.net; path=/blog

This cookie has four identifying characteristics: the cookie name, the domain, the path, and the secure flag. In order to change the value of this cookie in the future, another Set-Cookie header must be sent using the same cookie name, domain, and path. For example:

Set-Cookie: name=Greg; domain=nczonline.net; path=/blog

This overwrites the original cookie