별의 공부 블로그 🧑🏻‍💻

🗒️ 2017/08 (31)

728x90
  1. 2017.08.31 scanf와 ' '(공백)

    I wonder why scanf wants to get one more than the number of 'num' when I use this function for array index with infinite loop. 5 // The number of the index of an array. 1 2 3 4 5 // I put 5 numbers because I set the number of the index as 5. but.. 6 // I had to put another number to finish the work of scanf. 1 2 3 4 5 // The numbers in the array. 6 has disappeared. Here is a code that I made to ..

  2. 2017.08.29 최대공약수 (The Greatest Common Denominator(GCD)), 최소공배수(The Least(Lowest) Common Multiple(LCM))

    *최대공약수 (The Greatest Common Denominator(GCD)), 최소공배수(The Least(Lowest) Common Multiple(LCM)) # Algorithm 1 : 간단한 방법(Simple Way)을 이용한 최대공약수(GCD) 구하기 1 2 3 4 5 6 int min(int a, int b) { if (a > b) return b; else if (a =1; g--) if ((m % g == 0) && (n % g == 0)) return g; } Colored by Color Scripter cs # Algorithm 2 : 유클리드 호제법(Euclidean Algorithm)을 이용한 최대공약수(GCD) 구하기 1 2 3 4 5 6 7 8 9 10 11 12 13 14..

  3. 2017.08.29 알고리즘이란?

    *알고리즘이란? - 알고리즘(algorithm) : 주어진 문제를 해결하는 절차(procedure) - 각 단계는 기본적인 연산(operation) 하나로 이루어져 있을 수도 있고, 혹은 다른 부분 문제(subproblem)에 대한 알고리즘일 수는 있찌만 충분히 구체적이어야 함. - 일반적으로 알고리즘은 다음의 두 조건을 반드시 만족해야 함. 종료(termination) : 모든 가능한 입력 사례에 대하여 반드시 끝난다. 정확성(correctness) : 모든 가능한 입력 사례에 대하여 옳은 답을 출력한다. - 가능한 입력에 대하여 항상 종료하고 옳은 답을 출력하면 알고리즘이 되지만, 실행시간이 빠르고 또한 메모리를 적게 쓰는 알고리즘을 선호하게 됨. - 다시 말하면 자원(resource)을 적게 쓰는 ..

  4. 2017.08.29 C/C++ Language and Standard Libraries (Visual Studio 2015)

    This section of the documentation includes guidelines and reference content for the Microsoft implementation of the ISO standards for C and C++. Title Description Welcome Back to C++ Describes modern C++ programming idioms and best practices. C/C++ Languages Reference content for the C and C++ languages. C Run-Time Library Reference Reference content for the Microsoft implementation of the C run..

  5. 2017.08.15 [1Z0-851E] Question 21~30

    QUESTION 21 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 22 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 23 Select and Place: Correct Answer: Section: (none) Explanation Explanation/Reference: QUESTION 24 Place the correct description of the compiler output on the code fragments to be inserted at lines 4 ..

  6. 2017.08.15 [1Z0-851E] Question 11~20

    QUESTION 11 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 12 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 13 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 14 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 15 Select and..

  7. 2017.08.15 [1Z0-851E] Question 01~10

    QUESTION 1 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: package alpha; public class Alpha { protected String alpha; public Alpha() { this("A"); } protected Alpha(String a) { alpha = a;} } package beta; public class Beta extends alpha.Alpha { public Beta(String a) { super(a); } } QUESTION 2 Place the Relations on their corresponding Implementation Structures. ..

  8. 2017.08.13 [Textbook] Common Lisp: A Gentle Introduction to Symbolic Computation

    Common Lisp: A Gentle Introduction to Symbolic Computation David S. Touretzky This book, with minor revisions, is back in print from Dover Publications and can be purchased in paperback form at Amazon.com, Barnes& Noble, etc. An e-book version will be released in late February, 2013. Free software accompanying the book is also available. This 1990 edition may be distributed in hardcopy form, for..

  9. 2017.08.13 [1Z0-851D] Question 41~50

    QUESTION 41 Given: 1. public class Venus { 2. public static void main(String[] args) { 3. int[] x = { 1, 2, 3 }; 4. int y[] = { 4, 5, 6 }; 5. new Venus().go(x, y); 6. } 7. 8. void go(int[]... z) { 9. for (int[] a : z) 10. System.out.print(a[0]); 11. } 12. } What is the result? A. 1 B. 12 C. 14 D. 123 E. Compilation fails. F. An exception is thrown at runtime. Correct Answer: C Section: All Expla..

  10. 2017.08.13 [1Z0-851D] Question 31~40

    QUESTION 31 Click the Exhibit button. 1. import java.util.*; 2. public class TestSet{ 3. enum Example {ONE, TWO, THREE } 4. public static void main(String[] args) { 5. Collection coll = new ArrayList(); 6. coll.add(Example.THREE); 7. coll.add(Example.THREE); 8. coll.add(Example.THREE); 9. coll.add(Example.TWO); 10. coll.add(Example.TWO); 11. coll.add(Example.ONE); 12. Set set = new HashSet(coll)..

  11. 2017.08.13 [1Z0-851D] Question 21~30

    QUESTION 21 A team of programmers is involved in reviewing a proposed design for a new utility class. After some discussion, they realize that the current design allows other classes to access methods in the utility class that should be accessible only to methods within the utility class itself. What design issue has the team discovered? A. Tight coupling B. Low cohesion C. High cohesion D. Loos..

  12. 2017.08.13 [1Z0-851D] Question 11~20

    QUESTION 11 Given: 1. public class TestOne { 2. public static void main (String[] args) throws Exception { 3. Thread.sleep(3000); 4. System.out.println("sleep"); 5. } 6. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The code executes normally and prints "sleep". D. The code executes normally, but nothing is printed. Correct Answer: C Section: All Explanatio..

  13. 2017.08.13 [1Z0-851D] Question 01~10

    QUESTION 1 Given: 33. Date d = new Date(0); 34. String ds = "December 15, 2004"; 35. // insert code here 36. try { 37. d = df.parse(ds); 38. } 39. catch(ParseException e) { 40. System.out.println("Unable to parse " + ds); 41. } 42. // insert code here too What creates the appropriate DateFormat object and adds a day to the Date object? A. 35. DateFormat df = DateFormat.getDateFormat(); 42. d.set..

  14. 2017.08.12 [1Z0-851C] Question 51~60

    QUESTION 51 Given classes defined in two different files: package packageA; public class Message { String getText() { return "text"; } } And: package packageB; public class XMLMessage extends packageA.Message { String getText() { return "text"; } public static void main(String[] args) { System.out.println(new XMLMessage().getText()); } } What is the result of executing XMLMessage.main? A. text B..

  15. 2017.08.12 [1Z0-851C] Question 41~50

    QUESTION 41 Given: public static void main(String[] args) { for (int i = 0; i 6) break; } System.out.println(i); } What is the result? A. 6 B. 7 C. 10 D. 11 E. Compilation fails. F. An exception is thrown at runtime. Correct Answer: E Section: All Explanation Explanation/Reference: i varaible is not visible. QUESTION 42 Given: 11. class X { public void foo() { System.out.print("X "); } } 12. 13...

  16. 2017.08.12 [1Z0-851C] Question 31~40

    QUESTION 31 Given: public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which statement is true? A. The time to find the value from HashMap with a Person key depends on the size of the map. B. Deleting a Person key from a HashMap will delete all map entries for all keys of type Person. C. Inserting a second Person object int..

  17. 2017.08.12 [1Z0-851C] Question 21~30

    QUESTION 21 Given: class Line { public class Point { public int x, y; } public Point getPoint() { return new Point(); } } class Triangle { public Triangle() { // insert code here } } Which code, inserted at line 16, correctly retrieves a local instance of a Point object? A. Point p = Line.getPoint(); B. Line.Point p = Line.getPoint(); C. Point p = (new Line()).getPoint(); D. Line.Point p = (new ..

  18. 2017.08.12 [1Z0-851C] Question 11~20

    QUESTION 11 Given: 1. public class Hi { 2. void m1() { } 3. protected void() m2 { } 04. } 05. 6. class Lois extends Hi { 7. // insert code here 08. } Which four code fragments, inserted independently at line 7, will compile? (Choose four.) A. public void m1() { } B. protected void m1() { } C. private void m1() { } D. void m2() { } E. public void m2() { } F. protected void m2() { } G. private voi..

  19. 2017.08.12 [1Z0-851C] Question 01~10

    QUESTION 1 Given: import java.util.Date; import java.text.DateFormat; 21. DateFormat df; 22. Date date = new Date(); 23. //insert code here 24. String s = df.format(date); Which code fragment, inserted at line 23, allows the code to compile? A. df = new DateFormat(); B. df = Date.getFormat(); C. df = date.getFormat(); D. df = DateFormat.getFormat(); E. df = DateFormat.getInstance(); Correct Answ..

  20. 2017.08.11 [1Z0-851B] Question 51~60

    QUESTION 51 Given: public static Collection get() { Collection sorted = new LinkedList(); sorted.add("B"); sorted.add("C"); sorted.add("A"); return sorted; } public static void main(String[] args) { for (Object obj: get()) { System.out.print(obj + ", "); } } What is the result? A. A, B, C, B. B, C, A, C. Compilation fails. D. The code runs with no output. E. An exception is thrown at runtime. Co..

  21. 2017.08.11 [1Z0-851B] Question 41~50

    QUESTION 41 Given: class Snoochy { Boochy booch; public Snoochy() { booch = new Boochy(this); } } class Boochy { Snoochy snooch; public Boochy(Snoochy s) { snooch = s; } } And the statements: 21. public static void main(String[] args) { 22. Snoochy snoog = new Snoochy(); 23. snoog = null; 24. // more code here 25. } Which statement is true about the objects referenced by snoog, snooch, and booch..

  22. 2017.08.11 [1Z0-851B] Question 31~40

    QUESTION 31 Click the Exhibit button. Given the fully-qualified class names: com.foo.bar.Dog com.foo.bar.blatz.Book com.bar.Car com.bar.blatz.Sun Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM? Exhibit: A. Jar A B. Jar B C. Jar C D. Jar D E. Jar E Correct Answer: A Section: All Explanation Explanation/Reference: ..

  23. 2017.08.11 [1Z0-851B] Question 21~30

    QUESTION 21 Given: 1. public class TestFive { 2. private int x; 3. 4. public void foo() { 5. int current = x; 6. x = current + 1; 7. } 8. 9. public void go() { 10. for(int i = 0; i < 5; i++) { 11. new Thread() { 12. public void run() { 13. foo(); 14. System.out.print(x + ", "); 15. } 16. }.start(); 17. } 18. } 19. } Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ? ..

  24. 2017.08.11 [1Z0-851B] Question 11~20

    QUESTION 11 Given: 3. import java.util.*; 4. public class G1 { 5. public void takeList(List

  25. 2017.08.11 [1Z0-851B] Question 01~10

    QUESTION 1 Given: 1. interface Animal { void makeNoise(); } 2. class Horse implements Animal { 3. Long weight = 1200L; 4. public void makeNoise() { System.out.println("whinny"); } 05. } 06. 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 Ice..

  26. 2017.08.05 [1Z0-851A] Question 51~60

    QUESTION 51 Given: 23. Object [] myObjects = { 24. new Integer(12), 25. new String("foo"), 26. new Integer(5), 27. new Boolean(true) 28. }; 29. Arrays.sort(myObjects); 30. for(int i=0; i

  27. 2017.08.05 [1Z0-851A] Question 41~50

    QUESTION 41 Given: 33. try { 34. //some code here 35. } catch (NullPointerException e1) { 36. System.out.print("a"); 37. } catch (Exception e2) { 38. System.out.print("b"); 39. } finally { 40. System.out.print("c"); 41. } If some sort of exception is thrown at line 34, which output is possible? A. a B. b C. c D. ac E. abc Correct Answer: D Section: All Explanation Explanation/Reference: QUESTION..

  28. 2017.08.05 [1Z0-851A] Question 31~40

    QUESTION 31 Given: public class Score implements Comparable { private int wins, losses; public Score(int w, int l) { wins = w; losses = l; } public int getWins() { return wins; } public int getLosses() { return losses; } public String toString() { return ""; } // insert code here } Which method will complete this class? A. public int compareTo(Object o){/*more code here*/} B. public int compareT..

  29. 2017.08.05 [1Z0-851A] Question 21~30

    QUESTION 21 Given: 5. class Building { } 6. public class Barn extends Building { 7. public static void main(String[] args) { 8. Building build1 = new Building(); 9. Barn barn1 = new Barn(); 10. Barn barn2 = (Barn) build1; 11. Object obj1 = (Object) build1; 12. String str1 = (String) build1; 13. Building build2 = (Building) barn1; 14. } 15. } Which is true? A. If line 10 is removed, the compilati..

  30. 2017.08.05 [1Z0-851A] Question 11~20

    QUESTION 11 Given: 1. public class Rainbow { 2. public enum MyColor { 03. RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff); 4. private final int rgb; 5. MyColor(int rgb) { this.rgb = rgb; } 6. public int getRGB() { return rgb; } 07. }; 8. public static void main(String[] args) { 9. //insert code here 10. } 11. } Which code fragment, inserted at line 9, allows the Rainbow class to compile? A. MyCol..

728x90


📖 Contents 📖