반응형
자격증/OCJP_ExamA2018. 7. 8. 20:06QUESTION 53

QUESTION 53 A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company's old printers, but the new wireless printers ..

자격증/OCJP_ExamA2018. 7. 8. 19:43QUESTION 52

QUESTION 52 Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The variable first is set to null. D. The variable first is set to elements[0]. Solution : D String 배열인 elements 는 총 3개의 방에 각각 값이 들어가 있으며 , length또한 0보다 크다 , 고로 elements[0] 만약 elements.length ..

자격증/OCJP_ExamA2018. 7. 8. 19:36QUESTION 51

QUESTION 51 Given two files: GrizzlyBear.java and Salmon.java 1. package animals.mammals; 2. 3. public class GrizzlyBear extends Bear { 4. void hunt() { 5. Salmon s = findSalmon(); 6. s.consume(); 7. } 8. } 1. package animals.fish; 2. 3. public class Salmon extends Fish { 4. public void consume() { /* do stuff */ } 5. } If both classes are in the correct directories for their packages, and the M..

자격증/OCJP_ExamA2018. 7. 8. 19:18QUESTION 50

QUESTION 50 Given: 1. interface Animal { void makeNoise(); } 2. class Horse implements Animal { 3. Long weight = 1200L; 4. public void makeNoise() { System.out.println("whinny"); } 5. } 6. 7. public class Icelandic extends Horse { 8. public void makeNoise() { System.out.println("vinny"); } 9. public static void main(String[] args) { 10. Icelandic i1 = new Icelandic(); 11. Icelandic i2 = new Icel..

자격증/OCJP_ExamA2018. 7. 8. 19:14QUESTION 49

QUESTION 49 Given: 1. public class Pass { 2. public static void main(String [] args) { 3. int x = 5; 4. Pass p = new Pass(); 5. p.doStuff(x); 6. System.out.print(" main x = " + x); 7. } 8. 9. void doStuff(int x) { 10. System.out.print(" doStuff x = " + x++); 11. } 12. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. doStuff x = 6 main x = 6 D. doStuff x = 5 ma..

자격증/OCJP_ExamA2018. 7. 8. 19:08QUESTION 48

QUESTION 48 Given: public class Yippee { public static void main(String [] args) { for(int x = 1; x < args.length; x++) { System.out.print(args[x] + " "); } } } and two separate command line invocations: java Yippee java Yippee 1 2 3 4 What is the result? A. No output is produced. 1 2 3 B. No output is produced. 2 3 4 C. No output is produced. 1 2 3 4 D. An exception is thrown at runtime. 1 2 3 ..

반응형
image