Given the code fragment: public class Arr67 { public static void main(String[] args) { int[] stack={10,20,30}; int size=3; int idx=0; /* line n1 */ System.out.print("The Top element: "+stack[idx]); } } Which code fragment, inserted at line n1, prints The Top element: 30? A. do{ idx++; System.out.println("idx: "+idx); }while(idx>=size); B. while(idx
배열이란 동일한 자료형으로 선언된 데이터 공간을 메모리 상에 연속적으로 나열하여 데이터 관리의 효율성을 높이는 것입니다. 변수는 한개의 데이터만 저장할 수 있습니다. 따라서 저장해야 할 데이터의 수가 많아지면 그만큼 많은 양의 변수를 선언해줘야하는 비효율성이 발생하죠. 그렇기에 좀 더 효율적인 방법이 필요한데 이것이 배열입니다. 배열은 같은 타입의 데이터를 연속된 공간에 나열시키고 각 데이터에 인덱스(index)를 부여해 놓은 자료구조입니다. 여러가지 배열 선언 //int 타입 배열 선언 int[] i_array; int i_array[]; //배열 생성후 초기화하면 배열의 주소가 할당된다. int[] i_array = new int[8]; //초기값 0 String[] s_array = new Stri..
Given the code fragment: import java.util.ArrayList; public class List63 { public static void main(String[] args) { ArrayList points = new ArrayList(); points.add(1); points.add(2); points.add(3); points.add(4); points.add(null); points.remove(2); points.remove(null); System.out.println(points); } } What is the result? A. A NullPointerException is thrown at runtime. B. [1,2,4] C. [1,2,4,null] D...
Given: public class Product{ int id; String name; public Product(int id, String name){ this.id=id; this.name=name; } } public class Class47 { public static void main(String[] args) { Product p1=new Product(101,"Pen"); Product p2=new Product(101,"Pen"); Product p3=p1; boolean ans1=p1==p2; boolean ans2=p1.name.equals(p2.name); System.out.print(ans1 + ":" + ans2); } } What is the result? A. true:tr..
Given the code fragment: import java.util.ArrayList; import java.util.List; public class List81 { public static void main(String[] args) { List colors=new ArrayList(); colors.add("green"); colors.add("red"); colors.add("blue"); colors.add("yellow"); colors.remove(2); colors.add(3,"cyan"); System.out.println(colors); } } What is the result? A. (green,red,yellow,cyan) B. (green,blue,yellow,cyan) C..
Given: public class Type43 { static double area; int b=2, h=3; public static void main(String[] args) { double p,b,h; //line n1 if(area==0){ b=3; h=4; p=0.5; } area=p*b*h; //line n2 System.out.println("Area is "+area); } } What is the result? A. Area is 6.0 B. Area is 3.0 C. Compilation fails at line n1 D. Compilation fails at line n2 정답: D 변수들 (p,b,h)이 초기화가 되지 않았는데 계산을 하려고 해서 컴파일 에러가 난다. 마치 if ..
- Total
- Today
- Yesterday
- Python
- 스크래핑
- 이클립스
- JDBC
- xe애드온
- 자바 smtp
- 프로씨
- 자바
- 오라클
- 인포믹스
- esql
- C
- C언어
- 플러터
- XE3
- 포인터
- 파이썬
- MySQL
- 파싱
- KG
- xe addon
- XE
- EC
- ocajp
- ocjap
- webix
- proc
- 문자열
- 라이믹스
- php
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
