• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passed with 91% (doubt on 2 questions)

 
Nauman Khan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Today, I just passed my SCWCD exam with 91% and I'm very thankful for this platform and people behind this,where everybody shares the problem and get the solution.
Now I am moving to SCBCD.
And During the exam,I came across two questions in which I couldn't u find the appropiate answer
Note:Questions not exactly which I got in exam.
Question 1: Which would be the best option?
1.<test:tag1 attr1="<test:tag2 attr2="values"/>" />
2.<test:tag1 attr1='<test:tag2 attr2="values"/>' />
3.<% String chapter="Value " %>
<test:tag1 attr1=<%=chapter %> />
Question 2: Do the following codes throw the compilation error?
<%{%>
<jsp:useBean id="buffer" class="java.lang.StringBuffer" />
<% buffer.append("Any Value"); %>
<%}%>
<%=buffer %>
Regards,
Nauman
SCJP 2, MCSE, SCWCD
Nauman Khan
 
Neeraj Singhal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Question 2:
the code throws compilation error.
in this line of code

the variable buffer is not accessible as the access is restricted between the statement block within { and }.
 
Steve Agarwal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I havent written the code but I believe that buffer is awailable
as it boils down to for the rest of the method.
StringBuffer buffer = new StringBuffer();
steve
 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Neeraj. Compiler will complain buffer variable is undefined.
-------------
Sainudheen
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice shot Nauman
I'm moving this to the Results forum. Please continue this discussion there. Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic