0

programming languages Online Quiz - 177

Description: programming languages Online Quiz - 177
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

package loop; public class TestLoop1 { void testFor() { for (int i = 1; i < 3; i++) { System.out.println("i in for loop = " + i); if (i == 1) { break; } } System.out.println("For loop over"); } public static void main(String[] args) { TestLoop1 tl = new TestLoop1(); tl.testFor(); System.out.println("Method call Over"); } }

  1. i in for loop = 1 i in for loop = 2 For loop over Method call Over

  2. i in for loop = 1 For loop over Method call Over

  3. Compiler Error

  4. i in for loop = 1 Method call Over


Correct Option: B

package overriding; class Super2 { void testSuper(int empId) { System.out.println("I am in Super " + empId); } } public class TestOverrideSub2 extends Super2 { public void testSuper(int empId) { System.out.println("I am in Sub " + empId); } public static void main(String[] args) { Super2 s2 = new TestOverrideSub2(); s2.testSuper(144670); } }

  1. I am in Sub 144670

  2. I am in Super 144670

  3. Compiler error

  4. Exception


Correct Option: A

What is the maximum number of parameter values that can be forwarded to the servlet from the following HTML form? (Choose one.)

Chapter 1 Question 9

Java C# C C++ Pascal Ada

  1. 2

  2. 3

  3. 4

  4. 5

  5. 6

  6. 7


Correct Option: F

Which of the following directories are legal locations for the deployment descriptor file? Note that all paths are shown as from the root of the machine or drive. (Choose two.)

  1. /WEB-INF

  2. /appserverInstallDirectory/webapps/webappName/WEB-INF/xml

  3. /appserverInstallDirectory/webapps/webappName/WEB-INF

  4. /appserverInstallDirectory/webapps/webappName/WEB-INF/classes


Correct Option: A,C
  1. getInitParameterNames()

  2. getInitParameter(String name)

  3. getServletName()

  4. getServletContext()


Correct Option: B
  1. META-INF is a suitable location for storing digital certificates.

  2. META-INF is used as a repository for common code.

  3. The MANIFEST.MF file is found in the META-INF directory.

  4. The deployment descriptor file is found in the META-INF directory.

  5. META-INF is not directly accessible to clients.


Correct Option: A,C,E

Given the following deployment descriptor: InitParams com.osborne.c02.InitParamsServlet initParm question14 What is the outcome of running the following servlet? (Choose one.) public class InitParamsServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext sc = this.getServletContext(); PrintWriter out = response.getWriter(); out.write("Initialization Parameter is: " + sc.getInitParameter("initParm")); } }

  1. A runtime error

  2. "Initialization Parameter is: null" written to the console

  3. "Initialization Parameter is: question14" returned to the requester

  4. "Initialization Parameter is: null" returned to the requester

  5. "Initialization Parameter is: question14" written to the console


Correct Option: D

Given the following deployment descriptor, identify the sequence of filters that execute on a direct client request for ServletA. (Choose one.) LogFilter ServletA AuditFilter /ServletA FORWARD EncryptionFilter /* ServletA /ServletA

  1. LogFilter, AuditFilter, EncryptionFilter

  2. LogFilter, EncryptionFilter

  3. LogFilter

  4. EncryptionFilter, AuditFilter, LogFilter

  5. EncryptionFilter, LogFilter

  6. AuditFilter, EncryptionFilter, LogFilter


Correct Option: E
- Hide questions