Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Saturday, February 20, 2016

Get the Attention of the Interviewer with a Visual Resume

Get the Attention of the Interviewer with a Visual Resume

What is the basic reason for creating a resume apart from the purpose of introduction? Impression! Impression is the most important thing that a resume has to create if it needs to stand out from the rest of the lot.
An interviewer or a recruiter is bombarded with a large number of resume e-mails daily. So, to get the attention of the interviewer a resume has to have some quality that makes it better than the rest.
Visual resume is the trending new thing that gives an instant impression about you in a more impactful manner. It is the graphical representation of your career-related information.
Sometimes it is difficult even to get a foot on the door as your resume may get buried under hundreds of other resumes with the same quality and profile.
To get an interview scheduled, you have to get an approval of your resume.
Nowadays with cut-throat competition, there is need for making the resume more efficient to receive attention.
With visual resumes, job seekers can strike an instant chord with the recruiter by providing easy to understand infographics and visually appealing styles. It provides recruiters with a refreshing option from all other dull plain texts that he has been looking throughout the day.
There are a lot of advantages that visual resume has to offer. It has become a trend among job seekers toapply for jobs using visual resume due to better chances. Let us look at some of the advantages of visual resume:

More Information in Lesser Space

Visual Resume is all about making most of the space there is. With infographics, a lot of information can be shown in as less space as needed. It is better than providing pages of pages showing of your skills and achievements.
Recruiters usually get bored by looking at resumes that contain a lot of pages and may skip important points. But with visual resume, the recruiters can understand a lot about your skills in a quick glance.

Clean with More Appeal

The best thing about visual resumes is that it is clean in look and hence it is more appealing than traditional resumes. With visual information you can highlight the important features of your resume in an easy way.
Visual resumes are very appealing and have a clean look. Recruiters love visual resumes and give them a refreshing view from the common traditional resumes. The same information can be conveyed in a more impressive manner.

Good Way to Fill Up the Blanks

Visual Resume is a great option for freshers as they have little information and work experience to show on their resume. If there are lot of blank spaces in the resume it would have an negative impact on the job seeker.
Recruiters usually feel that resumes with blank spaces mean that the candidate does not have enough skills. Freshers can use visual graphics to showcase any skills and use the space efficiently so that the resume doesn’t feel blank.

Focus on the Soft Skills

Some profiles like sales need a good deal of soft skills other than technological knowhow and related skills. Visual resume is an effective way to put focus on the soft skills.
In traditional resumes these skills are generally obscured by other features. It is easier for recruiters to have a quick look at the relevant soft skills that are required for the particular job.

Resume Value

It is a common thing that uniqueness of anything makes it stand out from the rest.
If you are able to present your skills in such a way that it has maximum impact on the attention of the recruiter, your resume will be of greater value than others having the same skill level.
Visual resume helps you to present your skills in such a manner.
Do you want to get the most out of your skills by presenting a killer resume? Try using a visual resume the next time you apply for a job vacancy.
You can take the help of a number of resume expert present online that will give it a professional look.
Share:

PERSONALITY DEVELOPMENT & SUCCESS TIPS

Share:

GNIIT SEM D MT1 EXAM QUESTION

GNIIT SEM D MT1 EXAM QUESTION

  1. Paul has created a bean called myclass that wraps a collection of student objects. He has Written the following code snippet to iterate over the myclass bean and produce one row for each student:
<c:forEachvar=”student” items=”${myclass.myclass}”>
<tr>
<td>${student.name}</td>
<td>${student.age}</td>
<td>${student.height}</td>
</tr>
</c:forEach>
Now, Paul wants to write the preceding code snippet using scriptlets and unordered list. Which of the following code   snippets fulfills Paul’s requirement?
1, <ul>
      <%
      Iterator items = myclass.iterator();
      while ( items.hasNext() ) {
      myclass myclass1 = (myclass) items.next();
      %>
      <li><%= student.getTitle() %></li>
      <% } %>
      </ul>
      m
2, <ul>
<%
Iterator items = myclass.iterator();
while ( items.hasNext() ) {
myclass myclass1 = items.next();
%>
<li><%= student.getTitle() %></li>
<% } %>
</ul>
m
3, <ul>
<%
Iterator items = myclass.iterator();
myclass myclass1 = (myclass) items.next();
%>
<li><%= student.getTitle() %></li>
<% } %>
</ul>
m
4, <ul>
<%
Iterator items = myclass.iterator();
while ( items.hasNext() ) {
myclass myclass1 = (myclass) items.next();
%>
<li><%= myclass.getTitle() %></li>
<% } %>
</ul>
m
2.Mark is developing a shopping site for Nucleus Inc., using the Struts framework. He has to write the code to track the items that a user adds to the shopping cart. To implement this functionality, he writes the following code in the AddItemsAction class:
public class AddItemsAction extends Action
{
publicActionForward execute(ActionForm form, HttpServletRequest request,
HttpServletResponse response)
{
List errorMsgs = new LinkedList();
request.setAttribute(“errorMsgs”, errorMsgs);
try
{
String itemStr = request.getParameter(“Item”).trim();
String itemCode = request.getParameter(“Code”).trim();
……….
……….
}
catch(Exception E)
{
E.printStackTrace()
}
}
}
However, the preceding code causes errors during compilation. Analyze the preceding code to identify the cause of   error and provide the solution.
1, The setAttribute() method is used incorrectly in the code. The correct code is:
response.setAttribute(“errorMsgs”, errorMsgs);
2, The setAttribute() method is used incorrectly in the code. The correct code is:
request.setAttribute(errorMsgs, “errorMsgs”);
3, The incorrect signature of the execute() method is used in the code. The correct signature is:
publicActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletResponse response)
4, The incorrect signature of the execute() method is used in the code. The correct signature is:
                                publicActionForward execute(ActionMapping mapping, ActionForm
                                form, HttpServletRequest request,HttpServletResponse response) 
3.Jenny has been assigned the task to develop a login module of a Web application that authenticates the users and provides success and failure messages depending upon the user credentials. The two types of users of the Web application are provider and consumer. As, the Web application has been developed using the Struts framework, Jenny creates two action classes to validate the users. The ValidateProvideAction class validates the users who log in as provider. However, the ValidateConsumerAction class the users who log in as consumer. She stores the two action classes in the validate package of the application. After creating the action classes, she writes the following code in the struts-config.xml file to configure the action classes:
<action-mappings>
<action path=”/StrutsApp/form” type=”/ValidateProvideAction”>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
<action path=”/StrutsApp/form” type=”/ValidateConsumerAction”>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
</action-mappings>
However, Jenny is not able to perform the desired task with the preceding mapping. Identify the correct code that Jenny can use to perform the desired task.
1, <action-mappings>
<action path=”/StutsApp/form” type=”validate.ValidateProvideAction”>
<forward name=”success” path=”/webpage/success.view”/>
      <forward name=”error” path=”/webpage/error.view”/>
      </action>
            <actionpath=”/StrutsApp/form”type=”validate.ValidateConsumerAction “>
      <forward name=”success” path=”/webpage/success.view”/>
      <forward name=”error” path=”/webpage/error.view”/>
      </action>
      </action-mappings>
2, <action-mappings>
<action path=”/StutsApp/form” type=”validate/ValidateProvideAction”>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
<action path=”/StrutsApp/form” type=” validate/ValidateConsumerAction
“>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
</action-mappings>
3, <action-mappings>
<action path=”/StutsApp/form” type=”/validate/ValidateProvideAction”>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
<action path=”/StrutsApp/form” type=” /validate/ValidateConsumerAction
“>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
</action-mappings>
4, <action-mappings>
<action path=”/StutsApp/form” type=validate.ValidateProvideAction>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
<action path=”/StrutsApp/form” type= validate.ValidateConsumerAction>
<forward name=”success” path=”/webpage/success.view”/>
<forward name=”error” path=”/webpage/error.view”/>
</action>
</action-mappings>
4.Martin has created a Web application in which a servlet stores a JDBC URL as an attribute of the session object to access a database. He wants other servlets of the application to retrieve the URL attribute from the session object to access the database. Which of the following code snippets can Martin use to retrieve the URL from the session object?
      1, HttpSession session = request.getSession();                                                                                          String url =(String)session.getAttribute(“URL”);
2, HttpSession session = request.getSession();                                                                                            String url =session.getAttribute(“URL”);
3, String url=(String)session.getSession(“URL”);
4, HttpServletRequest session = request.getSession();                                                                                 String url =(String)session.getAttribute(“URL”);
5.Richard creates a servlet that retrieves the user name and stores it in a cookie called user. The servlet, then, sends the cookie to the client using the response object. Now, Richard wants to obtain the cookie from the request object and retrieve the user name from it. Which of the following code snippets will help Richard implement this nctionality?
1,public void doPost(HttpServletRequestreq, HttpServletResponse res)
throwsServletException, IOException
{
PrintWriter pw=res.getWriter();
String username=null;
Cookie ck[] = res.getCookies();
if (ck!=null)
{
for (int i=0; i<ck.length; i++)
{
if (ck[i].getName().equals(“user”))
username = ck[i].getValue();
}
pw.println(username);
}
else
{
pw.println(“No cookies found”);
}
}
2, public void doPost(HttpServletRequestreq, HttpServletResponseres)
                                      throwsServletException, IOException
                                      {
                                      PrintWriter pw=res.getWriter();
                                          String username=null;
                                          Cookie ck[] = req.getCookies();
                                      if (ck!=null)
                                          {
                                      for (int i=0; i<ck.length; i++)
                                             {
                                      if (ck[i].getName().equals(“user”))
                                      username = ck[i].getValue();
                                             }
                                      pw.println(username);
                                          }
                                      else
                                          {
                                      pw.println(“No cookies found”);
                                          }
      }
3, public void doPost(HttpServletRequestreq, HttpServletResponse res)
throwsServletException, IOException
{
PrintWriter pw=res.getWriter();
String username=null;
Cookie ck[] = req.getCookies();
if (ck!=null)
{
for (int i=0; i<ck.length; i++)
{
if (ck[i].getCookies().equals(“user”)
username = ck[i].getValue();
}
pw.println(username);
}
else
{
pw.println(“No cookies found”);
}
}
4, public void doPost(HttpServletRequestreq, HttpServletResponse res)
throwsServletException, IOException
{
PrintWriter pw=res.getWriter();
String username=null;
Cookie ck[] = req.getName().equals(“user”);
if (ck!=null)
{
for (int i=0; i<ck.length; i++)
{
username = ck[i].getValue();
}
pw.println(username);
}
else
{
pw.println(“No cookies found”);
}
}
6.Paul is developing an application for library management using JSP. The AddBooks and RemoveBooks pages should be accessible only by the library staff and not the users. For this, he decides to create a role, staff. Mark should be assigned to this role. Which of the following code snippets correctly maps Mark to the staff role?
1, <security-role-ref>
      <role-name>staff</role-name>
      <role-link>Mark</role-link>
      </security-role-ref>
2, <security-role>
<role-name>staff</role-name>
<role-link>Mark</role-link>
</security-role>
3, <security-role-ref>
<role-name>staff</role-name>
<role>Mark</role>
</security-role-ref>
4, <security-role-ref>
<role>staff</role>
<role-link>Mark</role-link>
</security-role-ref>
7.Peter is developing a Web application for a bank. The application needs to accept the user credentials through the login.html page and validate them. If the user credentials are successfully validated, a success message should be displayed. In case of a failed logon attempt, the logonerror.html should be displayed. For this, Peter decides to use the form-based authentication. Which of the following code snippets correctly defines the deployment descriptor tags for the form-based authentication?
1, <login-config>
<auth-method>
FORM
<realm-name>Secure Form Authentication</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/logonerror.html</form-error-page>
</form-login-config>
</auth-method>
</login-config>
2, <login-config>
<auth-method>FORM</auth-method>
<realm-name>Secure Form Authentication</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
</form-login-config>
</login-config>
3, <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>Secure Form Authentication</realm-name>
      <form-login-config>
      <form-login-page>/login.html</form-login-page>
      <form-error-page>/logonerror.html</form-error-page>
      </form-login-config>
      </login-config>
4, <login-config>
<auth-method>FORM</auth-method>
<realm-name>Secure Form Authentication</realm-name>
<form-login-page>/login.html</form-login-page>
<form-error-page>/logonerror.html</form-error-page>
</login-config>
8.Larry has created aa tag handler, Account.java, which displays the information about the various types of accounts a person can open with the bank. Now, he needs to create a TLD file named Mytaglib.tld for the same. Which of the following code snippets can Larry use to create the TLD file?
1, <?xml version=”1.0″ encoding=”UTF-8″?>
<taglib version=”2.0″ xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
web-jsptaglibrary_2_0.xsd”>
<tlib-version>1.0</tlib-version>
<short-name>mytaglib</short-name>
<uri>Mytaglib</uri>
<tag>
<name>Account</name>
<tag-class>Account</tag-class>
<body-content>JSP</body-content>
</tag>
</taglib>
2, <?xml version=”1.0″ encoding=”UTF-8″?>
      <taglib version=”2.0″ xmlns=”http://java.sun.com/xml/ns/j2ee”
      xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
      xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
      web-jsptaglibrary_2_0.xsd”>
      <tlib-version>1.0</tlib-version>
      <short-name>mytaglib</short-name>
      <uri>/WEB-INF/tlds/Mytaglib</uri>
      <tag>
      <name>Account</name>
      <tag-class>Account</tag-class>
      <body-content>JSP</body-content>
      </tag>
      </taglib>
3, <?xml version=”1.0″ encoding=”UTF-8″?>
<taglib version=”2.0″ xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
web-jsptaglibrary_2_0.xsd”>
<tlib-version>1.0</tlib-version>
<short-name>mytaglib</short-name>
<uri>/WEB-INF/tlds/Mytaglib</uri>
<tag>
<name>Account</name>
<body-content>JSP</body-content>
</tag>
</taglib>
4, <?xml version=”1.0″ encoding=”UTF-8″?>
<taglib version=”2.0″ xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
web-jsptaglibrary_2_0.xsd”>
<tlib-version>1.0</tlib-version>
<short-name>mytaglib</short-name>
<uri>./Mytaglib</uri>
<tag>
<name>Account</name>
<tag-class>Account</tag-class>
<body-content>JSP</body-content>
</tag>
</taglib>
 9.Quentin is developing a Web application for an educational institute. The administration and archive pages of the application should be accessed by the senior management only. For this, Quentin creates a role, Senior Staff. Now, he needs to define the following security constraint:
<security-constraint>
<display-name>SecurityConstraint</display-name>
<web-resource-collection>
<url-pattern> /*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name> Senior Staff</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee> NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
Identify the error, if any, in the preceding code snippet.
1, There is no error in the given code snippet.
2, The given code snippet does not contain the auth-method element after the auth-constraint element.
3, The given code does not contain the web-resource-name element.
4, The given code contains the NONE value in the transport-guarantee element.
10.You are developing a web application for the soccer league using Struts framework. For this, you need to create a Struts controller that extends the Struts Action base class and implements the execute method. How will you declare the execute method in the Struts controller class?
1, public ActionForwardexecute(ActionMapping mapping, ActionFormform,
                                HttpServletRequest request, HttpServletResponse response)
                                {
                                 //write the code
                                } m
2, public void execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
//write the code
}
3, public intexecute(ActionMapping mapping, HttpServletRequest request,
HttpServletResponse response)
{
//write the code
}
4, public ActionForwardexecute(ActionForm form, HttpServletRequest
request, HttpServletResponse response)
{
//write the code
}

  1. Jack Smith is working as a Java developer in P. Tech Ltd. He is developing a web application using Servlets and JSP. He decides to use Filters in the web application. He has to ensure that the filter would only be applied to internal dispatches to the URL pattern *.do and not to any direct client requests. He uses the following code to declare the filter mapping:
<filter-mapping>
<filter-name>auditFilter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
However, the above code make the auditFilter apply to the direct client requests for a URL which matches *.do pattern. Identify the error and provide the solution.

1, Replace the code with the following:
<filter-mapping>
<filter-name>auditFilter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>request</dispatcher>
</filter-mapping>
2, Replace the code with the following:
<filter-mapping>
<filter-name>auditFilter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
3, Replace the code with the following:
<filter-mapping>
<filter-name>auditFilter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>include</dispatcher>
</filter-mapping>
      4, Replace the code with the following:
                                      <filter-mapping>
                                      <filter-name>auditFilter</filter-name>
                                      <url-pattern>*.do</url-pattern>
                                      <dispatcher>INCLUDE</dispatcher>
                                      <dispatcher>FORWARD</dispatcher>
                                      </filter-mapping>

  1. Jack Smith is working as a Java developer in P. Tech Ltd. He is developing a web application using Servlets and JSP. He decides to use Filters in the web application. He uses the following code to declare the filter in the application:
<filter>
<filter-name>perfFilter</filter-name>
<init-param>
<param-name>Log Entry Prefix</param-name>
<param-value>Performance: </param-value>
</init-param>
</filter>
However, the above code is incomplete in terms of filter declaration. Identify the error?

1, filter-class element is missing in the filter declaration.
2, servlet-name element is missing in the filter declaration.
3, servlet-mapping element is missing in the filter declaration.
4, url-pattern element is missing in the filter declaration.

  1. Consider the code for filter mapping in the web application deployment descriptor file:
<servlet-mapping>
<servlet-name>MyController</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

1)<filter-mapping>
<filter-name>First</filter-name>
<servlet-name>MyController</servlet-name>
</filter-mapping>
2)<filter-mapping>
<filter-name>Second</filter-name>
<servlet-name>MyController</servlet-name>
</filter-mapping>
3) <filter-mapping>
<filter-name>Third</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
4)<filter-mapping>
<filter-name>Fourth</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
Predict the order in which filter will be applied if the request was made for the URL /admin/add_league.do?

1,First>Second>Third>Fourth
2,Third>Fourth>First>Second
3,Fourth>Third>Second>First
4,Second>First>Fourth>Third
  1. A code for filter mapping has to be written for a filter called Login Filter for components in such a manner that it should be applied to component whenever an error occurs. Predict the code for filter mapping to perform the required task from the following options.

1,<filter-mapping>
<filter-name>LoginFilter</filter-name>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
      2,<filter-mapping>
      <filter-name>LoginFilter</filter-name>
      <url-pattern>*.do</url-pattern>
      <dispatcher>ERROR<dispatcher>
      </filter-mapping>
3,<filter-mapping>
<filter-name>LoginFilter</filter-name>
<dispatcher>ERROR</dispatcher>
<url-pattern>ERROR.do</url-pattern>
</filter-mapping>
4,<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>dispatcher.ERROR</dispatcher>
</filter-mapping>

  1. Predict the correct code for the declaration of a form bean called employeeform in the struts framework?

1,importorg.apache.struts.action.ActionForm;
public class employeeform implements ActionForm
{
//required code
}
2,importorg.apache.struts.action.ActionForm;
   public class employeeform extends ActionForm
   {
   //required code
   }
3,import org.apache.struts.ActionForm;
public class employeeform extends ActionForm
{
//required code
}
4,importorg.apache.struts.action.ActionForm;
public class employeeform
{
//required code
}

  1. Stem text : Consider the following code regarding accessing of session attributes in a session management program. But this program has few errors. Predict the correct code for the program.
String login=request.getParameterValue(“login”);
if(login.equals(“tim”)
{
returnmapping.Forward(error);
}
if(login.equals(“David”)
{
returnmapping.Forward(success);
}
where mapping is an object of ActionMapping Class.
1,String login=request.getParameter(“login”);
if(login.equals(“tim”)
{
returnmapping.Forward(“error”);
}
if(login.equals(“David”)
{
returnmapping.Forward(“success”);
}
2,String login=request.getParameter(“login”);
if(login.equals(“tim”)
{
returnmapping.findForward(error);
}
if(login.equals(“David”)
{
returnmapping.findForward(success);
}
3,String login=request.getParameterValue(“login”);
if(login.equals(“tim”)
{
returnmapping.findForward(“error”);
}
if(login.equals(“David”)
{
returnmapping.findForward(“success”);
}
4,String login=request.getParameter(“login”);
   if(login.equals(“tim”)
   {
   returnmapping.findForward(“error”);
   }
   if(login.equals(“David”)
   {
   returnmapping.findForward(“success”);
            }

  1. Which of the following lines of code can be used for adding a pre-defined applet named chatApp to a JSP page? The chatApp class file is present in the /applets directory.

1,<jsp:plugin type=”applet” code=”chatApp.class”codebase=”/applets” width=”400″ height = “300”></jsp:plugin>
2,<jsp:plugin type=”applet” code=”chatApp.class” codebase=”applets” width=”400″ height = “300””>
</jsp:plugin>
3,<jsp:plugin type=”applet” code=”chatApp.class” codebase=”/applets” width=”400″ height = “300”/>
4,<jsp:plugin code=”chatApp.class” codebase=”/applets” width=”400″ height = “300>
</jsp:plugin>

  1. What will be the output of the following code snippet:
<%@ page language=”java”%>
<html>
<head></head>
<body>
<%java.util.Date now=new java.util.Date(); %>
<H1><%= now.getHours()
%>:<%=now.getMinutes()%>:<%=now.getSeconds()%></H1>
</body>
</html>
1,It will display the date as mm:dd:yy.
2,It will display the date and time.
3,It will display time as hh/mm/ss.
4,It will display the current time as hh:mm:ss.

  1. You have deployed two servlets named servlet1 and servlet2 in your Web server. You want to create an attribute called “customernumber” and assign the value of a variable cnum to it. Which of the following codes is the correct method for doing it?

1,ServletContext c=getServletContext();
c.setAttribute(cnum,”customernumber”);
2,ServletConfig c=getServletConfig();
c.setAttribute(cnum,”customernumber”);
3,ServletContext c=getServletContext()
   c.setAttribute(“customernumber”, cnum)
4,ServletConfig c=getServletConfig();
c.setAttribute(“customernumber”, cnum);

  1. What will be the output of the following code snippet:
<%@ page language=”java”%>
<html>
<head></head>
<body>
<%java.util.Date now=new java.util.Date(); %>
<H1><%= now %></H1>
</body></html>

1,It will display the date and time.
2,It will display the time and day of the week.
3,It will display the date and day of the week.
4,It will display the date, time, and day of the week.

  1. Consider the following code:
<%@ page language=”java”%>
<html>
<body>
<% String login=(request.getParameter(“Login”));
String password=(request.getParameter(“Password”));
for(int i=0;i<10;i++)
out.println(“Login is”+” “+login);
out.println(“Password is”+” “+password);
%>
</body>
</html>
What will be the output of the above code if login name and password are accepted through user interface?

1,Login message will be displayed ten times and Password messageonce.
2,Both login and password message will be displayed ten times.
3,Login Message will be displayed nine times and Password message once.
4,Both login  and password message will be displayed nine times.

  1. Consider the usage of JSTL forEach tag in the following code snippet:
<font color=’green’>
<ul>
<c:foreach flag=errmsg items=”${errorMsgs}”>
<li>$errmsg</li>
</c:forEach>
</ul>
</font>
However, the preceding code snippet contains some errors. Predict the correct code.

1,<font color=’green’>
<ul>
<c:forEachvar=errmsg items=”${errorMsgs}”>
<li>$errmsg</li>
</c:forEach>
</ul>
</font>
2,<font color=’green’>
      <ul>
      <c:forEachvar=”errmsg” items=”${errorMsgs}”>
      <li>${errmsg}</li>
      </c:forEach>
      </ul>
      </font>
3,<font color=’green’>
<ul>
<c:forEachvar=”errmsg” items=”${errorMsgs}”>
<li>$errmsg</li>
</c:forEach>
</ul>
</font>
4,<font color=’green’>
<ul>
<c:forEachvar=errmsg items=”${errorMsgs}”>
<li>${errmsg}</li>
</c:forEach>
</ul>
</font>

  1. Consider the following code snippet of JSP Bean:
<jsp:usebean identity=”login” scope=”Session” class=s1314.beans.LoginBean>
<%!login.setValue(request.getParameter(“Loginid”));
login.setAddress(request.getParameter(“address”));
%>
<jsp:usebean>
However, the preceding code contains errors. Predict the correct code.

1,<jsp:useBean id=”login” scope=”Session”>
      <%login.setValue(request.getParameter(“Loginid”));
      login.setAddress(request.getParameter(“address”));
      %>
      </jsp:useBean>
2,<jsp:useBean identity=”login” scope=”Session”    >
<%!login.setValue(request.getParameter(“Loginid”));
login.setAddress(request.getParameter(“address”));
%>
<jsp:useBean>
3,<jsp:useBean id=”login” scope=”Session” class=”s1314.beans.LoginBean”>
login.setValue(request.getParameter(“Loginid”));
login.setAddress(request.getParameter(“address”));
</jsp:useBean>
4,<jsp:useBean id=”login” scope=”Session” class=”s1314.beans.LoginBean”>
<login.setValue(request.getParameter(“Loginid”));/>
<login.setAddress(request.getParameter(“address”));/>
</jsp:useBean>

  1. While configuring the JSP Environment, you want to turn off scripting as well as ignore EL in the JSP file. What would be the code for this?

1,<jsp-config>
      <jsp-property-group>
      <url-pattern>/scriptting_off/*</url-pattern>
      <scripting-invalid>true</scripting-invalid>
      </jsp-property-group>
      <jsp-property-group>
      <url-pattern>/EL_off/*</url-pattern>
      <el-ignored>true</el-ignored>
      </jsp-property-group>
      </jsp-config> m
2,<jsp-property-group>
<url-pattern>/scriptting_off/*</url-pattern>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
<jsp-property-group>
<url-pattern>/EL_off/*</url-pattern>
<el_ignored>true</el_ignored>
</jsp-property-group> m
3,<jsp-config>
<url-pattern>/scriptting_off/*</url-pattern>
<scripting-invalid>true</scripting-invalid>
<url-pattern>/EL_off/*</url-pattern>
<el_ignored>true</el_ignored>
</jsp-config> m
4,<jsp-config>
<jsp-property-group>
<url-pattern>scriptting_off</url-pattern>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
<jsp-property-group>
<url-pattern>EL_off</url-pattern>
<el_ignored>true</el_ignored>
</jsp-property-group>
</jsp-config>>

  1. List down the methods of ServletContext Interface.

1,getInitParameter(name:String):String
      getInitParameterNames():Enumeration
      getResource(path):URL
      getResourceAsStream(path):InputStream
2,getInitParameter(name:String):String
getInitParameterList():Enumeration
getResourceUrl(path):URL
getResourceAsStream(path):InputStream
3,getInitParameter():String
getInitParametervalues():Enumeration
getResource(path):URL
getResourceAsStream(path):void
4,getInitParameter(name:String):String
getInitParameterList():Enumeration
getResourceAsInputStream(path):InputStream

  1. Predict the output of the following code:
import java.io.*;
import java.net.*;
importjavax.servlet.*;
importjavax.servlet.http.*;
public class earnmore extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException
{
String pageTitle = “Welcome to EarnMore Bank”;
response.setContentType(“text/html”);
out.println(“<html>”);
out.println(“<body>”);
out.println(pageTitle);
out.println(“</body>”);
out.println(“</html>”);
}
} m
1, The code will compile and execute successfully. The string, Welcome to EarnMore Bank, will be displayed. m
2, The code will compile successfully but give a runtime error. m
3, The code will display a blank page. m
      4, The code will give compilation error.

  1. Jennifer has created an HTML form that accepts two numbers from the user. This form contains a button. When this button is clicked, the numbers are passed to a servlet. Jennifer creates a servlet named Calculate to calculate the sum of the numbers entered by the user. She, then, creates another servlet named Display to display this sum. Now, she wants the sum calculated by the Calculate servlet to be passed to the Display servlet. The code of the Calculate servlet is:
importjavax.servlet.*;
importjavax.servlet.http.*;
import java.io.*;
public class Calculate extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
int num1=Integer.parseInt(request.getParameter(“number1″));
int num2=Integer.parseInt(request.getParameter(“number2″));
int result= num1+num2;    }
}
Which of the following code snippets will help Jennifer use to provide the required functionality?

1, request.setAttribute(“result”,new Integer(result));
RequestDispatcherreqDisp=request.getRequestDispatcher(“/Display”);
reqDisp.forward(request,response);

2, RequestDispatcherreqDisp=request.getRequestDispatcher(“/Display”);
reqDisp.forward(request,response); m
3, request.setAttribute(“result”,new Integer(result));
      RequestDispatcherreqDisp=request.getRequestDispatcher(“Display”);
      reqDisp.forward(request,response);

4, response.setAttribute(“result”,new Integer(result));
RequestDispatcherreqDisp=request.getRequestDispatcher(“Display”);
reqDisp.forward(request,response);

  1. Michelle has created the Hello servlet that displays Welcome in the browser window. The code of the servlet is:
packagemyworld;
importjava.io.IOException;
importjava.io.PrintWriter;
importjavax.servlet.ServletConfig;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
public class hello extends HttpServlet
{
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
PrintWriter out = response.getWriter();
out.println(“<html>”);
out.println(“<head>”);
out.println(“<title>My Servlet</title>”);
out.println(“</head>”);
out.println(“<body>”);
out.println(“<h1>WELCOME</h1>”);
out.println(“</body>”);
out.println(“</html>”);
out.close();
}
}
Which of the following code snippets correctly defines the deployment descriptor for the preceding servlet?
1, <servlet>
<servlet-name>hello</servlet-name>
<servlet-class>hello</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping> m
2, <servlet>
      <servlet-name>hello</servlet-name>
      <servlet-class>myworld.hello</servlet-class>
      </servlet>
      <servlet-mapping>
      <servlet-name>hello</servlet-name>
      <url-pattern>/hello</url-pattern>
      </servlet-mapping> m
3, <servlet>
<servlet-name>myworld.hello</servlet-name>
<servlet-class>hello</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping> m
4, <servlet>
<servlet-name>hello</servlet-name>
<servlet-class>myworld.hello</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>hello</url-pattern>
</servlet-mapping>

  1. Margaret is developing a Web application for a travel agency. She creates a servlet with the initialization parameter, holiday_destination. Based on the values of the initialization parameter, the servlet displays the relevant information. Margaret now wants to retrieve the value of the initialization parameter. Which of the following code snippets helps retrieve the initialization parameter successfully?
1, public void doGet(HttpServletRequestreq, HttpServletResponse res)
throwsServletException, IOException
{
String strValue=getInitParameter(“holiday_destination”);
}

2, public void init() throws ServletException
               {
       String strValue=getInitParameter(“holiday_destination”);
               }                                                

3, public void doPost(HttpServletRequestreq, HttpServletResponse res)
throwsServletException, IOException
{
String strValue=getInitParameter(“holiday_destination”);
}

4, public void init() throws ServletException
{
String strValue=request.getInitParameter(“holiday_destination”);
}

  1. Samantha is developing an online book store. She creates a JavaBean that accepts and stores the book preferences of a user in the array, userpref. Now, Samantha wants to develop a servlet that retrieves the book preferences from the JavaBean. Which of the following code snippets will help her retrieve the third element of the userpref array?
1, ${param.userpref[2]}
2, ${paramValues.userpref[3]}
3, {paramValues.userpref[2]}
4, ${paramValues.userpref[2]}

  1. Eric has created the following class named first containing a public static
method:
package mypackage1;
public class first
{
public first()
{
}
public static String newmsg(){
return “Welcome to class”;
}
}
Now, Eric wants to invoke the newmsg() method using EL. So, he creates a
TLD file with the following code:
<uri>newfunc</uri>
<function>
<name>newmsg</name>
<function-class> mypackage1.first </function-class>
</function>
Identify the error, if any, in the preceding code snippet.

1, There is no error in the given code snippet.
2, The function-class element should have the value, first, and not mypackage1.first.
3, The given code does not contain the function-signature element.
4, Theuri element should have the value, newmsg, and not newfunc.

  1. Sandra is developing an application that accepts a string from the user and displays it on the screen. She decides to develop this application using custom tags. She has created an HTML with a text field and button. She, then, creates a TLD file. Now, she creates the following tag handler:
importjava.io.IOException;
importjavax.servlet.jsp.JspException;
importjavax.servlet.jsp.JspWriter;
importjavax.servlet.jsp.tagext.BodyContent;
importjavax.servlet.jsp.tagext.BodyTagSupport;
public class tagdemo extends BodyTagSupport {
private String name;
publictagdemo() {
super();
}
public void setName(String name){
this.name=name;
}
public void doAfterBody() throws JspException{
try{
BodyContentbc=getBodyContent();
String body=bc.getString();
JspWriter out=bc.getEnclosingWriter();
if(body!=null)
out.print(“<center>Hi”+body+”! </center>”);
out.print(“</body>”);
}
catch(Exception e){
throw new JspException(“Error: “+e.getMessage());
}
return SKIP_BODY;
}
}
Identify the error, if any, in the preceding code of the tag handler.

1, There is no error in the code of the tag handler.
2, The tag handler class extends the BodyTagSupport class instead of the TagSupport class.
3, The return type of the doAfterBody() method is void, and not int.
4, The tag handler class does not implement the doStartTag() method.

  1. Linda Parker, a senior manager of Nortel Ltd., assigns Peter, a software engineer with the organization, the task to develop a Web application. The Web application will be accessible to the customers as well as the employees. Peter decides to implement the form-based authorization in this Web application. He creates the following logon form:
<html>
<head>
<title>
Form-based Login Authentication
</title>
</head>
<body>
<br><br>
<center>
<h2>Please Login to Authenticate Yourself</h2>
<form method=”post” action=”j_security_check”>
<table>
<tr>
<td>User Name: </td>
<td><input type=”j_username” name=”text”></td>
</tr>
<tr>
<td>Password: </td>
<td><input type=”j_password” name=”password”></td>
</tr>
<tr>
<td><input type=”submit” value=”Login”></td>
<td><input type=”reset” value=”Reset”></td>
</tr>
</table>
</form>
</center>
</body>
</html>
However, the preceding code generates error. Identify the reason for the error and provide a solution for the same.

1,The line causing the error is:
<form method=”post” action=”j_security_check”>
Linda needs to replace the line by:
<form method=”post” action=”Form-based authentication”> m
2, The lines causing the error are:
      <td><input type=”j_username” name=”text”></td>
      <td><input type=”j_password” name=”password”></td>
Linda needs to replace the preceding lines by:
<td><input name=”j_username” type=”text”></td>
<td><input name=”j_password” type=”password”></td> m
3, The line causing the error is:
<form method=”post” action=”j_security_check”>
Linda needs to replace the preceding line by:
<form method=”post” action=”security_check”> m
4, The lines causing the error are:
<td><input type=”j_username” name=”text”></td>
<td><input type=”j_password” name=”password”></td>
Linda needs to replace the preceding lines by:
<td><input name=”username” type=”text”></td>
<td><input name=”password” type=”password”></td>
Share:
GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

Unordered List