본문 바로가기

ETC/자격증

(137)
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 11 https://youtu.be/qnrLJwWF4nQ Q> 다음 Java 코드에서 에러가 발생하는 부분의 기호를 쓰시오. A> class Super { int x = 10; int y = 20; public void add() { System.out.printf("%d + %d = %d\n", x, y, x+y); } } class Sub extends Super{ // 상속 int z = 30; public void add() { // 오버라이드(재정의) System.out.printf("%d + %d = %d\n", x, y, x+y+z); } } public class Exam { // 실행 public static void main(String[] args) { 1. Super a = new Sup..
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 10 https://youtu.be/qnrLJwWF4nQ Q> 다음 C 코드를 보고 결과값을 쓰시오. A> // 비트 연산자 // NOT -> AND -> XOR -> OR // ~ -> & -> ^ -> | #include int main() { int a = 7; // a = 0111 ( 2진수 ) int b = 4; // b = 0100 ( 2진수 ) int x = a & b; // AND int y = a | b; // OR int z = a ^ b; // XOR printf("결과 x : %d\n", x); // 0100 -> 4 printf("결과 y : %d\n", y); // 0111 -> 7 printf("결과 z : %d\n", z); // 0011 -> 3 } 결과 x : 4 결과 y : ..
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 9 https://youtu.be/qnrLJwWF4nQ Q> Java로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오. A> public class MyClass { public static int fun1(int n){ return fun2(n + 1); } public static int fun2(int n){ return fun3(n + 2); } public static int fun3(int n){ return n + 3; } public static void main(String args[]) { int num = 10; num = fun1(num); System.out.println(num); } } 16
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 8 https://youtu.be/qnrLJwWF4nQ Q> Java 언어로 구현된 프로그램을 분석하여 그 실행 결과를 작성하시오. A> public class MyClass { public static int decrement(int n) { n = n - 1; return n; } public static void main(String args[]) { int num = 10; num = decrement(num); System.out.println(num); } } 9
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 7 https://youtu.be/qnrLJwWF4nQ Q> 문자열 String 이 보관하는 내용 중에서 문자 'a'가 포함되어 있는 개수를 출력하도록 구현하시오. A> public class MyClass { public static void main(String args[]) { String text = "Love is a variety of different feelings, states, and" + "attitudes that ranges from interpersonal affection to pleasure."; // 문자열 상수 int cnt = 0; for(int i=0; i< text.length();i++) if(text.charAt(i) == 'a')cnt++; System.out.pr..
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 6 https://youtu.be/qnrLJwWF4nQ Q> 3개 학년의 국어 점수와 영어 점수를 2차원 배열 score에 저장하여 처리하도록 구현되어 있다. 프로그램을 분석하여 그 실행 결과를 쓰시오. A> public class YourClassNameHere { public static void main(String[] args) { double score[][] = { {80, 90}, {70, 80}, {60, 100} }; double sum = 0; for(int year=0; year < score.length; year++){ for(int s=0; s < score[year].length; s++){ sum += score[year][s]; } } int row = score.length;..
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 5 https://youtu.be/qnrLJwWF4nQ Q> 1부터 5까지의 합을 구하는 자바 코드를 작성하시오. A> public class YourClassNameHere { public static void main(String[] args) { int[] n = {1, 2, 3, 4, 5}; int sum = 0; for(int i=0; i < n.length;i++){ sum += n[i]; if(i != n.length -1) System.out.print(n[i] + "+"); else System.out.print(n[i] + "="); } System.out.println(sum); } } 1 + 2 + 3 + 4 + 5 = 15
[정보처리기사실기]두목넷 무료 강의 Part 10 프로그래밍 언어 활용 4 https://youtu.be/qnrLJwWF4nQ Q> 다음 코드의 출력값을 구하시오. public class YourClassNameHere { public static void main(String[] args) { int[] n = {1, 2, 3, 4, 5}; int sum = 0; for(int k:n){ sum += k; if(k != n.length) System.out.print(k + "+"); else System.out.print(k + "="); } System.out.println(sum); } } A> 1 + 2 + 3 + 4 + 5 = 15