Test
java
Crea una cuenta gratis para terminar este test
Guarda tu progreso y consulta tu resultado final.
¿Ya tienes cuenta? Inicia sesión
Preguntas del test (30)
1Which two are true? (Choose two.)
- AJ2EE runs on consumer and embedded devices.
- BJ2EE includes the MIDP API.
- CJ2EE includes servlet APIs and EJB APIs.
- DJ2EE application developers need J2SE.
- EJ2EE applications depend on web servers.
2Which two are associated with the web tier in a J2EE web-based application? (Choose two.)
- Aservlets
- BJAX-RPC
- CJMS
- Dentity beans
- EJSP
3Given:
1.class Test{
2.public static void main(String args[]){
3.int num1 = 10, num2=20, result;
4.result =calc (num1,num2);
5.System.out.println(result);
6.}
7.
8.//insert code here
9.}
Which, inserted at line 8, produces the output 30?- Astatic int calc(int n1, int n2) { return; }
- Bpublic int calc(int n1, int n2) { return n1 + n2; }
- Cpublic int calc(int n1, int n2) { return; }
- Dstatic int calc(int n1, int n2) { return n1 + n2; }
- Estatic void calc(n1, n2) { return (n1 + n2); }
- Fstatic int calc(int n1, n2) { return n1, n2; };
4Given:
1.public abstract class Wow{
2.private int wow;
3.public Wow( int wow ) {
4.this.wow=wow;
5.}
6.public void wow(){}
7.private void wow za () {}
8.}
Which is true about the class Wow?- AIt does NOT compile because an abstract class must have at least one abstract method.
- BIt does NOT compile because an abstract class CANNOT have instance variables.
- CIt compiles without error.
- DIt does NOT compile because an abstract class CANNOT have private methods.
- EIt does NOT compile because an abstract class must have a constructor with no arguments
5Given:
1.class X{
2.private Y y;
3.public X (Y y) {this.y = y;}
4.}
5.class Y{
6.private X x;
7.public Y () {}
8.public Y ( X x ){this.x = x;}
9.}
The instance variable y is intended to represent the composition relationship “X is composed of Y.”
Which code correctly maintains this meaning?- AX x1 = new X(newY());
X x2 = new X(new Y()); - BX xx =new X(null);
Y y1= new Y(xx);
Y y2 = new Y(xx); - CY yy = new Y();
Xx1=newX(yy);
X x2 = new X(yy); - DY y1 = new Y(newX(null));
Y y2 = new Y(new X(null));
- AX x1 = new X(newY());
6You have developed a MIDlet that runs on a Java-enabled Personal Digital Assistant (PDA)
device. Now, your employer has asked you to port the MIDlet to run on other Java platforms.
Which is true?- AThe MIDlet is 100% portable across all J2ME devices.
- BThe MIDlet can run within a standard web browser.
- CThe MIDlet is guaranteed to run correctly under J2SE.
- DThe MIDlet is NOT guaranteed to run on a Java technology-enabled phone.
7Which statement is true?
- AJMS enables an application to provide flexible, asynchronous data exchange.
- BJMS provides interfaces to naming and directory services.
- CThe JMS API is located in the java.jms package.
- DJMS enables an application to provide tightly coupled, distributed communication.
8Which two are true about stateless session beans? (Choose two.)
- AThey are used to represent data stored in an RDBMS.
- BThey implement the JMS API
- CThey are used to implement business logic
- DThey CANNOT hold client state
9Which two are true about javax.swing? (Choose two.)
- AIt includes classes for creating buttons and panels
- BIt is used to create MIDlets.
- CIt is used to create applications that have the same user interface on different platforms.
- DIt uses the native GUI components of each platform
10Refer to the Exhibit.
Which relationships, referenced by the class names involved, are drawn using valid UML notation?
- AAB, AC, BD, and CD
- Bonly AC, BD, and CD
- Conly AB, AC, and BD
- Donly AB and AC
- Eonly BD and CD
11Which type of J2EE component is used to store business data persistently?
- Astateless session beans
- BJavaBeans
- Cstateful session beans
- Dentity beans
- EJavaServer Pages
12What is the purpose of JNDI?
- Ato access native code from a Java application
- Bto parse XML documents
- Cto access various directory services using a single interface
- Dto register Java Web Start applications with a web server
13Which two are true about HTML? (Choose two.)
- AHTML can set up hypertext links between documents
- BHTML uses tags to structure text into headings, paragraphs, and lists.
- CHTML is an object-oriented programming language.
- DHTML documents CANNOT be browsed by a text editor
14Given:
4. class Example {
5. int x = 50;
6. int y = 100;
7. public static void main(String args[]) {
8. int x = 0, y = 10;
9. Example ex = new Example();
10. while (x < 3) {
11. x++; y–;
12. }
13. System.out.println(“x = ” + x + ” , y = ” + y);
14. }
15. }
What is the result?- ACompilation fails because of an error at line 8.
- Bx = 3 , y = 7
- CCompilation fails because of an error at line 11.
- DCompilation fails because of an error at line 9
- Ex = 53 , y = 97
- FCompilation fails because of an error at line 10.
15Given:
12. String s = “abcdefgabc”;
13. char c = s.charAt(2);
14.
15. if (c == ‘c’)
16. s = s.replace(‘c’, ‘X’);
17. else if (c == ‘b’)
18. s = s.replace(‘b’, ‘O’);
19. Else
20. s = s.replace(‘c’, ‘O’);
21. System.out.println(s);
What is the result?- AaOcdefgabc
- BCompilation fails
- CabOdefgabc
- DabXdefgabc
- EabOdefgabO
- F. aOcdefgaOc
- GabXdefgabX
16Which package contains classes used to create data collections, such as maps or queues?
- Ajava.lang
- Bjava.io
- Cjava.awt
- Djava.net
- Ejavax.swing
- Fjava.util
17Given:
1. interface A { }
2. interface B { void b(); }
3. interface C { public void c(); }
4. abstract class D implements A,B,C { }
5. class E extends D {
6. void b() { }
7. public void c() { }
8. }
Which is true?- ACompilation fails due to an error in line 6
- BThe code compiles without error
- CCompilation fails due to an error in line 2
- DCompilation fails due to an error in line 4
- ECompilation fails due to an error in line 1.
18What type of relationship is needed to represent the relationship between students and the
courses they are enrolled in at a university?- Aa one-to-one composition
- Ba one-to-one association
- Ca many-to-many composition
- Da one-to-many composition
- Ea one-to-many association
- Fa many-to-many associatio
19Which two are features of JNDI? (Choose two.)
- Aan interface to store and retrieve named Java objects of any type
- Ban interface to search for objects using attributes
- Ca defined common set of messaging concepts and programming strategies
- Dconnectivity to databases and other tabular data sources
20You need to create a class that maintains a customer’s account balance. The class must allow both credits (deposits) and debits (withdrawals) to the account. Which class correctly implements this functionality?
- Apublic class Account {
double balance;
public void debit(double amount) {
amount = balance – amount;
}
public void credit(double amount) {
amount = balance + amount;
} - Bpublic class Account {
double balance;
public void debit(double amount) {
balance = balance – amount;
}
public void credit(double amount) {
balance = balance + amount;
} - Cpublic class Account {
double balance;
balance = balance – amount;
}
public void credit(double amount) {
double balance;
balance = balance + amount;
} - Dpublic class Account {
public void debit(double amount) {
double balance;
balance = balance – amount;
}
public void credit(double amount) {
double balance;
balance = balance + amount;
} - Epublic class Account {
double balance;
public void debit() {
double debit;
balance = balance – debit;
}
public void credit() {
double credit
balance = balance + credit;
}
- Apublic class Account {
21Which two are associated with the web tier in a multitier web-based application? (Choose two.)
- Agenerate dynamic content
- Bimplement business logic
- Cprocess user input
- Dintegrate with database systems
- Estore state persistently
22Refer to the Exhibit.
Which correctly implements the relationships shown in the diagram?
- Apublic class Y {
private Z[] z1and2;
public Y(Z[] z1and2) {
if (z1and2 == null || z1and2.length != 2) {
System.exit(1); // ERROR!
}
this.z1and2 = z1and2;
} - Bpublic class Z {
private Y[] y1and2;
public Z(Y[] y1and2) {
if (y1and2 == null || y1and2.length != 2) {
System.exit(1); // ERROR!
}
this.y1and2 = y1and2;
} - Cpublic class Z {
private Y y1;
private Y y2;
public Z(Y y1) {
if (y1 == null) System.exit(1); // ERROR!
this.y1 = y1;
}
public Z(Y y1, Y y2) {
this(y1);
this.y2 = y2;
} - Dpublic class Y {
private Z z1;
private Z z2;
public Y(Z z1) {
if (z1 == null) System.exit(1); // ERROR!
this.z1 = z1;
}
public Y(Z z1, Z z2) {
this(z1);
this.z2 = z2;
}
- Apublic class Y {
23Which is a benefit of Swing clients?
- AThey can be used without a JRE on the client.
- BThey are more universally supported by browsers than thin clients
- CThey can provide a richer graphical user interface experience than thin clients.
- DThey are easier to deploy than thin clients.
24Given:
1. class Test {
2. public static void main(String args[]) {
3. int num;
4. num = 10;
5. calc(num);
6. System.out.println(“num = ” + num);
7. }
8.
9. static void calc(int num) { 1
0. num += 100; 11. } 12. }
What is the result?- Anum = 10
- Bnum = 100
- CCompilation fails because of an error at line 3
- Dnum = 110
- ECompilation fails because of an error at line 9.
25Given:
1. abstract class A {}
2. class B {}
3. interface C {}
4. interface D {}
5. // insert code here
Which, inserted at line 5, results in a compilation failure?- Aclass E implements C {}
- Bclass E extends B implements D {}
- Cclass E extends A {}
- Dinterface E extends C, D {}
- Eclass E extends A, B {}
- Fclass E implements C, D {}
26Why should package names in Java be unique?
- Ato provide the Internet location from which the package can be downloaded
- Bto programatically declare specific ownership of classes in the package
- Cto avoid class name conflicts if two development groups use the same package and class
names - Dto allow classes in the package to be accessed by classes outside of that package
27Given:
18. String s = ” abcdcba “;
19. int x = 2;
20. s = s.trim();
21. if (s.length() < 8) {
22. x = s.indexOf(‘c’, 3);
23. }
24. System.out.println(“x = ” + x);
What is the result?- Ax = 5
- Bx = 3
- Cx = 6
- Dx = 4
- Ex = 2
28Given:
3. int calc() {
4. long x = 40L;
5. int i = 30;
6. i = x;
7. System.out.println(“result is: ” + i);
8. }
What is the result of calling calc()?- ACompilation fails because of an error at line 6
- BCompilation fails because of an error at line 4
- Cresult is: 40
- Dresult is: 30
29Which is an appropriate description of session beans?
- AThey are used to store persistent data.
- BThey are used to implement business processes
- CThey are used to represent data in an RDBMS
- DThey are used to share data among clients
30Which is NOT associated with the web tier in a J2EE web-based application?
- AJavaMail
- BHTML
- Cmessage-driven beans
- DJNDI
- EJavaBeans
Información
- Descripción
- Test sobre java, creado por Rodd Moran el 15/03/2016.
- Autor
- Rodd Moran
- Idioma
- Español
- Visitas
- 1
- Historial
- Creado el 15 mar 2016 · actualizado el 6 abr 2016
- Valoración
- Aún sin valoraciones Valora este test