Java Web Technologies and PS Framework

Test your knowledge of Java programming (generics, collections), Java EE web technologies (JSP, servlets, web.xml), XML, UML notation, and PS framework architecture and configuration.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

In the UML notation, inside each class in a class diagram are printed

  1. its name, attributes, operations, and derived classes.
  2. its name, attributes and operations.
  3. its name, and attributes.
  4. its name, and operations.
  5. just its name.
Question 2 Multiple Choice (Single Answer)

Key elements of the use-case diagram are:

  1. people, computers
  2. actors, use-cases
  3. people, classes, and objects
  4. uses, cases
  5. scenarios in point form
Question 3 Multiple Choice (Single Answer)

Aggregation (encapsulation) relationships are represented in the UML notation by

  1. nesting of classes
  2. lines with a solid diamond at one end
  3. lines with a hollow diamond at one end
  4. lines with an arrow at one end
  5. lines without an arrow at either end
Question 4 Multiple Choice (Single Answer)

In which file will the servlets and the security roles of the application will be defined

  1. Web.xml
  2. application.xml
  3. ps.xml
  4. Actionconfig.xml
Question 5 Multiple Choice (Single Answer)

The file where the task flows and the page flows of the application is specified

  1. Map.xml
  2. Web.xml
  3. ps.xml
  4. DynamicContentAliases.xml
Question 6 Multiple Choice (Single Answer)

Where does the application been first taken in to, when an URL is hit in the browser

  1. Servlet of the appilcation
  2. Deployment descriptor of the appln
  3. Context root of the application
  4. ps.xml file of the application
Question 7 Multiple Choice (Multiple Answers)

In the UML notation, parameterized (generic) classes are represented by

  1. the normal class representation with a dotted arrow pointing at the template parameter classes
  2. the normal class representation but shaded grey.
  3. the normal class representation with a dotted outline and the names of its parameter classes listed on the top right-hand corner.
  4. the normal class representation with a rectangular box in its top left-hand corner.
  5. Its a trick question - parameterized classes can't be specified in the UML notation.
Question 8 Multiple Choice (Single Answer)

In which file will the server side validations will be handled

  1. Page Handler
  2. Action Controller
  3. JSP
  4. Javascript
Question 9 Multiple Choice (Single Answer)

Where will the Life Host region of the server be mentioned

  1. ec_debug.jsp->Configuration->DomainData->LifeHost
  2. ec_debug.jsp->DomainData->Host.xml
  3. using wasops
  4. ec_debug->Jars->Registered Components->DomainData->Host
Question 10 Multiple Choice (Single Answer)

Given: public static void before() { Set set = new TreeSet(); set.add("2"); set.add(3); set.add("1"); Iterator it = set.iterator(); while (it.hasNext()) System.out.print(it.next() + " "); } Which statements are true?

  1. The before() method will print 1 2
  2. The before() method will print 1 2 3
  3. The before() method will print three numbers, but the order cannot be determined
  4. The before() method will not compile
  5. The before() method will throw an exception at runtime
Question 11 Multiple Choice (Single Answer)

What is output to the web page on the second access to the same instance of the following JSP? (Choose one.) <%@ page language="java" %> Chapter 6 Question 2

Chapter 6 Question 2

<%! int x = 0; %> <%! public void jspInit() { System.out.println(x++); } %> <%= x++ %> <% System.out.println(x); %> <% jspInit(); %>

  1. 0
  2. 1
  3. 2
  4. 3
  5. 4
  6. Page does not translate.
Question 12 Multiple Choice (Single Answer)

Which architecture does PS framework follow

  1. Hibernate Architecture
  2. Struts Architecture
  3. MVC Architecture
  4. Web Architecture
Question 13 Multiple Choice (Multiple Answers)

In the UML notation, parameterized (generic) classes are represented by

  1. the normal class representation with a dotted arrow pointing at the template parameter classes
  2. the normal class representation but shaded grey.
  3. the normal class representation with a dotted outline and the names of its parameter classes listed on the top right-hand corner.
  4. the normal class representation with a rectangular box in its top left-hand corner.
  5. Its a trick question - parameterized classes can't be specified in the UML notation.
Question 14 True/False

XML is Case-Sensitive Language

  1. True
  2. False
Question 15 Multiple Choice (Single Answer)

Given: public static void before() { Set set = new TreeSet(); set.add("2"); set.add(3); set.add("1"); Iterator it = set.iterator(); while (it.hasNext()) System.out.print(it.next() + " "); } Which statements are true?

  1. The before() method will print 1 2
  2. The before() method will print 1 2 3
  3. The before() method will print three numbers, but the order cannot be determined
  4. The before() method will not compile
  5. The before() method will throw an exception at runtime
Question 16 Multiple Choice (Single Answer)

Given: interface Hungry { void munch(E x); } interface Carnivore extends Hungry {} interface Herbivore extends Hungry {} abstract class Plant {} class Grass extends Plant {} abstract class Animal {} class Sheep extends Animal implements Herbivore { public void munch(Sheep x) {} } class Wolf extends Animal implements Carnivore { public void munch(Sheep x) {} } Which of the following changes (taken separately) would allow this code to compile? (Choose all that apply.)

  1. Change the Carnivore interface to interface Carnivore<E extends Plant> extends Hungry<E> {}
  2. Change the Herbivore interface to interface Herbivore<E extends Animal> extends Hungry<E> {}
  3. Change the Sheep class to class Sheep extends Animal implements Herbivore<Plant> { public void munch(Grass x) {} }
  4. Change the Sheep class to class Sheep extends Plant implements Carnivore<Wolf> { public void munch(Wolf x) {} }
  5. Change the Wolf class to class Wolf extends Animal implements Herbivore<Grass> { public void munch(Grass x) {} }
  6. No changes are necessary
Question 17 Multiple Choice (Single Answer)

Which collection class(es) allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized? (Choose all that apply.)

  1. java.util.HashSet
  2. java.util.LinkedHashSet
  3. java.util.List
  4. java.util.ArrayList
  5. java.util.Vector
  6. java.util.PriorityQueue
Question 18 Multiple Choice (Single Answer)

Given: public static void main(String[] args) { // INSERT DECLARATION HERE for (int i = 0; i <= 10; i++) { List row = new ArrayList(); for (int j = 0; j <= 10; j++) row.add(i * j); table.add(row); } for (List row : table) System.out.println(row); } Which statements could be inserted at // INSERT DECLARATION HERE to allow this code to compile and run? (Choose all that apply.)

  1. List<List<Integer>> table = new List<List<Integer>>();
  2. List<List<Integer>> table = new ArrayList<List<Integer>>();
  3. List<List<Integer>> table = new ArrayList<ArrayList<Integer>>();
  4. List<List, Integer> table = new List<List, Integer>();
  5. List<List, Integer> table = new ArrayList<List, Integer>();
  6. List<List, Integer> table = new ArrayList<ArrayList, Integer>();
Question 19 Multiple Choice (Single Answer)

Given: 3. import java.util.*; 4. class Business { } 5. class Hotel extends Business { } 6. class Inn extends Hotel { } 7. public class Travel { 8. ArrayList go() { 9. // insert code here 10. } 11. } Which, inserted independently at line 9, will compile? (Choose all that apply.)

  1. return new ArrayList<Inn>();
  2. return new ArrayList<Hotel>();
  3. return new ArrayList<Object>();
  4. return new ArrayList<Business>();
Question 20 Multiple Choice (Single Answer)

Which is true? (Choose all that apply.)

  1. "X extends Y" is correct if and only if X is a class and Y is an interface
  2. "X extends Y" is correct if and only if X is an interface and Y is a class
  3. "X extends Y" is correct if X and Y are either both classes or both interfaces
  4. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces