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.
Questions
In the UML notation, inside each class in a class diagram are printed
- its name, attributes, operations, and derived classes.
- its name, attributes and operations.
- its name, and attributes.
- its name, and operations.
- just its name.
Key elements of the use-case diagram are:
- people, computers
- actors, use-cases
- people, classes, and objects
- uses, cases
- scenarios in point form
Aggregation (encapsulation) relationships are represented in the UML notation by
- nesting of classes
- lines with a solid diamond at one end
- lines with a hollow diamond at one end
- lines with an arrow at one end
- lines without an arrow at either end
In which file will the servlets and the security roles of the application will be defined
- Web.xml
- application.xml
- ps.xml
- Actionconfig.xml
The file where the task flows and the page flows of the application is specified
- Map.xml
- Web.xml
- ps.xml
- DynamicContentAliases.xml
Where does the application been first taken in to, when an URL is hit in the browser
- Servlet of the appilcation
- Deployment descriptor of the appln
- Context root of the application
- ps.xml file of the application
In the UML notation, parameterized (generic) classes are represented by
- the normal class representation with a dotted arrow pointing at the template parameter classes
- the normal class representation but shaded grey.
- the normal class representation with a dotted outline and the names of its parameter classes listed on the top right-hand corner.
- the normal class representation with a rectangular box in its top left-hand corner.
- Its a trick question - parameterized classes can't be specified in the UML notation.
In which file will the server side validations will be handled
- Page Handler
- Action Controller
- JSP
- Javascript
Where will the Life Host region of the server be mentioned
- ec_debug.jsp->Configuration->DomainData->LifeHost
- ec_debug.jsp->DomainData->Host.xml
- using wasops
- ec_debug->Jars->Registered Components->DomainData->Host
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?
- The before() method will print 1 2
- The before() method will print 1 2 3
- The before() method will print three numbers, but the order cannot be determined
- The before() method will not compile
- The before() method will throw an exception at runtime
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
<%! int x = 0; %> <%! public void jspInit() { System.out.println(x++); } %> <%= x++ %> <% System.out.println(x); %> <% jspInit(); %>- 0
- 1
- 2
- 3
- 4
- Page does not translate.
Which architecture does PS framework follow
- Hibernate Architecture
- Struts Architecture
- MVC Architecture
- Web Architecture
In the UML notation, parameterized (generic) classes are represented by
- the normal class representation with a dotted arrow pointing at the template parameter classes
- the normal class representation but shaded grey.
- the normal class representation with a dotted outline and the names of its parameter classes listed on the top right-hand corner.
- the normal class representation with a rectangular box in its top left-hand corner.
- Its a trick question - parameterized classes can't be specified in the UML notation.
XML is Case-Sensitive Language
- True
- False
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?
- The before() method will print 1 2
- The before() method will print 1 2 3
- The before() method will print three numbers, but the order cannot be determined
- The before() method will not compile
- The before() method will throw an exception at runtime
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.)
- Change the Carnivore interface to interface Carnivore<E extends Plant> extends Hungry<E> {}
- Change the Herbivore interface to interface Herbivore<E extends Animal> extends Hungry<E> {}
- Change the Sheep class to class Sheep extends Animal implements Herbivore<Plant> { public void munch(Grass x) {} }
- Change the Sheep class to class Sheep extends Plant implements Carnivore<Wolf> { public void munch(Wolf x) {} }
- Change the Wolf class to class Wolf extends Animal implements Herbivore<Grass> { public void munch(Grass x) {} }
- No changes are necessary
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.)
- java.util.HashSet
- java.util.LinkedHashSet
- java.util.List
- java.util.ArrayList
- java.util.Vector
- java.util.PriorityQueue
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.)
- List<List<Integer>> table = new List<List<Integer>>();
- List<List<Integer>> table = new ArrayList<List<Integer>>();
- List<List<Integer>> table = new ArrayList<ArrayList<Integer>>();
- List<List, Integer> table = new List<List, Integer>();
- List<List, Integer> table = new ArrayList<List, Integer>();
- List<List, Integer> table = new ArrayList<ArrayList, Integer>();
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.)
- return new ArrayList<Inn>();
- return new ArrayList<Hotel>();
- return new ArrayList<Object>();
- return new ArrayList<Business>();
Which is true? (Choose all that apply.)
- "X extends Y" is correct if and only if X is a class and Y is an interface
- "X extends Y" is correct if and only if X is an interface and Y is a class
- "X extends Y" is correct if X and Y are either both classes or both interfaces
- "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces