scwcd dumps explainationdragndrop

Upload: ritesh-jha

Post on 04-Jun-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    1/20

    SCWCD 310-083 dumps QUESTIONS WITH EXPLAINATIONS(frm HFSJ 5.0) [Scwcd_orkut Folder]

    By-Shubham Roy

    Mail me :- [email protected]

    Try Visiting-www.sec2ndchance.wordpress.com

    Some Answers or explainations might be incorrect.So do verify them and dont rely on my

    explainations fully as I am a newbie too and not an expert.

    Note:- The Page numbers are from Head First Servlet and Jsp (2ndEdition).

    Symbols:-

    *-I dont know the answer and couldnt find any reference.

    Self-Its obvious,or doesnt need any explaination.

    1) The question says JSP Document hence option hence option D is correct as it is a JSP

    Document Syntax. Option A is a JSP page syntax .Option B&C has are syntactically wrong . [Pg

    629,pg 287,314,pg 315.]

    2) Line 12 is a Standard Action. (Pg323,348.)

    Line 13 is an Expression Language. (Pg 368)

    Line 10,11,15,16 are template text.

    3) Option D is correct but this was used in old JSP (before JSP 2.0) but not in new JSP 2.0. (Pg

    485).

    4) Pg 298

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    2/20

    5)

    The JSP page is converted to Servlet and then it follows the l ife cycle of a Servlet. (Pg 283,97)

    1. JSP Page is translated.

    2. JSP page is compiled.

    3. JSP Page implementation class is loaded.

    4. Jsp page Implementation is instantiated.

    5. jspInit is called

    6. _jspService is called

    7. jspDestroy is called

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    3/20

    6)

    Ans->

    The include Directive happens at translation time but the

    happens at runtime.As the question says translation time hence the above answer is applicable. (Pg

    403,404,405,406)

    7)By specifying the attribute isThreadSafe to false you want the generated servlet(jsp gets

    translated into servlets) to use the SingleThread Model.(Pg-315)

    8)Classic tag handler.Pg(531)

    The answer is A bcoz, the doStartTag() method is returning SKIP_BODY which means the body of the

    tag shud not be evaluated.Hence the doAfterBody() method wont get executed .

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    4/20

    9)*

    10)As its been set in the request scope hence we need to get it through the request objects

    getattribute() method and type cast it to String.

    11)*

    12)*

    13)servlet context object is available to all servlets in one web appllication.servlet config is available

    to only one servlet.Session is available to all the servlets.Only httpservletrequest exists between

    two servlets i.e-the servlet which forwards the request and the servlet which receives the

    request,hence this is the answer.

    14)pg-182, There is nothing called ContextListener.its ServletContextListener and the methods used

    are contextInitialized() and contextDestroyed().

    15)answers are sel f e xplainatory.All about servletcontext listener are given in pg-166.

    16)Pg 703(chapter fi lters and wrappers)

    17)pg 719

    18)pg-206,207.You cannot forward a request if you have already committed a response.l ine 19 causes

    the response to be sent to the client.Hence a request cannot be forwarded as it is finished or is

    history,bcoz u hav responded.

    19)for a particular user you need to use a session object.

    20)the session object is destroyed and hence it cannot be used to retrieve a value stored in it.

    21)answer is self explainatory.

    22)self

    23)self,pg-182

    24)self

    25)*

    26)*

    27) news:lookuptag should be nested and a news headline which is printed by news:itemshould be

    in a new row hence C is the right answer.

    28)sel f,pg 465

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    5/20

    29)self,pg455

    30),it lets you i terate over tokens where you give it the delimiter.

    31)self

    32)*

    33)self

    33)self

    34)557,559,561

    35)pg664,675

    36)pg 665,666

    37)679

    38)*

    39)pg 675

    40)self,pg665

    41)618,619

    42)

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    6/20

    mpg

    video/mpg

    Pg-633

    43)630,631

    44)*

    45)pg-614

    46)pg-614,Nothing under web-inf or meta-inf is directly accesible.

    47)pg-612

    48)pg-622,623

    49)for EL expressions The only way to acess the request object is by going thru the pagecontext

    implicit object.requesturi is a propert y of request object hence to access it we need the request

    object.pg-385,388,

    50)pg-396,398,399.request scope is used to get request attributes and not request property.For

    eg-request.setattribute(foo,4).In this foo is a request attribute. Simi larly if we write request.

    requestURI ,here requestURI is a request property that is,requestURI is a variable which might storesome value and is a part of the request object.

    Lt=less than,ne=not equal to,

    51)Pg-390

    52)using el we generally write a function like ${namespace:function name(parameter)}Pg-393.Hence

    here it will be ${foo.function(2)}, 2 is any number , as here the parameter that can be passed is long

    so 2 can be valid parameter.Hence option c is correct.

    Now as the function returns a map,hence the returned value would be an object as a map stores

    objects. And in order to access some property if that object we would write object.property henc

    option f is applicable as ${foo.function(3)} will return an object stored at 3rdplace in the map and

    ${foo.function(3).name} will give access to the name property of that object.

    53)*

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    7/20

    54)pg 753

    55)see fil ters and wrappers chapter.Pg 705.

    56)pg-754

    57)pg 759

    58) see fi lters and wrappers chapter.Pg 705.

    59)pg754

    60)

    Getservletpath /control

    getpathInfo /processorder

    getContext /myapp

    61) by default GET method is called

    62)self

    63)pg-251

    64)pg-123

    65)pg-132

    66)pg-323

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    8/20

    67)

    The scenario is like this: List list=(List)getServletContext.getInitParameter(catalog);

    Pg 348,356

    Application is the implicit object for servletcontext in jsp.

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    9/20

    See page 298 for all jsp implicit objects.

    68)same as the previous one.Pg 348,356

    69)*

    70)pg 251.

    Cookie cookie=new Cookie(username,joe);

    Response.addCookie(cookie);

    Or

    Response.addCookie(new Cookie(username,joe));

    71)by default GET is used.

    72)for setIntHeader see page 133

    setContentLength-*

    73)pg 253

    74)pg-122

    75)Servlets dont have constructors.It will give error.

    76)pg-626

    77)pg-608

    78)*

    79)pg-64

    80)pg-632

    81)self

    82)*

    83)

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    10/20

    |___JSP files Static content

    |

    |___WEB-INF

    |

    |___classes

    | |____ java and servlet classes

    |

    |____ lib

    | |____ JAR files

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    11/20

    |

    |____ web.xml

    Pg-608

    84)pg-675,pg-403(see the di ff betwn @include and jsp include)

    85)pg-294

    86)*

    87)application is the implicit object for ServletContext.

    88)Scripting is invalid but scripting code is their hence jsp doesnt execute.

    89)*

    90)pg-287

    91)Pg-473

    92)pg-485

    93)refer Q-27 for explaination

    94)*

    95)*

    96) pg-456

    It adds to a hash map named resultMapwith keyas the value stored in results[0].name and valuein

    results[0].valueand results[0]stores an object.

    97)pg-475

    98)we use uri when we have a tld file.Hence we can make a tld of a tag file and add to the web

    application.Tld files generally help the container and a JSP developer how to use the tag.

    Pg-483

    99)self

    100)pg-257(Session migration)

    101)pg-182

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    12/20

    102)pg-182

    103)pg-239

    104)pg-244,245

    105)pg-234

    106)pg-665

    107)682,684

    108)certificates are insatalled in HTTPs connections.And certificates are installed in client

    computer.Certificates contains the key which the browser uses to encrypt or decrypt information

    during transmission or reception regularly.

    109)pg-669

    110)same question is above

    111)authentication is in pg 677

    112)pg-371,372,373,379

    113){not map.c} is always true. map.d has null value hence a null with or true is true.similarly true

    and null is true.

    114) pg-386

    115)pg-390

    116)pg-393

    117)see 569.The example is for classic tag handlers but it also applies to simple tag handlers.

    118) a simple tag class has a overridden doTag() method.see pg-513.

    If the tag has an attribute then it should have a setter method.pg-521

    Dynamic attribute see pg-557.

    119)JspWriter w =pageContext.getOut();w.print(foo); is also a way to print something.

    Another way is getJspContext().getOut().write(foo);

    120)pg-531,532,533

    121)pg-482

    122)pg-754

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    13/20

    123)pg-759

    124)pg-754,759

    125)pg-703(see chapter f ilters and wrappers.)

    126)pg-769

    127)for stubs see patterns and struts chapter.

    128)*

    129)self

    130)pg-182

    131)see the filter chapter.pg-707

    132)pg-182

    133)pg-711

    134) a request object is only accessible to the servlet or jsp to which it has been forwarded.

    135)pg-358

    136)pg-412

    137)pg-357

    If you dont put scope then by default it takes page scope.

    137)pg-357

    138)pg-360.Also see page 361 and 362

    139)pg-97

    Web container loads the servlet class.

    Instantiates the servlet

    Calls init()

    Calls service()

    Calls destroy()

    140)pg-133

    141)*

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    14/20

    142)pg-252

    143)get remote host

    Get remote address

    Get server port(pg-123)

    144)pg-109

    145)pg-403

    146)*

    147)pg-321

    148)*

    149)pg-235

    150)in a servlet life cycle init() is called once.Similarly static block is executed once.and initializer

    block is also executed once.

    151)pg-406,408,409.For dynamic content we use jsp include instead of include directive .

    152)true or false is always true.

    Option B is incorrect since we need to put the quotes in foo.See page-389

    Option c is incorrect becoz = is not a valid operator it shud be ==.

    D is correct.

    153)pg-370 onwards.

    154)pg-471,473

    155)pg-393

    156)pg377

    157)pg-513,514

    Simple tag can only have empty or scriptless in the body.

    158)pg-563,564

    159)*

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    15/20

    160)*

    161)*

    162)pg-360

    163)pg-349,356

    164)it is discussed above.

    165) pg-349,356

    166)*

    167) pg-665

    168) pg-684

    169) pg-677

    170)pg-656

    171)pg-684

    172)pg-509

    173)for custom tags see page-521

    174)pg-456

    175)pg-443

    176)the tag has a body content scriptless hence option D wil l give an error as it has a scripting in its

    body.

    177)pg-463

    178)pg-483

    179)pg-454

    180)local variables are always thread safe.

    For request object see pg-201.

    181)self

    182)pg-182

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    16/20

    183)Servlet Context parameters cannot be set programmatically.

    184)*

    185)pg708

    186)*

    187)pg-613

    188)pg-626

    189)*

    190)*

    191)pg628

    192)pg-626

    193)content under meta-inf and web-inf are not directly accessible.

    194)pg-630

    195)*

    196)pg-235

    197)self

    198)self

    199)pg-182

    200)pg-244

    201)https info is on page 682.

    202)self

    203)read fil ter chapter on page-703

    204)self ,for frontcontrollers or mvc see page-762,769

    205)pg-754

    206)self

    207)for service locator see page-754

    208)self

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    17/20

    209)pg-769

    210) pg-753

    211) pg-753

    212)self

    213)transfer object pg-759

    214)pg-618,619

    /data/-Data Servlet

    /data/index.jsp-Data Servlet

    /secure/command.do-control servlet

    /data/command.do-Data servlet

    /data.do-controlservlet

    215)all files under Meta-inf and web-inf dir are not accessible directly.

    216)self

    217)pg-154

    Here we are using servlet config parameters.As the remote ip i s handled by only one servlet hence

    servlet config parameters is suitable.

    218)pg-615,3rdquestion

    219)info abt WAR files is given in pg-612

    220)*

    221)pg-622,623

    222)pg-362,363.option c is similar to page 360,but in param here they have used EL.for EL exp see

    page 386.

    223)here the only the value that is 49.95 is set but the name is not.so it will take the name that is

    assigned whn its object is created i.e-default.

    To know more abt usebean go to page-349 and to know abt set property go to page-351

    224)see page 389 for option a.

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    18/20

    Pg-349 for option B

    225)pg-404.As the three are stored in the request object hence we can use EL to retrieve it.

    226)pg-577

    227)*

    228)pg-532

    229)pg-510(see question 1)

    230)*

    231) pg-666,pg-669

    232)pg-666

    233)pg-666

    234)pg-665

    235)pg-679 for form based authentication

    236)see page 673,674,675

    237)response.getSession(false) will return an existing sessions object.

    238)*

    239)pg-244

    240)pg-238

    241)pg-182

    242)self

    243)*

    244)*

    245)*

    246)pg-456,for get property see pg-367

    247)pg-458

    248)pg-486

    249)pg443,445

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    19/20

    250)*

    251)pg-446,pg-448

    252)self

    254)self

    255) pg-322

    256)application is the implicit object for servletconfig

    257)pg-412

    258)*

    259)self

    260)pg-390

    261)pg706,707

    262)pg-168

    263)see pg-703 for fil ters

    264)self

    265)*

    266)pg-253

    267)120 days=120*24*360=10368000

    Setmax age(Sec)takes second as parameter.

    268)refer Q)60

    269)pg-109

    270)pg-133 set content length

    271)*

  • 8/13/2019 Scwcd Dumps Explainationdragndrop

    20/20

    272)pg-369,371

    273)pg-373

    274)pg-386

    275)*

    276)self