728x90
    
    
  SMALL
    정보처리기사 C언어, Java, Python, SQL 기출문제 모음
22년 1회
19. 다음 Java로 구현된 프로그램을 분석하여 그 실행결과를 쓰시오.
public class Test { 	public static void main(String args[]) {     	int a=0, ss=0;         while(true) {         if(ss>100) break;         ++a;         ss+=a;         }         System.out.print(a+ss);      }  } 
정답보기
119
22년 1회
20. 다음 Java로 구현된 프로그램을 분석하여 그 실행결과를 쓰시오.
public class Test { 	public static void main(String args[]) {     	int x=1, T_x=0, t_x=0;         T_x= (x>=0) ? x:-x;         if(x>=0)         	t_x=x;         else         	t_x=-x;         System.out.println(T_x + " " + t_x);         }  } 
정답보기
1 1
22년 2회
10. 다음 Java로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오.
class Test {     public static void main(String args[]) {      int i=17;     i+=1;     i-=2;     i*=3;     i/=4;     i%=5;     System.out.print(i);    }  } 
정답보기
2
22년 2회
16. 다음 Java로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오.
class Test {     public static void main(String args[]) {      int a=26;     int b=91;     int g=0;     int c=a<b?a:b;     for(int i=1; i<c;i++){       if(a%i==0 && b%i==0)         g=i;     }     System.out.print(g);   }    } 
정답보기
13
22년 3회
3. 다음 Java로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오.
class Main {     public static void main(String args[]) {      int[] a=new int[8];     int i=0;     int n=11;     while(n>0){       a[i++]=n%2;       n/=2;     }     for(i=7;i>=0;i--)       System.out.print("%d",a[i]);   }  } 
정답보기
00001011
22년 3회
15. 다음 JAVA로 구현된 프로그램을 분석하여 그 실행결과를 쓰시오.
class Main {     public static void main(String args[]) {      int a[][]=new int [3][3];     init(a);     data(a);     prnt(a);   }      static void init(int a[][]){     for(int i=0; i<3;i++)       for(int j=0; j<3;j++)         a[i][j]=0;   }       static void data(int a[][]){       int v=1;     for(int i=0; i<3;i++)       for(int j=i; j<3;j++)         a[i][j]=v++;   }       static void prnt (int a[][]){     for(int i=0; i<3;i++){       for(int j=0; j<3;j++){         if(a[i][j]==0)           System.out.printf(" ");       else           System.out.printf("%d", a[i][j]);      }       System.out.println();     }    } } 
정답보기
123
45
6
23년 1회
12. 다음 코드의 출력결과를 쓰시오
public class Main { 	public static void main(String[] args) {   // true, false 		int x = 1; 		System.out.println(!(x>0)); 		System.out.println((x!=0) || (x>0)); 		System.out.println(x << 2); 		System.out.println(x & 2); 		System.out.println(x %= 3); 	} } 
정답보기
false
true
4
0
1
23년 2회
15. 출력결과
class Main {     public static void main(String[] args) {     	int[] a = {4, 7, 1, 2};     	for(int i=0; i<3; i++) {     		for(int j=i+1; j<4; j++) {     			if(a[i] > a[j]) {     				int temp = a[j];     				a[j] = a[i];     				a[i] = temp;     			}     		}     	}     	for(int i=0; i<4; i++) {     		System.out.print(a[i] + "a");     	}     } } 
정답보기
1a2a4a7a
23년 3회
10. 출력결과
class Berry { 	String Str; 	void meth() { 		func(); 	} 	void func() { 		System.out.println(Str); 	} } class Apple extends Berry { 	String Str; 	void func() { 		Str = "Apple"; 		super.Str = "Berry"; 		super.func(); 		System.out.println(Str); 	} } public class Main { 	public static void main(String[] args) { 		Berry A = new Apple(); 		A.meth(); 	} } 
정답보기
Berry
Apple
23년 3회
15. 출력결과
public class Main { 	static int  a = 0; 	static int func(int t) { 		a = a+t; 		return a; 	} 	public static void main(String[] args) { 		for(int i=0; i<5; i++) { 			func(i); 		} 		System.out.print(a); 	} } 
정답보기
10
23년 3회
17. 출력결과
class A { 	int f(int a, int b) { 		return a+b; 	} } public class Main { 	public static void main(String[] args) { 		A a = new A(); 		System.out.print(a.f(25, 25)); 	} } 
정답보기
50
24년 1회
4. java 출력결과
public class Test{ public static void main(String [] args) { int a[] = {1, 2, 3, 4, 5, 6}; int sum = 0; for(int i:a) { sum += i;        } System.out.print(sum);     } } 
정답보기
21
24년 1회
13. Java 빈칸에 들어갈 것을 쓰시오
	public class Test { 	public static void main(String [] args) { 		int totalcnt = 10, totalleg = 26; 		int duckcnt, pigcnt; 		for(duckcnt = 1; duckcnt < totalcnt; duckcnt++) { 			pigcnt = totalcnt -(가); 			if((2 * duckcnt) + (4 *(나)) == totalleg) { 				System.out.printf("%d %d", duckcnt, pigcnt); 				break;       		} 		} 	} } 
정답보기
(가) duckcnt 
(나) pigcnt
24년 2회
4. Java 실행결과
public class Test { int A(int a, int b) { System.out.print(a+b); return a*b;    } public static void main(String[] args) { Test a = new Test( ); System.out.print(a.A(5,5));      }   } 
정답보기
1025
24년 3회
7. Java 실행결과
public class Main { public static void main(String[] args) { int i = 17; i += 1; i -= 2; i *= 3; i /= 4; i %= 5; System.out.print(i);  } } 
정답보기
2
24년 3회
18. Java 출력결과
class Printer { void print(Integer a) { System.out.print("A" + a);   } void print(Object a) { System.out.print("B" + a);   } void print(Number a) { System.out.print("C" + a);    } } public class Main { public static void main(String[] args) { new Collection<>(0).print(); } public static class Collection<T> { T value; public Collection(T t) { value = t; } public void print() { new Printer().print(value);       }   } } 
정답보기
B0
728x90
    
    
  LIST
    '정보처리기사 > 코딩+SQL기출문제' 카테고리의 다른 글
| 정보처리산업기사(정처산기) 실기 SQL 기출문제 모음 (4) | 2023.10.21 | 
|---|---|
| 정보처리산업기사(정처산기) 실기 Python 기출문제 모음 (1) | 2023.10.21 | 
| 정보처리산업기사(정처산기) 실기 C언어 기출문제 모음 (2) | 2023.10.21 | 
| 정보처리기사 실기 SQL 기출문제 모음 (7) | 2023.02.02 | 
| 정보처리기사 실기 Python 기출문제 모음 (0) | 2022.12.15 |