TP
Publicado por Cristian (1 intervención) el 20/10/2020 00:12:38
BUENAS TARDES, TENGO QUE RESOLVER UNOS EJERCICIOS, ME PODRIAN DAR UNA MANO?
1. Write a simple code to solve the following problem: Given a group of letters, print all existing acronyms. For example: {a,b,c} => abc; acb; bac; bca; cab; cba
2. When do you think it’s more appropriate to use JDBC instead of JPA?
3. Given the class “Parent” below, create a class “Child” that extends Parent, overrides method “calcularMultiplicacao” and overloads method “concatenarFrases”.
4. Given the method below, explain:
a. Why is the close()methodof class Repositorio being called inside finally?
b. The above code is wrong. What would you change in it to make it right? What other improvements could you suggestto make it even better?
5. What will be the result of execution of the code below:
6. Considering the following example of the a4j:support usage, answer the below question:
The a4j:support tag and its attributes are used to allow UI components to execute Ajax actions. Describe a real situation when you would use this tag and explain why.
1. Write a simple code to solve the following problem: Given a group of letters, print all existing acronyms. For example: {a,b,c} => abc; acb; bac; bca; cab; cba
2. When do you think it’s more appropriate to use JDBC instead of JPA?
3. Given the class “Parent” below, create a class “Child” that extends Parent, overrides method “calcularMultiplicacao” and overloads method “concatenarFrases”.
1
2
3
4
5
6
7
8
9
10
publicclass Parent {
public String concatenarFrases(String f1, String f2){
return f1 + f2;
}
publicint calcularMultiplicacao(int fator1, int fator2){
return fator1 * fator2;
}
}
4. Given the method below, explain:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public List<Alunos> readAlunos() {
Repositorio alunoRepository = new Repositorio();
try {
alunoRepository.setConnection(datasource.getConnection());
List<Alunos> listaAlunos =alunoRepository.readListaAlunos();
returnlistaAlunos;
} catch (Exception ex) {
thrownew EJBException(ex);
} catch (SQLException ex) {
thrownewDatabaseException(ex);
} finally {
alunoRepository.close();
}
}
a. Why is the close()methodof class Repositorio being called inside finally?
b. The above code is wrong. What would you change in it to make it right? What other improvements could you suggestto make it even better?
5. What will be the result of execution of the code below:
1
2
3
4
5
6
7
8
9
10
11
public class TesteFujitsu() {
publicstaticvoidmain(String[] args) {
int i = 2;
if (i++ <= 3 && ++i > 4)
i = 3;
System.out.println(i);
}
}
6. Considering the following example of the a4j:support usage, answer the below question:
1
2
3
4
5
6
7
<h:outputLink value="#">
<a4j:supportreRender="component1, component2"
limitToList="true"event="onclick"
ajaxSingle="true
action="#{managedBean.method}">
</a4j:support>
</h:outputLink>
The a4j:support tag and its attributes are used to allow UI components to execute Ajax actions. Describe a real situation when you would use this tag and explain why.
Valora esta pregunta


-1