1Z0-850 | Verified Java 1Z0-850 exam


Q31. - (Topic 2) 

Given: 

1.

 class Exam { 

2.

 private int num = 0; 

3.

 public int getNum() { 

4.

 return num; 

5.

 } 

6.

 } 

7.

 public class Sample { 

8.

 public static void main(String[] args) { 

9.

 Exam e = new Exam(); 

10.

 e.num = 100; 

11.

 int num = e.getNum(); 

12.

 System.out.println("The number is: " + num); 

13.

 } 

14.

 } 

What is the result? 

A. The number is: 100 

B. Compilation fails. 

C. The number is: 0 

D. An exception is thrown at runtime. 

Answer:

Q32. - (Topic 1) 

Given concrete class B is a subclass of concrete class A, and class A implements interface C, which two are examples of polymorphism? (Choose two.) 

A. use a reference variable of type C to refer to an instance of type B 

B. use a reference variable of type A to refer to an instance of type C 

C. use a reference variable of type C to refer to an instance of type A 

D. use a reference variable of type A to refer to an instance of type B 

E. use a reference variable of type B to refer to an instance of type A 

Answer: A,C 

Q33. - (Topic 1) 

Which Java technology provides a unified interface to multiple naming and directory services? 

A. JNI 

B. EJB 

C. JDBC 

D. JNDI 

E. JavaMail 

Answer:

Q34. - (Topic 2) 

Which three are provided by the EJB tier in a multitier J2EE application? (Choose three.) 

A. dynamic content generation 

B. XML parsing 

C. transaction management 

D. security 

E. concurrency control 

Answer: C,D,E 

Q35. - (Topic 1) 

Which two are true? (Choose two.) 

A. J2EE runs on consumer and embedded devices. 

B. J2EE includes the MIDP API. 

C. J2EE includes servlet APIs and EJB APIs. 

D. J2EE application developers need J2SE. 

E. J2EE applications depend on web servers. 

Answer: C,D 

Q36. - (Topic 1) 

Given: 

1.

 class Test2 { 

2.

 static String setMessage(String str) { 

3.

 return str + "How are you doing?"; 

4.

 } 

5. 

6.

 public static void main(String[] args) { 

7.

 String str = "Hello! "; 

8.

 str = setMessage(str); 

9.

 System.out.println("str : " + str); 

10.

 } 

11.

 } 

What is the result? 

A. str : Hello! How are you doing? 

B. Compilation fails because of an error at line 7. 

C. Compilation fails because of an error at line 8. 

D. Compilation fails because of an error at line 2. 

E. Compilation fails because of an error at line 3. 

F. str : Hello! 

G. str : How are you doing? 

Answer:

Q37. - (Topic 1) 

Given: 

6.

 int time = 12; 

7.

 if ( time < 12 ) { 

8.

 System.out.println("Good morning"); 

9.

 } 

10.

 // insert code here 

11.

 System.out.println("Good afternoon"); 

12.

 } 

13.

 else if ( time >= 18 ) { 

14.

 System.out.println("Good evening"); 

15.

 } 

Which three, inserted independently at line 10, produce the output Good afternoon? (Choose three.) 

A. else if ( time < 12 || time > 18) { 

B. if ( time >= 12 && time < 18 ) { 

C. else if ( time > 12 && time >= 18 ) { 

D. else if ( time >= 12 || time < 18 ) { 

E. else if ( time > 12 || time <= 18 ) { 

Answer: B,D,E 

Q38. - (Topic 1) 

Given: 

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? 

A. Compilation fails because of an error at line 10. 

B. Compilation fails because of an error at line 8. 

C. x = 53 , y = 97 

D. Compilation fails because of an error at line 9. 

E. Compilation fails because of an error at line 11. 

F. x = 3 , y = 7 

Answer:

Q39. - (Topic 1) 

Which is true about MIDlets? 

A. MIDlet devices are not required to allow applications to be uninstalled. 

B. The only API used to create MIDlets is the MIDP API. 

C. Devices that support MIDlets must allow the MIDlets to access the device's low-level functions. 

D. Devices that run MIDlets must provide software that manages wireless downloading of applications. 

Answer:

Q40. - (Topic 1) 

Which three are responsibilties of the business tier in a multitier web-based application with web, business, and EIS tiers? (Choose three.) 

A. to integrate with legacy applications 

B. to provide business logic 

C. to generate dynamic content 

D. to participate in transactions 

E. to process requests from web-based clients 

Answer: A,B,D