Test: Cookies


10 Questions MCQ Test Computer Networks | Test: Cookies


Description
Attempt Test: Cookies | 10 questions in 10 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Computer Networks for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
QUESTION: 1

Cookies were originally designed for

Solution:

Answer: b
Explanation: Cookies were originally designed for server side programming, and at the lowest level, they are implemented as an extension to the HTTP protocol.

QUESTION: 2

The Cookie manipulation is done using which property?

Solution:

Answer: a
Explanation: There are no methods involved: cookies are queried, set, and deleted by reading and Writing the cookie property of the Document object using specially formatted strings.

QUESTION: 3

Which of the following explains Cookies nature?

Solution:

Answer: d
Explanation: Cookies are transient by default; the values they store last for the duration of the web browser session but are lost when the user exits the browser.

QUESTION: 4

Which attribute is used to extend the lifetime of a cookie?

Solution:

Answer: c
Explanation: If you want a cookie to last beyond a single browsing session, you must tell the browser how long (in seconds) you would like it to retain the cookie by specifying a manage
attribute. If you specify a lifetime, the browser will store cookies in a file and delete them only once they expire.

QUESTION: 5

Which of the following defines the Cookie visibility?

Solution:

Answer: d
Explanation: Cookie visibility is scoped by document origin as local Storage and session Storage are, and also by document path.

QUESTION: 6

Which of the following can be used to configure the scope of the Cookie visibility?

Solution:

Answer: d
Explanation: The Cookie visibility scope is configurable through cookie attributes path and domain.

QUESTION: 7

How can you set a Cookie visibility scope to local Storage?

Solution:

Answer: a
Explanation: Setting the path of a cookie to “/” gives scoping like that of localStorage and also specifies that the browser must transmit the cookie name and value to the server whenever it requests any web page on the site.

QUESTION: 8

 Which of the following is a Boolean cookie attribute?

Solution:

Answer: b
Explanation: The final cookie attribute is a boolean attribute named secure that specifies how cookie values are transmitted over the network. By default, cookies are insecure, which means that they are transmitted over a normal, insecure HTTP connection. If a cookie is marked secure, however, it is transmitted only when the browser and server are connected via HTTPS or another secure protocol.

QUESTION: 9

Which of the following function is used as a consequence of not including semicolons,Commas or whitespace in the Cookie value?

Solution:

Answer: a
Explanation: Cookie values cannot include semicolons, commas, or whitespace. For this reason, you may want to use the core JavaScript global function encodeURIComponent() to encode the value before storing it in the cookie.

QUESTION: 10

What is the constraint on the data per cookie?

Solution:

Answer: c
Explanation: Each cookie can hold upto only 4 KB. In practice, browsers allow many more than 300 cookies total, but the 4 KB size limit may still be enforced by some.

Use Code STAYHOME200 and get INR 200 additional OFF
Use Coupon Code