Cookies interview questions and answers

                                                                                           cookies         
                                                                                        ------------
1) Where can we find implementation of Http?
    
    -it is implemented as one of service in webserver (like IIS)
    -it is in the form of WWWService

2) What is behavior of Http protocol?
 
   -it is implemented as connection less and stateless protocol
   -when ever  user makes a request  connection is established based on ip address of client, once response   has been sent automatically connection will be closed so it is called as connectionless
   -every request received will be treated as new request from new user only, so it is called as stateless  

3) What is the purpose of State management features in Web Technology?

    -Http protocol has been implemented as stateless protocol, so there is a need of some features in web technology to maintain state of user either at client or at server.

4) What are the state management techniques in Asp.net?
   
     -cookies
     -Session
     -Query String
     -View State
     -Caching
     -Application

5) What is Cookie?
    
     -cookie is small packet of information maintained by website at client system
     -Memory allocation for cookie will be done at client system
     -all cookies of website are transmitted between client and server along with request and response in the form of cookies collection

6)What types of Data can be stored in cookie?
        
     -only simple plain text can be maintained in cookie

7) How many cookies are allowed for website at client system?
   
    -according to w3c at the maximum 20 cookies allowed, but it totally dependent upon brower
    -most of browsers support 5 to 8 cookies only

8) How the cookies are transmitted between client and server?
    
    -in the form of cookies collection along with request and response

9) Where can we use cookies in website?
   
    -we can make use of cookies in any webpage in website

10) What the maximum amount of data that can be stored with the help of cookies?
    
    -Maximum size will be up to 4kb only
    -all cookies of a website will be maintained in separate cookie file and its max size will be 4kb

11) What is Dictionary?
    
    -if a cookie contains multiple values in the form of key, value then it is called as multi value cookie or dictionary

12) What are the Advantages of Dictionary?
      
    -it will take less memory as compared to multiple cookies with single value
      -we can overcome the limitation of number of cookies allowed for website, since we can maintain multiple values with
       Help of single cookie

13) How can we verify whether cookie is dictionary or not?
     
     -By using HasKeys property
     -if cookie is dictionary then HasKeys will be true, otherwise it will be false

14) Maximum number of permanent cookies allowed in client system?
     
     -At the maximum 300 cookies are allowed in client system

15) How to create a cookie in asp.net website?
      
       -By using HttpCookie class object
       -After creating cookie it will be attached to Response Object to send it to client
      Ex:
         HttpCookie c1=new HttpCookie ("Username","Rama");
         Response.Cookies.Add (c1);

16) What are the disadvantages of cookies?

       -Cookies are maintained at client system, so that they are not secure
       -Limited number of cookies are allowed for website (Max 20)
       -Limited amount of data can be maintained (Max 4kb)
        -Only plain text can be maintained

17) Where can u find usage of cookies in ur development?

     -To maintain authentication details we can make use of authentication cookie
     -To transmit session id between client and server

18) What the default authentication cookie name?

      .ASPXAUTH

19) What is cookie name used for transmitting sessionid between client and server?

     asp.net_sessionId

20) How to disable cookies in client browser?

      -We can make use of browser options, it depends on browser

21) Where the memory for temporary cookie is allocated?

      -As part of browser process memory, so it is also called as in memory cookie or in process cookie

22) what are the different types of cookies?

     -There are two types of cookies
        1) Temporary cookie
        2) Permanent cookie

Thanks for visiting this blog. How is the content?. Your comment is great gift to my work. Cheers.

3 comments:

  1. Good work. Would love to see some information on cache and storage along with cookies :)

    ReplyDelete