Which code snippet creates the "creditCard" cookie and adds it to the out going response to be stored on the user’s web browser?

Your company has a corporate policy that prohibits storing a customer’s credit card number in any
corporate database. However, users have complained that they do NOT want to re-enter their
credit card number for each transaction. Your management has decided to use client-side cookies
to record the user’s credit card number for 120 days. Furthermore, they also want to protect this
information during transit from the web browser to the web container; so the cookie must only be
transmitted over HTTPS.
Which code snippet creates the “creditCard” cookie and adds it to the out going response to be
stored on the user’s web browser?

Your company has a corporate policy that prohibits storing a customer’s credit card number in any
corporate database. However, users have complained that they do NOT want to re-enter their
credit card number for each transaction. Your management has decided to use client-side cookies
to record the user’s credit card number for 120 days. Furthermore, they also want to protect this
information during transit from the web browser to the web container; so the cookie must only be
transmitted over HTTPS.
Which code snippet creates the “creditCard” cookie and adds it to the out going response to be
stored on the user’s web browser?

A.
10. Cookie c = new Cookie(“creditCard”, usersCard);
11. c.setSecure(true);
12. c.setAge(10368000);
13. response.addCookie(c);

B.
10. Cookie c = new Cookie(“creditCard”, usersCard);
11. c.setHttps(true);
12. c.setMaxAge(10368000);
13. response.setCookie(c);

C.
10. Cookie c = new Cookie(“creditCard”, usersCard);
11. c.setSecure(true);
12. c.setMaxAge(10368000);
13. response.addCookie(c);

D.
10. Cookie c = new Cookie(“creditCard”, usersCard);
11. c.setHttps(true);
12. c.setAge(10368000);
13. response.addCookie(c);

E.
10. Cookie c = new Cookie(“creditCard”, usersCard);
11. c.setSecure(true);
12. c.setAge(10368000);
13. response.setCookie(c);

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *