Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Questions from JDiscuss

 
Imran Vohra
Ranch Hand
Posts: 77
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have doubt in couple of questions.
(1)
An attribute named "rate" is required for a certain tag handler to function. Which of the following XML fragments capture this information in the tag library descriptor?
(Assume that '...' implies all other necessary things are in place.)
  • <required/>
  • <attribute required="true">...</attribute>
  • <name required="true">rate</name>
  • <required>yes</required>
  • <attribute rate=required>...</attribute>


  • Answer is 4.
    My doubt is, can we put "yes" instead of "true" in the body of required tag?
    ------------------
    (2)
    The JSP Code is like this.

    <html>
    <body>
    <%! String MIN; %>
    <%= MIN%>
    </body>
    </html>

    Will this code work perfectly and will give output 0 (zero) OR
    will not compile.

    Thanks in advance.
    Imran
     
    Nikhil Jain
    Ranch Hand
    Posts: 392
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    1. Answer to your first question is <required>yes/true/no/false</required> are valid answers

    2. The second should be printing Null
    because <%! String MIN; > <%= MIN %>
    would be something like
    class xxx {
    String MIN;

    void service() {
    System.out.println(MIN);
    }
    }

    It should print "" because by default String is init. to null. If MIN is a key word then it might give a compiler error..
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic