Oloks Ridwan
Quiz by , created more than 1 year ago

JSF

34
0
0
Oloks Ridwan
Created by Oloks Ridwan about 9 years ago
Close

ASPW

Question 1 of 80

1

What is a principal?

Select one of the following:

  • represents an (authenticated) user

  • represents

Explanation

Question 2 of 80

1

What is a role?

Select one of the following:

  • group of principals who share common set of permissions

  • group

Explanation

Question 3 of 80

1

What annotations can be used to specify security privileges?

Select one of the following:

  • @PermitAll
    @DenyAll
    @RolesAllowed
    @DeclareRoles
    @RunAs

  • @PermitAll

Explanation

Question 4 of 80

1

What is the difference between container-managed and application-managed security?
What are the pros and cons of each? When might you choose to use one in preference to the other?

Select one of the following:

  • Pros and cons of application-managed security
    Pro: complete control
    Pro: can fine-tune for performance
    Con: you might forget to put it in a method
    Con: managing site-wide may be a problem

  • Pros and cons of application-managed security

Explanation

Question 5 of 80

1

What is a native query?

Select one of the following:

  • Native Queries are a concise and type-safe way to express queries directly as Java method.

  • Java Method

Explanation

Question 6 of 80

1

Why is using a named query often more efficient than a JPQL query?

Select one of the following:

  • Using named queries may improve code organisation by separating the JPQL query strings from the Java code. It also enforces the use of query parameters rather than embedding literals dynamically into the query string and results in more efficient queries.

  • Using named queries may improve code organisation

Explanation

Question 7 of 80

1

Why is using a named query often more efficient than a JPQL query?

Select one of the following:

  • Using named queries may improve code organization by separating the JPQL query strings from the Java code. It also enforces the use of query parameters rather than embedding literals dynamically into the query string and results in more efficient queries.

  • test

Explanation

Question 8 of 80

1

What is the JPA implementation that we use called? What other implementations are there?

Select one of the following:

  • Hibernate,
    Toplink, we use this for JPA implementation in our coursework
    OpenJPA

  • Toplink, we use this for JPA implementation in our coursework

Explanation

Question 9 of 80

1

What are the pros and cons of using JPQL queries and criteria queries?

Select one of the following:

  • JPQL queries are defined as strings, similarly to SQL. JPA criteria queries, on the other hand, are defined by instantiation of Java objects that represent query elements.
    Advantage of using the criteria API is that errors can be detected earlier, during compilation rather than at runtime. On the other hand, for many developers string based JPQL queries, which are very similar to SQL queries, are easier to use and understand.
    For simple static queries - string based JPQL queries may be preferred.
    For dynamic queries that are built at runtime - the criteria API may be preferred. It is cleaner when using the JPA criteria API, because it eliminates the need for building the query using many string concatenation operations.

  • need for building the query using many string concatenation operations.

Explanation

Question 10 of 80

1

What is a native query?

Select one of the following:

  • Native Queries are a concise and type-safe way to express queries directly as Java method.

  • Java method.

Explanation

Question 11 of 80

1

What is the difference between optimistic and pessimistic transaction locking? Which do we normally use?

Select one of the following:

  • Optimistic locking is applied on transaction commit. Any database object that has to be updated or deleted is checked

  • Any database object that has to be updated or deleted is checked

Explanation

Question 12 of 80

1

What is the relationship between a persistence unit and an entity manager?

Select one of the following:

  • A persistence unit defines a set of all entity classes that are managed by EntityManager
    While The EntityManager is the primary interface used by application developers to interact with the JPA runtime

  • A persistence unit defines a set of all entity classes that are managed by EntityManager

Explanation

Question 13 of 80

1

What is a persistence unit and where are its details usually to be found?

Select one of the following:

  • A persistence-unit provides a convenient way of specifying a set of metadata files, and classes, and jars that contain all classes to be persisted in a grouping.
    To define a persistence-unit you first need to add a file persistence.xml to the META-INF/ directory of your application jar.
    http://www.datanucleus.org/products/datanucleus/jpa/emf.html#persistenceunit

  • A persistence-unit provides a convenient way of specifying a set of metadata files, and classes, and jars that contain all classes to be persisted in a grouping.

Explanation

Question 14 of 80

1

What is a data access object used for?

Select one of the following:

  • The Data Access Object is basically an object or an interface that provides access to an underlying database or any other persistence storage.

  • any other persistence storage.

Explanation

Question 15 of 80

1

What is a named query and what is it useful for?

Select one of the following:

  • A named query is a statically defined query with a predefined unchangeable query string.

  • A named query

Explanation

Question 16 of 80

1

What major effort does JPQL save in comparison with SQL?

Select one of the following:

  • The main difference between JPQL and SQL lies in that the former deals with JPA entities, while the latter deals directly with relational data. As a Java developer, you also maybe interested to learn that using JPQL, unlike SQL/JDBC, eliminates the need for you to use JDBC API from your Java code—the container does all this work for you behind the scenes.

  • The main

Explanation

Question 17 of 80

1

What is JPQL?

Select one of the following:

  • The Java Persistence Query Language (JPQL) is a platform-independent object-oriented query language defined as part of the Java Persistence API (JPA) specification. JPQL is used to make queries against entities stored in a relational database.

  • The Java Persistence Query Language (

Explanation

Question 18 of 80

1

Why is JPQL useful?

Select one of the following:

  • It is platform-independent.

  • its

Explanation

Question 19 of 80

1

What do we mean when we say that an entity is detached?

Select one of the following:

  • A detached entity is an entity which state must not be reflected by the JPA provider.

    In other words, if you change its state (i.e. through setters methods) these changes will not be saved to the underlying database, as the JPA provider doesn't have to "observe" such entities.

  • A detached entity is an entity which state must not be reflected by the JPA provider.

Explanation

Question 20 of 80

1

How do you obtain an entitymanager when operating in each environment

Select one of the following:

  • A container-managed entity manager is obtained in an application through dependency injection or through JNDI lookup. A container-managed entity

    manager requires the use of a JTA transaction. An Application managed entity manager is retrieved through the EntityManagerFactory API.

  • A container-managed entity manager is obtained in an application through dependency injection or through JNDI lookup

Explanation

Question 21 of 80

1

What is an entity manager?

Select one of the following:

  • The EntityManager is the primary interface used by application developers to interact with the JPA runtime.
    The methods of the EntityManager can be divided into the following functional categories:
    • Transaction association.
    • Entity lifecycle management.
    • Entity identity management.
    • Cache management.
    • Query factory.
    • Closing.

  • • Closing.

Explanation

Question 22 of 80

1

Which relationships are by default eager, and which are by default lazy?

Select one of the following:

  • one to one → eager many to many → lazy

  • one to one → eager

Explanation

Question 23 of 80

1

What strategies are available for mapping inheritance relationships in JPA?we have

Select one of the following:

  • 3
    a InheritanceType.SINGLE_TABLE -
    b InheritanceType.TABLE_PER_CLASS
    c InheritanceType.JOINED

  • a InheritanceType.SINGLE_TABLE -

Explanation

Question 24 of 80

1

What do the terms eager and lazy mean in this context?

Select one of the following:

  • It gives a hint to the persistence provider runtime that data should be fetched lazily (only when the application asks for the property) or eagerly (when the entity is initially loaded by the provider).

  • the entity is initially loaded by the provider).

Explanation

Question 25 of 80

1

How do you tell JPA where to store the data that makes up a foreign key? [Be careful!]

Select one of the following:

  • @OneToOne @JoinColumn(name="parent_id", referencedColumnName="ID") private Parent parent; }

  • (name="parent_id", referencedColumnName="ID") private Parent parent; }

Explanation

Question 26 of 80

1

Explain what an HTTP request is

Select one of the following:

  • it is a message from client to server requesting resources

  • requesting resources

Explanation

Question 27 of 80

1

How does an HTTP request travel over a network?

Select one of the following:

  • it is traveling through TCPIP protocol

  • protocol

Explanation

Question 28 of 80

1

Explain what an HTTP response is and its relationship to a request

Select one of the following:

  • It is the message from the server to the client as per the request sent from the client to server.

  • from the client to server.

Explanation

Question 29 of 80

1

Explain what HTTP status codes such as 200 and 404 mean

Select one of the following:

  • 404 code is the status code from the server to the client indicating the resource not found. 200 it is the code from server to client indicating that the request is received successful

  • request is received successful

Explanation

Question 30 of 80

1

What is a mime type and what is its relationship to HTTP messages?

Select one of the following:

  • Multipurpose Internet Mail Extension. The relation between the HTTP and MIME type is MIMIE type is part of HTTP header response

  • The relation between the HTTP and MIME type is MIMIE type is part of HTTP header response

Explanation

Question 31 of 80

1

Why in the WWW might there be more HTTP requests than HTTP responses?

Select one of the following:

  • Because the request might not reach to the server because of network error. or might be the server is switched off.

  • switched off.

Explanation

Question 32 of 80

1

What is the difference between a static web page and a dynamic one?

Select one of the following:

  • Developers generally create static pages with HTML, but use languages like PHP, Javascript, or Actionscript to create dynamic pages. They can also use frameworks like Ruby on Rails, Django, or Flex for dynamic pages. Dynamic languages and frameworks also have the technical capacity to create static Web page content. However, doing so creates source code that is unnecessarily complex for its purpose while being more difficult to maintain

  • html

Explanation

Question 33 of 80

1

How does the content of a dynamic web page get created?

Select one of the following:

  • PHP, Javascript, or Actionscript

  • a

Explanation

Question 34 of 80

1

What are the four architectures for dynamic web applications?

Select one of the following:

  • CGI, server side include, server module and auxiliary server

  • auxiliary server

Explanation

Question 35 of 80

1

Why is the architecture that Java uses the most scalable?

Select one of the following:

  • By adding more auxiliary server

  • by adding more auxiliary server

Explanation

Question 36 of 80

1

Why is the architecture that Java uses the most resilient?

Select one of the following:

  • high availability, fault tolerance

  • ssss

Explanation

Question 37 of 80

1

How can you use Java's architecture to provide an enterprise web application on a global scale

Select one of the following:

  • by adding more web servers and auxiliary server

  • auxiliary server

Explanation

Question 38 of 80

1

What is a servlet?

Select one of the following:

  • min program receive the request from the client and map it to functionality

  • functionality

Explanation

Question 39 of 80

1

What is a JSP?

Select one of the following:

  • java web programming get translated to servlet once received by servlet engine

  • servlet engine

Explanation

Question 40 of 80

1

What is the relationship between a JSP and a servlet?

Select one of the following:

  • JSP is a servlet

  • servlet

Explanation

Question 41 of 80

1

What advantages does Java's servlet programming model have over (a) CGI? (b) PHP?

Select one of the following:

  • threading and at each time CGI has to run a program which is not good practice for OS. The problem of php is in case the module is crashed than the web server is also down

  • The problem of php is in case the module is crashed than the web server is also down

Explanation

Question 42 of 80

1

What is an exception and what is one used for?

Select one of the following:

  • it is used to reporting the error.( exception is an event which occur during the execution of a program, that disrupts the normal flow of the program instructions.

  • ( exception is an event which occur during the execution of a program, that disrupts the normal flow of the program instructions.

Explanation

Question 43 of 80

1

Explain throwing and catching exceptions?

Select one of the following:

  • Creating an object and handing it to the runtime system is called throwing exception. The exception handler chosen is said to catch the exception.

  • Creating an object

Explanation

Question 44 of 80

1

What do we mean when we say that one class inherits from another?

Select one of the following:

  • It is the mechanism where in a new class is derived from existing class. class may inherit or acquire the properties and methods of other class.

  • It is the mechanism where in

Explanation

Question 45 of 80

1

If an application had classes Person, StaffMember and Student, how might they be related?

Select one of the following:

  • StaffMember and Student are sub class of Person

  • Person

Explanation

Question 46 of 80

1

java.util and jim.sums.entities are examples of what?

Select one of the following:

  • packages

  • p

Explanation

Question 47 of 80

1

What is the difference between a field that is private, protected or public?

Select one of the following:

  • Private:- filed it can be use within the class and it can not be used outside the class
    protected:- visible only to the class where it is declared and to subclasses
    public:- it is visible to all class, subclass and packages

  • packages

Explanation

Question 48 of 80

1

What does static mean when associated with a class's fields or methods? it is a variable which is not changed wherever it called or used

Select one of the following:

  • it is a variable which is not changed wherever it called or used

  • used

Explanation

Question 49 of 80

1

Explain what the classes/interfaces Collection, Set, List, ArrayList and Vector represent and what are the distinctions between them?

Select one of the following:

  • A Collection represents a group of objects known as its elements. The Collection interface is used to pass around collections of objects where maximum generality is desired.
    A Set is a Collection that cannot contain duplicate elements.
    A List is an ordered Collection (sometimes called a sequence). Lists may contain duplicate elements.
    Array List:- general purpose implementation list which is usually the best performing implementation

  • e

Explanation

Question 50 of 80

1

What is a Map

Select one of the following:

  • A Map is an object that maps keys to values

  • values

Explanation

Question 51 of 80

1

What does the declaration Map<String, Person> represent?

Select one of the following:

  • mapping from string to person

  • w

Explanation

Question 52 of 80

1

What is a facelet?

Select one of the following:

  • it is part of java server written in xml

  • xml

Explanation

Question 53 of 80

1

What is a managed bean?

Select one of the following:

  • it is a class with constructor and getter and setter. Also it is JSF controller

  • Also it is JSF controller

Explanation

Question 54 of 80

1

What is meant by the scope of a managed bean?

Select one of the following:

  • it is mean the lifetime of the object

  • lifetime of the object

Explanation

Question 55 of 80

1

What are the available scopes to choose from?

Select one of the following:

  • Session scope:- (session end when its timeout)
    Request scope:- start when request started and end after request is received
    Application scope:-
    View scope:-

  • start when request

Explanation

Question 56 of 80

1

Which scope is the default?

Select one of the following:

  • in JAVA EE6 is request scope, in JAVA EE7 is non scoped

  • JAVA EE6

Explanation

Question 57 of 80

1

Give at least 10 examples of how different HTML controls can be represented using facelet tags

Select one of the following:

  • h:inputText , h:inputHidden, h:inputSecret, h:inputTextarea, h:link, h:commandButton, h:button, h:form, h:panelGrid , h:dataTable

  • h:inputText

Explanation

Question 58 of 80

1

What do the properties of a managed bean represent?

Select one of the following:

  • the data which can be share between view and controller

  • controller

Explanation

Question 59 of 80

1

What notation is used in a facelet to associate a property or method with a control?

Select one of the following:

  • expression language #

  • &&

Explanation

Question 60 of 80

1

Why is JSF superior to JSP?

Select one of the following:

  • jsp is not supported MVC pattern fully, while jsf is fully supported for JSF

  • upported for JSF

Explanation

Question 61 of 80

1

What are the 3 types of session bean?

Select one of the following:

  • stateless, stateful and Singleton

  • Singleton

Explanation

Question 62 of 80

1

In what circumstances would you use each of the 3 types?

Select one of the following:

  • stateful: The bean needs to hold information about the client across method invocations.
    stateless:- The bean’s state has no data for a specific client.
    Singleton:-State needs to be shared across the application.

  • Singleton:-State needs to be shared across the application.

Explanation

Question 63 of 80

1

Which of the 3 types is most commonly used?

Select one of the following:

  • stateless

  • l

Explanation

Question 64 of 80

1

What is the difference between a session bean and a message bean?

Select one of the following:

  • message bean used to deal with messages while session beans used in business logic to interact with database

  • database

Explanation

Question 65 of 80

1

What is dependency injection?

Select one of the following:

  • Dependency injection (DI) is the concept of providing an external dependency to a specific resource, generally by a Java EE container It enables you to provide a set of services to Java EE components

  • Java EE components

Explanation

Question 66 of 80

1

Who or what does the injecting?

Select one of the following:

  • Who=java EE container, what= @EJB

  • ll

Explanation

Question 67 of 80

1

What annotation is normally used for dependency injection?

Select one of the following:

  • @EJB

  • l

Explanation

Question 68 of 80

1

How would you specify the start and end of a transaction in a stateful EJB? BY using

Select one of the following:

  • @REMOVE annotation

  • @REMOVE annotationl

Explanation

Question 69 of 80

1

What annotations can be used to control what happens when an EJB is created or destroyed? @PreDestroy @PostConstruct

Select one of the following:

  • destroyed? @PreDestroy @PostConstruct

  • @PostConstruct

Explanation

Question 70 of 80

1

What is the timer service used for?

Select one of the following:

  • Enables you to schedule timed notifications for all types of enterprise beans except for stateful session beans. You can schedule a timed notification to occur according to a calendar schedule, at a specific time, after a duration of time, or at timed. How to use it? intervals.timerService.createSingleActionTimer(duration, new TimerConfig());

  • TimerConfig());

Explanation

Question 71 of 80

1

What is the difference between a local interface, a remote interface and a no-interface view?

Select one of the following:

  • When EJB does not explicitly specify as interface type it is assume to be local otherwise it is remote. @localBean @remoteBean No -Interface :Is almost same as local client view, but there are differences. Your bean class is not required to implement client view interfaces in this case. All public methods of the bean class are automatically exposed to the caller. no-interface view always acquires an EJB reference

  • l

Explanation

Question 72 of 80

1

What do we mean by pooling beans?

Select one of the following:

  • There's a limited number of beans in a pool and the container picks instances from the pool to serve requests as they come.

  • picks instances from the pool to serve requests as they come.

Explanation

Question 73 of 80

1

What is an entity bean?

Select one of the following:

  • Mapping object to database, representing business object

  • object

Explanation

Question 74 of 80

1

How do you make a bean an entity bean?

Select one of the following:

  • @enitity annotation

  • by

Explanation

Question 75 of 80

1

What does the @Id annotation do?

Select one of the following:

  • is the annotation used to specify primary key

  • primary key

Explanation

Question 76 of 80

1

What annotation is used to denote a composite primary key?

Select one of the following:

  • @embeddedID

  • @

Explanation

Question 77 of 80

1

Under what particular circumstances would you have to use the @Column and/or @Table annotations?

Select one of the following:

  • when the database column not match the entity class column

  • entity class column

Explanation

Question 78 of 80

1

Explain what is meant by a unidirectional relationship and a bidirectional relationship?

Select one of the following:

  • In a unidirectional relationship, only one entity has a relationship field or property that refers to the other. For example, LineItem would have a relationship field that identifies Product, but Product would not have a relationship field or property for LineItem. In other words,LineItem knows about Product, but Product doesn’t know which LineItem instances refer to it.
    while in a bidirectional relationship, each entity has a relationship field or property that refers to the other entity. Through the relationship field or property, an entity class’s code can access its related object. If an entity has a related field, the entity is said to “know” about its related object. For example, if Order knows what LineItem instances it has and if LineItem knows what Order it belongs to, they have a bidirectional relationship.

  • relationship,

Explanation

Question 79 of 80

1

What are the annotations used to specify the chosen inheritance strategy? Where must those annotations be placed?

Select one of the following:

  • @inheritence Before the constructor class.

  • constructor class.

Explanation

Question 80 of 80

1

How do you get JPA to arrange your lists in the right order?

Select one of the following:

  • @orderBySource

  • Source

Explanation