Java Magazine, July/August 2017
ORACLE COM JAVAMAGAZINE JULY AUGUST 2017 47 fix this These questions simulate the level of dificulty of two different certification tests Those marked intermediate correspond to questions from the Oracle Certified Associate exam which contains material for a preliminary level of certification Questions marked advanced come from the 1Z0 809 Programmer II exam which is the certification test for developers who have been certified at a basic level of Java 8 programming knowledge and now are looking to demonstrate more advanced expertise Let me re emphasize that these questions rely on Java 8 Ill begin covering Java 9 in a future column and will make that transition quite clear when it occurs Question 1 intermediate Given this code interface ParentIF interface ChildIF extends ParentIF interface OtherIF class ParentCL class ChildCL extends ParentCL class OtherCL and this code ChildIF cI null ParentIF pI null OtherIF oI null ChildCL cC null ParentCL pC null OtherCL oC null cI ChildIF oI line n1 cC ChildCL pC line n2 cC ChildCL oC line n3 cI ChildIF oC line n4 Which is true Choose one a Line n1 and line n3 both fail to compile b The casts are unnecessary in both line n1 and line n3 c Line n3 fails to compile d The casts are unnecessary in both line n2 and line n4 e Line n4 fails to compile Question 2 intermediate Given the following class P private int value line n1 public P int v value v class S extends P private int value line n2 public S int v int u line n3 value u SIMON ROBERTS Quiz Yourself Intermediate and advanced test questions
You must have JavaScript enabled to view digital editions.