• Post Reply Bookmark Topic Watch Topic
  • New Topic

tough questions on JSP  RSS feed

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please do share ur answers/opinions regarding foll. questions:
Q. Which statement is true about the JSP code below?
FileWriter fr=new FileWriter(targetFile,true);
fr.write("Some message");
catch(IOException ioex){}%>
a. That is not JSP
b. It should throw ServletException, not IOException
c. Code executes fine
d. FileWriter cannot be used on server
Q. What is the key difference between using a <jsp:forward> and HttpServletResponse.sendRedirect()?
a. forward executes on the client while sendRedirect() executes on the server.
b. forward executes on the server while sendRedirect() executes on the client.
c. both execute on the server.
d. both execute on the client.
Q. You have a .jsp page with an included file (myPage.jsp, with <%@ include file = 'includedFile.jsp'> . When you delete or modify the included file on the server, the old one may still shows in the browser. This can be resolved by -
a. restarting the server.
b. deleting the generated servlet.
c. manually refreshing/reloading the whole page (i.e. refresh 'myPage.jsp')
d. not possible to resolve.
Q. Read the code below.
public int doStartTag(){
JspWriter out=pageContext.getOut();
HttpSession session=pageContext.getSession();
session.setAttribute("TestValue","Hi there");
String s=(String)session.getAttribute("TestValue");
out.println("" + s);
What will be the result if this code is executed?
a. It prints 'Hi there'
b. It prints blank
c. It prints 'Hi'
d. It will not compile as HttpSession is an abstract class
Q. Which of the following statements are true ?
Each time the server receives a request for a servlet, the service method is called.
1. TLD tags never have dashes.
2. Overriding the service method should always be done.
3. A servlet cannot have more than 256 init parameters.
a. 1
b. 2 and 3
c. 3
d. 3 and 4
- prat.
Ranch Hand
Posts: 15304
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please share your answers/opinions regarding the following questions?
Q. Which statement is true about asking homework questions
a. We will do it for free
b. Only if paid
c. We don't do your homework for you
d. In exchange for sexual favors only
Q. How does Javaranch help you
a. Javaranch doesn't like to help people
b. By giving you all the answers
c. By suggesting other sites with the answers
d. We like to help people help themselves. So rather than answering all these questions for you it would be better if you asked one of those questions at a time, tell what you think is the right answer and why, and then we can help you understand whether or not that is the correct approach. Simply providing us with all your questions and possible answers and then expecting us to just answer them and complete your assignment...Am I going to get school credit for this? Because you are if I answer them for you.
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am not wrong these questions are from themilk.com site.
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These were the questions asked in recent oralce recruitment drive.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!