SCWCD
Question 26
16 To send binary output to response, which method of HttpServletResponse is used to get the Writer/ Stream object ?
A getStream
B getWriter
C getBinaryOutputStream
D getOutputStream
E getBinaryStream
Answer
D
The getOutputStream is used for sending binary data. The getWriter is used for sending character data only.
Question 27
17 <%@ page language ="java" session="false" isErrorPage="false" %>
which of the following JSP implicit object will not be available to the JSP page ? Select two
A session
B request
C application
D exception
Answer
A and D
Since we are disabling the session by using session="false", session will not be available. And since this page is not an error page , so exception also will not be available.
Question 28
18 Which among the following will compile ?
A <% int x=10 %>
B <%= "hello how are you" %>
C <%= "hello" ;% >
D <%! int x=10 %>
Answer
B
Option B is the correct choice. A is in correct because there is no semi colon present. The same rule applies to option D also. Option C is in correct because of semi colon.
Question 29
19 In a JSP custom tag , which method would you use to access JSP implicit variable that references application scope ?
A PageContext.getOut()
B jspFactory.getPageContext()
C TagSupport.getValue(String)
D pageContext.getServletContext()
Answer
D
Question 30
20 Which method is used to retrieve objects from session?
A getAttribute method of javax.servlet.ServletSession.
B getAtrribute method of javax.servlet.HttpSession
C getAttribute method of javax.servlet.http.Session
D getAttribute method of javax.servlet.http.HttpSession
E getAttribute method of javax.servlet.HttpSession
Answer
D
All other answers are invalid because no such classes present.