<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>JaeJae._.log</title>
        <link>https://velog.io/</link>
        <description>꿈을 향해 끊임없이 성장하기</description>
        <lastBuildDate>Tue, 12 May 2026 12:58:41 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>JaeJae._.log</title>
            <url>https://velog.velcdn.com/images/xaexun_/profile/ff0acbbf-8eb2-413b-a35c-a5586a434230/image.jpeg</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. JaeJae._.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/xaexun_" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[[SWEA] 1873. 상호의 배틀필드]]></title>
            <link>https://velog.io/@xaexun_/SWEA-1873.-%EC%83%81%ED%98%B8%EC%9D%98-%EB%B0%B0%ED%8B%80%ED%95%84%EB%93%9C</link>
            <guid>https://velog.io/@xaexun_/SWEA-1873.-%EC%83%81%ED%98%B8%EC%9D%98-%EB%B0%B0%ED%8B%80%ED%95%84%EB%93%9C</guid>
            <pubDate>Tue, 12 May 2026 12:58:41 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>상호는 전차로 시가전을 하는 것을 테마로 한 새로운 게임 “배틀 필드”를 개발하기로 했다.</p>
<p>그래서 먼저 간단하게 프로토 타입 게임을 만들었다.</p>
<p>이 프로토 타입에서 등장하는 전차는 사용자의 전차 하나뿐이며, 적이나 아군으로 만들어진 전차는 등장하지 않는다.</p>
<p>사용자의 전차는 사용자의 입력에 따라 격자판으로 이루어진 게임 맵에서 다양한 동작을 한다.</p>
<p>다음 표는 게임 맵의 구성 요소를 나타낸다.</p>
<table>
<thead>
<tr>
<th align="center">문자</th>
<th>의미</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>.</strong></td>
<td>평지(전차가 들어갈 수 있다.)</td>
</tr>
<tr>
<td align="center">*****</td>
<td>벽돌로 만들어진 벽</td>
</tr>
<tr>
<td align="center"><strong>#</strong></td>
<td>강철로 만들어진 벽</td>
</tr>
<tr>
<td align="center"><strong>-</strong></td>
<td>물(전차는 들어갈 수 없다.)</td>
</tr>
<tr>
<td align="center"><strong>^</strong></td>
<td>위쪽을 바라보는 전차(아래는 평지이다.)</td>
</tr>
<tr>
<td align="center"><strong>v</strong></td>
<td>아래쪽을 바라보는 전차(아래는 평지이다.)</td>
</tr>
<tr>
<td align="center"><strong>&gt;</strong></td>
<td>왼쪽을 바라보는 전차(아래는 평지이다.)</td>
</tr>
<tr>
<td align="center"><strong>&lt;</strong></td>
<td>오르쪽을 바라보는 전차(아래는 평지이다.)</td>
</tr>
</tbody></table>
<p>다음 표는 사용자가 넣을 수 있는 입력의 종류를 나타낸다.</p>
<table>
<thead>
<tr>
<th align="center">문자</th>
<th>동작</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>U : <code>Up</code></strong></td>
<td>전차가 바라보는 방향을 위쪽으로 바꾸고, 한 칸 위의 칸이 평지라면 위 그 칸으로 이동한다.</td>
</tr>
<tr>
<td align="center"><strong>D : <code>Down</code></strong></td>
<td>전차가 바라보는 방향을 아래쪽으로 바꾸고, 한 칸 아래의 칸이 평지라면 그 칸으로 이동한다.</td>
</tr>
<tr>
<td align="center"><strong>L : <code>Left</code></strong></td>
<td>전차가 바라보는 방향을 왼쪽으로 바꾸고, 한 칸 왼쪽의 칸이 평지라면 그 칸으로 이동한다.</td>
</tr>
<tr>
<td align="center"><strong>R : <code>Right</code></strong></td>
<td>전차가 바라보는 방향을 오른쪽으로 바꾸고, 한 칸 오른쪽의 칸이 평지라면 그 칸으로 이동한다.</td>
</tr>
<tr>
<td align="center"><strong>S : <code>Shoot</code></strong></td>
<td>전차가 현재 바라보고 있는 방향으로 포탄을 발사한다.</td>
</tr>
</tbody></table>
<p>전차가 이동을 하려고 할 때, 만약 게임 맵 밖이라면 전차는 당연히 이동하지 않는다.</p>
<p>전차가 포탄을 발사하면, 포탄은 벽돌로 만들어진 벽 또는 강철로 만들어진 벽에 충돌하거나 게임 맵 밖으로 나갈 때까지 직진한다.</p>
<p>만약 포탄이 벽에 부딪히면 포탄은 소멸하고, 부딪힌 벽이 벽돌로 만들어진 벽이라면 이 벽은 파괴되어 칸은 평지가 된다.</p>
<p>강철로 만들어진 벽에 포탄이 부딪히면 아무 일도 일어나지 않는다.</p>
<p>게임 맵 밖으로 포탄이 나가면 아무런 일도 일어나지 않는다.</p>
<p>초기 게임 맵의 상태와 사용자가 넣을 입력이 순서대로 주어질 때, 모든 입력을 처리하고 나면 게임 맵의 상태가 어떻게 되는지 구하는 프로그램을 작성하라.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>첫 번째 줄에 테스트 케이스의 수 T가 주어진다.</p>
<p>각 테스트 케이스의 첫 번째 줄에는 두 정수 H, W (2 ≤ H, W ≤ 20) 이 공백으로 구분되어 주어진다.</p>
<p>이는 게임 맵의 높이가 H, 너비가 W임을 나타낸다.</p>
<p>즉, 게임 맵은 H x W크기의 격자판이다.</p>
<p>다음 H개의 각각의 줄에는 길이가 W인 문자열이 주어진다.</p>
<p>각각의 문자는 위의 게임 맵 구성 요소 표에 있는 문자들만 포함하며, 전차는 단 하나만 있다.</p>
<p>다음 줄에는 사용자가 넣을 입력의 개수를 나타내는 정수 N(0 &lt; N ≤ 100) 이 주어진다.</p>
<p>다음 줄에는 길이가 N인 문자열이 주어진다.</p>
<p>각각의 문자는 위의 사용자가 넣을 수 있는 입력의 종류를 나타내는 표에 있는 문자들만 포함된다.</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>각 테스트 케이스마다 ‘#x’(x는 테스트케이스 번호를 의미하며 1부터 시작한다)를 출력하고 한 칸을 띄운 후, 모든 입력을 처리하고 난 후의 게임 맵을 H개의 줄에 걸쳐 출력한다.</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>1
4 6
*.*..*
*.....
..-...
^.*#..</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>#1 *....*
......
..-...
..&gt;#..</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">package live06._02_상호의_배틀필드;

import java.util.*;
import java.io.*;

public class Solution {
    static int H, W;
    static char[][] map;
    static int tankR, tankC, dir;

    static int[] dr = { -1, 1, 0, 0 };
    static int[] dc = { 0, 0, -1, 1 };
    static char[] tankDir = { &#39;^&#39;, &#39;v&#39;, &#39;&lt;&#39;, &#39;&gt;&#39; };

    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(&quot;src/live06/_02_상호의_배틀필드/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        int T = Integer.parseInt(br.readLine());

        for (int tc = 1; tc &lt;= T; tc++) {
            st = new StringTokenizer(br.readLine());
            H = Integer.parseInt(st.nextToken());
            W = Integer.parseInt(st.nextToken());

            map = new char[H][W];

            tankR = 0;
            tankC = 0;
            dir = 0;

            for (int i = 0; i &lt; H; i++) {
                String road = br.readLine();
                for (int j = 0; j &lt; W; j++) {
                    map[i][j] = road.charAt(j);

                    if (map[i][j] == &#39;^&#39; || map[i][j] == &#39;v&#39; || map[i][j] == &#39;&lt;&#39; || map[i][j] == &#39;&gt;&#39;) {
                        tankR = i;
                        tankC = j;

                        switch (map[i][j]) {
                            case &#39;^&#39;: dir = 0; break;
                            case &#39;v&#39;: dir = 1; break;
                            case &#39;&lt;&#39;: dir = 2; break;
                            case &#39;&gt;&#39;: dir = 3; break;
                        }
                    }
                }
            }

            int N = Integer.parseInt(br.readLine());
            String cmdLine = br.readLine();

            for (int i = 0; i &lt; N; i++) {
                char cmd = cmdLine.charAt(i);

                switch (cmd) {
                    case &#39;U&#39;: move(0); break;
                    case &#39;D&#39;: move(1); break;
                    case &#39;L&#39;: move(2); break;
                    case &#39;R&#39;: move(3); break;
                    case &#39;S&#39;: shoot(); break;
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.append(&quot;#&quot;).append(tc).append(&quot; &quot;);

            for (int i = 0; i &lt; H; i++) {
                for (int j = 0; j &lt; W; j++) {
                    sb.append(map[i][j]);
                }
                sb.append(&quot;\n&quot;);
            }

            bw.write(sb.toString());

        }

        br.close();
        bw.close();
    }

    static void move(int nextDir) {
        dir = nextDir;

        map[tankR][tankC] = tankDir[dir];

        int nr = tankR + dr[dir];
        int nc = tankC + dc[dir];

        if (nr &lt; 0 || nc &lt; 0 || nr &gt;= H || nc &gt;= W) return;
        if (map[nr][nc] != &#39;.&#39;)    return;

        map[tankR][tankC] = &#39;.&#39;;
        tankR = nr;
        tankC = nc;
        map[tankR][tankC] = tankDir[dir];
    }

    static void shoot() {
        int nr = tankR + dr[dir];
        int nc = tankC + dc[dir];

        while (nr &gt;= 0 &amp;&amp; nc &gt;= 0 &amp;&amp; nr &lt; H &amp;&amp; nc &lt; W) {
            if (map[nr][nc] == &#39;*&#39;) {
                map[nr][nc] = &#39;.&#39;;
                return;
            }

            if (map[nr][nc] == &#39;#&#39;)    return;

            nr += dr[dir];
            nc += dc[dir];
        }
    }
}
</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
<p><strong><span style="color: green"><code>전역 변수</code></span></strong></p>
</blockquote>
<ul>
<li>아래 함수들에서 사용할 <strong>전역 변수</strong>들을 선언한다.</li>
<li>이 때 <code>dr &amp; dc</code>와 <code>tankDir</code>를 <strong>상하좌우</strong>로 꼭 매칭해줘야한다.</li>
</ul>
<pre><code class="language-java">static int H, W;        // 맵의 가로, 세로 크기
static char[][] map;    // 맵의 정보를 받을 변수
static int tankR, tankC, dir;    // 몇 번째 행렬에 있고, 어느 방향을 바라보는지
static int[] dr = { -1, 1, 0, 0 };    // 행 좌표 이동
static int[] dc = { 0, 0, -1, 1 };    // 열 좌표 이동
static char[] tankDir = { &#39;^&#39;, &#39;v&#39;, &#39;&lt;&#39;, &#39;&gt;&#39; };    // 상하좌우</code></pre>
<blockquote>
<p><strong><span style="color: green"><code>main</code></span></strong></p>
</blockquote>
<ul>
<li>초기화와 함수 사용을 담당한다.</li>
<li>매 테스트 케이스마다 다음의 변수들을 초기화해야한다.<ul>
<li><code>H, W, map, tankR, tankC, dir</code></li>
</ul>
</li>
<li>또한, 초기값도 다시 대입해야한다.</li>
</ul>
<pre><code class="language-java">if (map[i][j] == &#39;^&#39; || map[i][j] == &#39;v&#39; 
    || map[i][j] == &#39;&lt;&#39; || map[i][j] == &#39;&gt;&#39;)
{
    tankR = i; // 탱크 시작 좌표 Row 
    tankC = j; // 탱크 시작 좌표 Col

    // 탱크가 바라보는 방향 초기화
    switch (map[i][j]) {
        case &#39;^&#39;:
            dir = 0;
            break;
        case &#39;v&#39;:
            dir = 1;
            break;
        case &#39;&lt;&#39;:
            dir = 2;
            break;
        case &#39;&gt;&#39;:
            dir = 3;
            break;
    }
}</code></pre>
<blockquote>
</blockquote>
<ul>
<li>변수들을 초기화했으니 이제 움직이고 포탄을 발사할 차례</li>
<li>들어오는 명령에 따라 <code>Switch</code>을 적용시킨다.</li>
<li>아래 </li>
</ul>
<pre><code class="language-java">int N = Integer.parseInt(br.readLine()); // 명령어 갯수
String cmdLine = br.readLine(); // 명령어 줄

for (int i = 0; i &lt; N; i++) {
    char cmd = cmdLine.charAt(i); // 명령어

    switch (cmd) {
        case &#39;U&#39;:        // 위로 돌고 평지면 이동
            move(0);
            break;
        case &#39;D&#39;:        // 아래로 돌고 평지면 이동
            move(1);
            break;
        case &#39;L&#39;:        // 좌로 돌고 평지면 이동
            move(2);
            break;
        case &#39;R&#39;:        // 우로 돌고 평지면 이동
            move(3);
            break;
        case &#39;S&#39;:        // 포탄 발사
            shoot();
            break;
    }
}</code></pre>
<blockquote>
</blockquote>
<ul>
<li>위 코드까지 진행되면, <code>map</code>은 값이 변해있고, 출력만하면 되는 상태가 된다.</li>
</ul>
<pre><code class="language-java">StringBuilder sb = new StringBuilder();

sb.append(&quot;#&quot;).append(tc).append(&quot; &quot;);

// 값이 변경된 map 입력받기
for (int i = 0; i &lt; H; i++) {
    for (int j = 0; j &lt; W; j++) {
        sb.append(map[i][j]);
    }
    sb.append(&quot;\n&quot;);
}

bw.write(sb.toString()); // 출력
</code></pre>
<blockquote>
<p><strong><span style="color:green"><code>move 함수</code></span></strong></p>
</blockquote>
<ul>
<li>현재 전차 방향 <code>dir</code>을 명령으로 들어온 방향으로 변경</li>
<li>방향 변경하고 이동, 이 때 이동이 실패하더라도 방향은 변경되어야함</li>
<li>맵 밖이거나, 평지가 아닌 경우 예외 처리</li>
<li>전차가 지나가는 영역을 초기화<ul>
<li>전차가 있던 칸을 평지로 초기화</li>
<li>전차 좌표 이동 후 그 위치의 전차 방향 표시</li>
</ul>
</li>
</ul>
<pre><code class="language-java">static void move(int nextDir) {
    dir = nextDir;

    // 이동이 실패해도 방향은 바뀜
    map[tankR][tankC] = tankDir[dir];

    int nr = tankR + dr[dir]; // 탱크 다음 행 좌표
    int nc = tankC + dc[dir]; // 탱크 다음 열 좌표

    // 맵 밖이거나 평지가 아닐 때
    if (nr &lt; 0 || nc &lt; 0 || nr &gt;= H || nc &gt;= W) return;
    if (map[nr][nc] != &#39;.&#39;)    return;

    map[tankR][tankC] = &#39;.&#39;; // 평지 초기화
    tankR = nr;    // 다음 행으로 이동할 준비
    tankC = nc; // 다음 열로 이동할 준비
    map[tankR][tankC] = tankDir[dir]; // 다음 좌표에 탱그 방향 표시
}</code></pre>
<blockquote>
<p><strong><span style="color:green"><code>shoot 함수</code></span></strong></p>
</blockquote>
<ul>
<li>현재 탱크가 바라보는 방향으로 포탄 발사</li>
<li>포탄이 처음 위치할 행렬 좌표 설정</li>
<li>포탄이 맵 안에 있는 동안 계속 직진</li>
<li>벽돌 벽이거나, 강철 벽이거나, 벽을 만나지 않았거나 예외 처리</li>
</ul>
<pre><code class="language-java">static void shoot() {
    int nr = tankR + dr[dir];
    int nc = tankC + dc[dir];

    while (nr &gt;= 0 &amp;&amp; nc &gt;= 0 &amp;&amp; nr &lt; H &amp;&amp; nc &lt; W) {
        // 벽돌 벽 만나면 평지로 바꾸고 이동 끝
        if (map[nr][nc] == &#39;*&#39;) {
            map[nr][nc] = &#39;.&#39;;
            return;
        }

        // 강철 벽 만나면 이동 끝
        if (map[nr][nc] == &#39;#&#39;)    return;

        // 뭔가 만날 때까지 게속 이동
        nr += dr[dir];
        nc += dc[dir];
    }
}</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[[SWEA] 1860. 진기의 최고급 붕어빵]]></title>
            <link>https://velog.io/@xaexun_/SWEA-1860.-%EC%A7%84%EA%B8%B0%EC%9D%98-%EC%B5%9C%EA%B3%A0%EA%B8%89-%EB%B6%95%EC%96%B4%EB%B9%B5</link>
            <guid>https://velog.io/@xaexun_/SWEA-1860.-%EC%A7%84%EA%B8%B0%EC%9D%98-%EC%B5%9C%EA%B3%A0%EA%B8%89-%EB%B6%95%EC%96%B4%EB%B9%B5</guid>
            <pubDate>Wed, 29 Apr 2026 02:21:10 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<pre><code>진기는 붕어빵 가게를 운영하고 있다.

진기가 파는 붕어빵은 그냥 붕어빵이 아니라 겉은 바삭! 속은 말랑! 한입 물면 팥 앙금이 주르륵 흘러 입안에서 춤을 추며,

절로 어릴 적 호호 불며 먹었던 뜨거운 붕어빵의 추억이 떠올라 눈물이 나오게 되는 최고급 붕어빵이다.

진기는 이런 붕어빵을 보통 사람들에게는 팔지 않는다.

그는 무조건 예약제로만 손님을 받으며, 예약을 하려는 손님들은 진기의 까다로운 자격 검증에서 합격해야만 붕어빵을 맛 볼 자격을 얻는다.

그래서 오늘은 N명의 사람이 자격을 얻었다.

진기는 0초부터 붕어빵을 만들기 시작하며, M초의 시간을 들이면 K개의 붕어빵을 만들 수 있다.

서빙은 진기가 하는 것이 아니기 때문에, 붕어빵이 완성되면 어떤 시간 지연도 없이 다음 붕어빵 만들기를 시작할 수 있다.

0초 이후에 손님들이 언제 도착하는지 주어지면, 모든 손님들에게 기다리는 시간없이 붕어빵을 제공할 수 있는지 판별하는 프로그램을 작성하라.</code></pre><p><span></span></p>
<h2 id="입력">입력</h2>
<pre><code>첫 번째 줄에 테스트 케이스의 수 T가 주어진다.

각 테스트 케이스의 첫 번째 줄에는 세 자연수 N, M, K(1 ≤ N, M, K ≤ 100)가 공백으로 구분되어 주어진다.

두 번째 줄에는 N개의 정수가 공백으로 구분되어 주어지며,

각 정수는 각 사람이 언제 도착하는지를 초 단위로 나타낸다. 각 수는 0이상 11,111이하이다.</code></pre><p><span></span></p>
<h2 id="출력">출력</h2>
<pre><code>각 테스트 케이스마다 ‘#x’(x는 테스트케이스 번호를 의미하며 1부터 시작한다)를 출력하고,

모든 손님에 대해 기다리는 시간이 없이 붕어빵을 제공할 수 있으면 “Possible”을, 아니라면 “Impossible”을 출력한다.</code></pre><p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>4
2 2 2
3 4
2 2 2
1 2
2 2 1
4 2
2 2 1
3 2</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>#1 Possible
#2 Impossible
#3 Possible
#4 Impossible</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">
package live13._02_진기의_최고급_붕어빵;

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(&quot;src/live13/_02_진기의_최고급_붕어빵/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        int T = Integer.parseInt(br.readLine());

        for (int tc = 1; tc &lt;= T; tc++) {
            st = new StringTokenizer(br.readLine());
            int N = Integer.parseInt(st.nextToken()); // N명의 사람
            int M = Integer.parseInt(st.nextToken()); // M초의 동안
            int K = Integer.parseInt(st.nextToken()); // K개의 붕어빵을 만들 수 있음

            int bungeobbangCnt = 0;
            int[] customerTime = new int[N];

            st = new StringTokenizer(br.readLine());
            // 손님 N명이 각각 도착하는 시간
            for (int i = 0; i &lt; N; i++) {
                customerTime[i] = Integer.parseInt(st.nextToken());
            }

            // 시간순 정렬!
            Arrays.sort(customerTime);
            boolean canSell = true;
            for (int i = 0; i &lt; N; i++) {
                if (customerTime[i] / M * K - i &lt;= 0) {
                    canSell = false;
                    break;
                }
            }

            bw.write(&quot;#&quot; + String.valueOf(tc) + &quot; &quot; + (canSell ? &quot; Possible\n&quot; : &quot; Impossible\n&quot;));
        }

        br.close();
        bw.close();
    }
}
</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
<p>💡<strong><span><code>Key Point</code></span></strong></p>
</blockquote>
<ul>
<li>시간 기준이 아니라 도착했을 때 붕어빵이 남아있는지를 기준으로 풀어보도록 하죠.</li>
<li>손님이 도착한 시간에 <ul>
<li>붕어빵이 몇 개 있어야하고,</li>
<li>붕어빵이 없으면 못 팔고,</li>
<li>이전 손님이 있었다면 <code>-1</code>개</li>
<li>이전 손님 수에 따라 <code>-1 * N</code>이 되겠죠?</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡<strong><span><code>남아있는 붕어빵 개수 구하기</code></span></strong></p>
</blockquote>
<ol>
<li><code>customerTime[i] / M</code><ul>
<li>진기는 <code>M</code>초 동안 <code>K</code>개의 붕어빵을 만듭니다.</li>
<li>손님이 온 시간을 <code>M</code>으로 나누면 그동안 <code>K</code>개의 붕어빵을 <code>몇 번</code>만들었는지 알 수 있습니다.</li>
<li>그 <code>몇 번</code>에 <code>K</code>를 곱하면 해당 시간에 붕어빵을 <code>몇 개</code> 만들었는지 알 수 있겠죠?</li>
</ul>
</li>
<li><code>customerTime[i] / M * K</code><ul>
<li>이렇게 손님이 온 시간에 붕어빵을 <code>몇 개</code> 만들었는지 구합니다.</li>
<li>근데 예를 들어서, 5번째 손님까지 각각 하나씩 먹었다면 <code>-5</code>를 해야겠죠?</li>
<li>이는 해당 시간동안 손님이 몇 번 들어왔는지 빼면 됩니다.</li>
</ul>
</li>
<li><code>customerTime[i] / M * K - i</code><ul>
<li><code>for</code>문은 들어온 손님 수만큼 순회합니다.</li>
<li>그러면 <code>-i</code>를 하면 자연스럽게 손님들이 하나씩 붕어빵을 먹고가게 됩니다.</li>
<li>여기까지가 손님이 방문했을 때 남은 붕어빵의 개수가 되는거에요.</li>
</ul>
</li>
<li><code>customerTime[i] / M * K - i &lt;= 0</code><ul>
<li>근데 도착했는데 붕어빵이 없다?</li>
<li>그러면 <code>false</code>를 처리하는 거에요.</li>
<li>그럴 일은 없어야겠지만, 음수가 나올 경우를 대비하여 <code>&lt;=</code>를 사용했습니다.</li>
</ul>
</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[[SWEA] 3307. 최장 증가 부분 수열]]></title>
            <link>https://velog.io/@xaexun_/SWEA-3307.-%EC%B5%9C%EC%9E%A5-%EC%A6%9D%EA%B0%80-%EB%B6%80%EB%B6%84-%EC%88%98%EC%97%B4</link>
            <guid>https://velog.io/@xaexun_/SWEA-3307.-%EC%B5%9C%EC%9E%A5-%EC%A6%9D%EA%B0%80-%EB%B6%80%EB%B6%84-%EC%88%98%EC%97%B4</guid>
            <pubDate>Mon, 27 Apr 2026 03:31:52 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>주어진 두 수열의 최장 증가 부분 수열(Longest Increasing Subsequence)의 길이를 계산하는 프로그램을 작성하시오.</p>
<p>수열 { A1, A2, ... , AN }의 최장 증가 부분 수열 B는 다음과 같이 정의된다.</p>
<p>{ B1, B2, ... , BK }에서 0≤K≤N, B1 &lt; B2 &lt; ... &lt; BK이고,</p>
<p>AB1 ≤ AB2 ≤ ... ≤ ABK인 최대 K로 구성된 수열이다.</p>
<p>예를 들어, 수열이 { 1, 3, 2, 5, 4, 7 } 이라면, 최장 부분 증가 수열의 길이는 4가 된다.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>첫 번째 줄에 테스트 케이스의 수 T가 주어진다.</p>
<p>각 테스트 케이스의 첫째 줄에는 수열의 길이 N(1≤N≤1,000)이 주어진다. </p>
<p>둘째 줄에는 수열의 원소 N개가 공백을 사이에 두고 순서대로 주어진다.</p>
<p>각 수열의 원소는 1 이상 2³¹-1 이하의 자연수이다.</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>각 테스트 케이스마다 ‘#T’(T는 테스트케이스 번호를 의미하며 1부터 시작한다)를 출력하고, 최대 증가 부분 수열의 길이를 출력한다.</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>2
5
1 3 2 5 4 
6
4 2 3 1 5 6</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>#1 3
#2 4</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">package live11._01_최장_증가_부분_수열;

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(&quot;src/live11/_01_최장_증가_부분_수열/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        int T = Integer.parseInt(br.readLine());

        for (int tc = 1; tc &lt;= T; tc++) {
            int numArrLength = Integer.parseInt(br.readLine());
            int[] numArr = new int[numArrLength];
            int[] dp = new int[numArrLength];
            int answer = 0;

            // 수열 받기
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i &lt; numArrLength; i++) {
                numArr[i] = Integer.parseInt(st.nextToken());
            }

            Arrays.fill(dp, 1);

            for (int i = 0; i &lt; numArrLength; i++) {
                for (int j = 0; j &lt; i; j++) {
                    if (numArr[j] &lt; numArr[i]) {
                        dp[i] = Math.max(dp[i], dp[j] + 1);
                    }
                }
                answer = Math.max(answer, dp[i]);
            }

            bw.write(&quot;#&quot; + tc + &quot; &quot; + answer + &quot;\n&quot;);
        }

        br.close();
        bw.close();
    }
}</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
<p>💡 <strong><span style="color: blue">DP의 의미와 초기값</span></strong></p>
</blockquote>
<pre><code class="language-java">int[] dp = new int[numArrLength];
Arrays.fill(dp, 1);</code></pre>
<ul>
<li><code>dp</code>는 <code>numArr</code>의 인덱스와 1대1 매칭입니다.</li>
<li><code>dp[i]</code>는 <code>i</code>번째 숫자를 마지막으로 하는 최장 길이입니다.<ul>
<li>예시 입력값을 예로 들면, <code>1 3 2 5 4</code>에서 <code>3</code>은 <code>1</code>번째 숫자이며, 이 숫자를 마지막으로 하는 최장 길이는 <code>1과 3</code>이 되므로 <code>2</code>가 됩니다.</li>
</ul>
</li>
<li>초기값은 모든 숫자들이 한 번씩은 들어갈 수 있기 때문에 <code>1</code>로 초기화합니다.</li>
<li>주의점은 <code>3</code>의 앞에 있는 숫자와 비교하여 최장 길이를 계산해야합니다.<ul>
<li>예를 들면, <code>5</code>앞에 있는 숫자는 <code>1 3 2</code>가 됩니다.</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue">점화식</span></strong></p>
</blockquote>
<pre><code class="language-java">for (int i = 0; i &lt; numArrLength; i++) {
    for (int j = 0; j &lt; i; j++) {
        if (numArr[j] &lt; numArr[i]) {
            dp[i] = Math.max(dp[i], dp[j] + 1);
        }
    }
    answer = Math.max(answer, dp[i]);
}</code></pre>
<ol>
<li><code>for</code>문은 현재 위치의 값과 이전 모두의 값을 비교하게됩니다.
<strong>1-1)</strong> 바깥쪽 <code>for</code>문은 <strong>현재값</strong>입니다.
<strong>1-2)</strong> 안쪽 <code>for</code>문은 <strong>이전값들</strong>입니다.</li>
<li><code>if</code>문은 현재 위치의 값과 이전 값들을 비교하기 위한 조건입니다.
현재 위치의 값보다 나중인 값은 비교하면 내 앞에 있는 숫자들 중에서 나보다 작은 숫자를 봐야한다는 조건을 못 지키게 됩니다.</li>
<li><code>dp[i]</code> = 현재 위치의 최장 길이<ul>
<li><code>dp[j] + 1</code>로 현재 위치의 값보다 작은 값이 있다는 것을 저장합니다.</li>
<li><code>i = 1</code>일 때<ul>
<li><code>1</code>과 <code>3</code>을 비교하게 되며, <code>3</code>이 더 크기 때문에</li>
<li><code>dp[j] + 1</code>로 <code>dp = { 1, 2, 1, 1, 1 }</code> 이 됩니다.</li>
</ul>
</li>
<li><code>i = 2</code>일 때<ul>
<li><code>1</code>과 <code>2</code>, <code>3</code>과 <code>2</code> 총 2번을 비교하게 됩니다.</li>
<li><code>1</code>과 비교했을 때 <code>dp[j] + 1</code>을 하게되지만,</li>
<li><code>3</code>과 비교했을 때 <code>2</code>가 더 작으니 조건을 벗어나게 됩니다.</li>
<li>따라서 <code>dp = { 1, 2, 2, 1, 1 }</code> 이 됩니다.</li>
</ul>
</li>
<li><code>i = 3</code>일 때<ul>
<li><code>1</code>과 <code>5</code>, <code>3</code>과 <code>5</code>, <code>2</code>와 <code>5</code> 총 3번을 비교하게 됩니다.</li>
<li><code>1</code>과 비교했을 때 <code>dp[j] + 1</code></li>
<li><code>3</code>과 비교했을 때 <code>dp[j] + 1</code></li>
<li><code>2</code>와 비교했을 때 <code>dp[j] + 1</code></li>
<li>따라서 <code>dp = { 1, 2, 2, 3, 1 }</code> 이 됩니다.</li>
</ul>
</li>
<li><code>i = 4</code>일 때<ul>
<li>위의 규칙에 따라 총 4번을 비교하게 됩니다.</li>
<li><code>5</code>와 <code>4</code>를 비교했을 때만 조건을 벗어나게 되므로</li>
<li><code>dp = { 1, 2, 2, 3, 3 }</code> 이 됩니다.</li>
</ul>
</li>
</ul>
</li>
<li><code>dp</code>의 가장 큰 값을 <code>answer</code>의 담아서 출력하면 최장 길이 문제 해결입니다!</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[[SWEA] 미로 1]]></title>
            <link>https://velog.io/@xaexun_/SWEA-%EB%AF%B8%EB%A1%9C-1</link>
            <guid>https://velog.io/@xaexun_/SWEA-%EB%AF%B8%EB%A1%9C-1</guid>
            <pubDate>Sat, 25 Apr 2026 12:13:35 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>16*16 행렬의 형태로 만들어진 미로에서 흰색 바탕은 길, 노란색 바탕은 벽을 나타낸다.</p>
<p>가장 좌상단에 있는 칸을 (0, 0)의 기준으로 하여, 가로방향을 x 방향, 세로방향을 y 방향이라고 할 때, 미로의 시작점은 (1, 1)이고 도착점은 (13, 13)이다.</p>
<p>주어진 미로의 출발점으로부터 도착지점까지 갈 수 있는 길이 있는지 판단하는 프로그램을 작성하라.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>각 테스트 케이스의 첫 번째 줄에는 테스트 케이스의 번호가 주어지며, 바로 다음 줄에 테스트 케이스가 주어진다.</p>
<p>총 10개의 테스트케이스가 주어진다.</p>
<p>테스트 케이스에서 1은 벽을 나타내며 0은 길, 2는 출발점, 3은 도착점을 나타낸다.</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>#부호와 함께 테스트 케이스의 번호를 출력하고, 공백 문자 후 도달 가능 여부를 1 또는 0으로 표시한다 (1 - 가능함, 0 - 가능하지 않음).</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>1
1111111111111111
1210000000100011
1010101110101111
1000100010100011
1111111010101011
1000000010101011
1011111110111011
1010000010001011
1010101111101011
1010100010001011
1010111010111011
1010001000100011
1011101111101011
1000100000001311
1111111111111111
1111111111111111</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>#1 1</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">
package live06._01_미로1;

import java.util.*;
import java.io.*;

public class Solution {
    static int[][] maze;
    static boolean[][] visited;
    static int[] dr = { -1, 1, 0, 0 };
    static int[] dc = { 0, 0, -1, 1 };
    static int answer;

    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(&quot;src/live06/_01_미로1/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        for (int tc = 1; tc &lt;= 10; tc++) {
            int tcNum = Integer.parseInt(br.readLine());
            maze = new int[16][16];
            visited = new boolean[16][16];
            answer = 0;

            int startR = 0;
            int startC = 0;

            for (int i = 0; i &lt; 16; i++) {
                String mazeLine = br.readLine();
                for (int j = 0; j &lt; 16; j++) {
                    maze[i][j] = mazeLine.charAt(j) - &#39;0&#39;;

                    if (maze[i][j] == 2) {
                        startR = i;
                        startC = j;
                    }
                }
            }

            bw.write(&quot;#&quot; + tcNum + &quot; &quot; + String.valueOf(dfs(startR, startC)) + &quot;\n&quot;);
        }

        br.close();
        bw.close();
    }

    static int dfs(int row, int col) {
        if (maze[row][col] == 3) {
            answer = 1;
            return 1;
        }

        visited[row][col] = true;

        for (int i = 0; i &lt; 4; i++) {
            int nr = row + dr[i];
            int nc = col + dc[i];

            if (nr &lt; 0 || nr &gt;= 16 || nc &lt; 0 || nc &gt;= 16)
                continue;

            if (maze[nr][nc] == 1)
                continue;

            if (visited[nr][nc])
                continue;

            dfs(nr, nc);
        }

        return answer;
    }
}
</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
<p>💡 <strong><span style="color: blue">접근 방식</span></strong></p>
</blockquote>
<ul>
<li>시작점 <code>2</code>에서 도착점 <code>3</code>으로 가는 것이 가능한지 판단하는 문제</li>
<li><code>16 x 16</code> 미로</li>
<li>현재 위치에서 상하좌우로 값들을 확인하며 다음의 조건들을 구현
1) 범위는 <code>maze[0][0] ~ maze [15][15]</code>
2) 확인한 값이 <code>1</code>일 때
3) 이미 방문한 경로일 때
4) 확인한 값이 <code>3</code>일 때</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue">미로 정보 및 시작점 저장</span></strong></p>
</blockquote>
<pre><code class="language-java">int startR = 0;
int startC = 0;

for (int i = 0; i &lt; 16; i++) {
    String mazeLine = br.readLine();
    for (int j = 0; j &lt; 16; j++) {
        maze[i][j] = mazeLine.charAt(j) - &#39;0&#39;;

        if (maze[i][j] == 2) {
            startR = i;
            startC = j;
        }
    }
}</code></pre>
<ul>
<li>미로에 대한 정보를 입력받음과 동시에 시작점을 저장한다.</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue">DFS 구현</span></strong></p>
</blockquote>
<pre><code class="language-java">static int dfs(int row, int col) {
    if (maze[row][col] == 3) {
        answer = 1;
        return 1;
    }

    visited[row][col] = true;

    for (int i = 0; i &lt; 4; i++) {
        int nr = row + dr[i];
        int nc = col + dc[i];

        if (nr &lt; 0 || nr &gt;= 16 || nc &lt; 0 || nc &gt;= 16)
            continue;

        if (maze[nr][nc] == 1)
            continue;

        if (visited[nr][nc])
            continue;

        dfs(nr, nc);
    }

    return answer;
}</code></pre>
<ul>
<li>현재 내 위치를 먼저 확인을 해줘야 불필요한 <code>dfs</code>함수 반복을 가지치기할 수 있습니다.</li>
<li>따라서 이동할 위치에 <code>3</code>이 들어있다면 <code>answer = 1</code>을 저장합니다.</li>
<li>이 때 주의할 점은 <code>return 1</code>은 해당 재귀가 종료되고 돌아가는 시점에 사용되지 않아 사라지는 값이므로 <code>answer</code>에 <code>1</code>을 꼭 저장해야합니다.</li>
<li><code>answer</code>값은 <code>dfs</code>문의 마지막에서 <code>return answer;</code>로 반환하게 됩니다.</li>
<li>현재 방문 여부도 <code>visitied[row][col]</code>에 저장합니다.</li>
<li><code>for</code> 반복문은 <code>상하좌우</code>를 돌아가기 때문에 <code>0 ~ 3</code>까지 4번 반복합니다.</li>
<li>좌표 이동하는 코드는 전역 변수로 설정합니다.</li>
<li><code>nr &amp; nc</code>로 이동할 값을 저장합니다.</li>
<li>이동할 방향에 대한 조건을 확인합니다.<ul>
<li>미로 범위 내에 있는 위치인가?</li>
<li>이동할 위치가 벽인가?</li>
<li>이미 방문했던 위치인가?</li>
</ul>
</li>
<li>위의 조건을 하나라도 만족하면 해당 <code>for</code>문을 빠져나옵니다.<ul>
<li>만약 <code>i = 0</code> 이라고 한다면 <code>i = 1</code>로 넘어간다는 뜻입니다.</li>
<li>이 때, <code>dfs</code>함수도 건너뛰게 됩니다.</li>
</ul>
</li>
<li>하나도 만족하지 않는다면 <code>dfs</code>를 반복하며 다음 위치로 이동하게 됩니다.</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>continue &amp; break</code></span></strong></p>
</blockquote>
<ul>
<li><code>continue</code><ul>
<li>현재 반복문을 건너뛰고 다음 반복문으로 넘어갑니다.</li>
</ul>
</li>
<li><code>break</code><ul>
<li>반복문 자체를 종료해서 빠져나옵니다.</li>
</ul>
</li>
</ul>
<pre><code class="language-java">
for (int i = 0; i &lt; 5; i++) {
    if (i == 3) {
        continue;
    }
    System.out.print(i + &quot; &quot;);
}

// 출력 : 0 1 2 4

for (int i = 0; i &lt; 5; i++) {
    if (i == 3) {
        break;
    }
    System.out.print(i + &quot; &quot;);
}

// 출력 : 0 1 2
</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[[SWEA] 1219. [S/W 문제해결 기본] 4일차 - 길찾기]]></title>
            <link>https://velog.io/@xaexun_/1219.-SW-%EB%AC%B8%EC%A0%9C%ED%95%B4%EA%B2%B0-%EA%B8%B0%EB%B3%B8-4%EC%9D%BC%EC%B0%A8-%EA%B8%B8%EC%B0%BE%EA%B8%B0</link>
            <guid>https://velog.io/@xaexun_/1219.-SW-%EB%AC%B8%EC%A0%9C%ED%95%B4%EA%B2%B0-%EA%B8%B0%EB%B3%B8-4%EC%9D%BC%EC%B0%A8-%EA%B8%B8%EC%B0%BE%EA%B8%B0</guid>
            <pubDate>Wed, 22 Apr 2026 02:30:51 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>그림과 같이 도식화한 지도에서 A도시에서 출발하여 B도시로 가는 길이 존재하는지 조사하려고 한다.
길 중간 중간에는 최대 2개의 갈림길이 존재하고, 모든 길은 일방 통행으로 되돌아오는 것이 불가능하다.
다음과 같이 길이 주어질 때, A도시에서 B도시로 가는 길이 존재하는지 알아내는 프로그램을 작성하여라.</p>
<ul>
<li>A와 B는 숫자 0과 99으로 고정된다.</li>
<li>모든 길은 순서쌍으로 나타내어진다. 위 예시에서 2번에서 출발 할 수 있는 길의 표현은 (2, 5), (2, 9)로 나타낼 수 있다.</li>
<li>가는 길의 개수와 상관없이 한가지 길이라도 존재한다면 길이 존재하는 것이다.</li>
<li>단 화살표 방향을 거슬러 돌아갈 수는 없다.</li>
</ul>
<p><strong>[제약 사항]</strong>
출발점은 0, 도착점은 99으로 표현된다.
정점(분기점)의 개수는 98개(출발점과 도착점 제외)를 넘어가지 않으며, 한 개의 정점에서 선택할 수 있는 길의 개수도 2개를 넘어가지 않는다.
아래 제시된 가이드 라인은 제안사항일 뿐 강제사항은 아니다.</p>
<p><strong>[데이터 저장 가이드]</strong>
정점(분기점)의 개수가 최대 100개 이기 때문에, size [100]의 정적 배열 2개을 선언하여, 각 정점의 번호를 주소로 사용하고, 저장되는 데이터는 각 정점에서 도착하는 정점의 번호를 저장한다.
위 그림을 저장하였을 때 결과는 다음과 같다.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>총 10개의 테스트 케이스가 주어진다.
각 테스트 케이스의 첫 줄에는 테스트 케이스의 번호와 길의 총 개수가 공백으로 분리되어 주어진다.
그 다음 줄에는 순서쌍이 주어진다. 순서쌍의 경우, 별도로 나누어 표현되는 것이 아니라 숫자의 나열이며, 나열된 순서대로 순서쌍을 이룬다.</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>#부호와 함께 테스트 케이스의 번호를 출력하고, 공백 문자 후 테스트 케이스에 대한 답(가능 여부)을 출력한다.
가능할 경우 1, 불가능할 경우 0을 출력한다.</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>1 16
0 1 0 2 1 4 1 3 4 8 4 3 2 9 2 5 5 6 5 7 7 99 7 9 9 8 9 10 6 10 3 7</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>#1 1</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">package live08._02_길찾기;

import java.util.*;
import java.io.*;

public class Solution {
    static boolean[][] graph;
    static boolean[] visited;
    static int tcNum, wayNum;

    static void dfs(int idx) {
        if (visited[99]) {
            return;
        }
        visited[idx] = true;
        for (int i = 0; i &lt; 100; i++) {
            if (!visited[i] &amp;&amp; graph[idx][i]) {
                dfs(i);
            }
        }
    }

    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(&quot;src/live08/_02_길찾기/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        int T = 10;

        for (int tc = 1; tc &lt;= T; tc++) {
            st = new StringTokenizer(br.readLine());
            tcNum = Integer.parseInt(st.nextToken());
            wayNum = Integer.parseInt(st.nextToken());

            graph = new boolean[100][100];
            visited = new boolean[100];

            st = new StringTokenizer(br.readLine());

            for (int i = 0; i &lt; wayNum; i++) {
                int x = Integer.parseInt(st.nextToken());
                int y = Integer.parseInt(st.nextToken());

                graph[x][y] = true;
            }

            dfs(0);

            bw.write(&quot;#&quot; + tcNum + &quot; &quot; + (visited[99] ? 1 : 0) + &quot;\n&quot;);

        }

        bw.close();
        br.close();
    }
}</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
</blockquote>
<ul>
<li>이전에 풀었던 정석적인 <code>DFS</code> 구현이 크게 달라진점이 없다.</li>
<li>다만, 이번에는 <code>100 × 100</code> 짜리 2차원 배열을 사용하고, 반복문이 최대 100번 반복하게 된다.</li>
<li>그래서 <code>dfs</code> 함수 내부에 조건 만족 시 <code>dfs</code>를 종료하는 <code>return;</code> 을 추가했다.</li>
<li>정점들을 방문하면서 방문 여부를 <code>visited[idx] = true;</code>로 기록하고,</li>
<li>99번 정점을 방문했을 때 <code>1</code>을 출력하고, 모든 정점을 방문해도 99번 정점을 방문하지 못하였을 때 <code>0</code>을 출력한다.</li>
</ul>
<blockquote>
<p><strong><span style="color: blue"><code>어려웠던 점</code></span></strong></p>
</blockquote>
<ul>
<li>연결 정보를 저장하는 것이 어려웠다.</li>
<li>순서쌍 개수를 알려주고, 순서쌍 정보를 한 줄로 나열하였기 때문에</li>
<li>두 개씩 묶어서 값을 받는 것을 생각하기 어려웠다.</li>
<li>근데 구현하고 보니 쉬워보인다.</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[BOJ] 24479. 깊이 우선 탐색 1]]></title>
            <link>https://velog.io/@xaexun_/BOJ-24479.-%EA%B9%8A%EC%9D%B4-%EC%9A%B0%EC%84%A0-%ED%83%90%EC%83%89-1</link>
            <guid>https://velog.io/@xaexun_/BOJ-24479.-%EA%B9%8A%EC%9D%B4-%EC%9A%B0%EC%84%A0-%ED%83%90%EC%83%89-1</guid>
            <pubDate>Tue, 21 Apr 2026 15:07:14 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>N개의 정점과 M개의 간선으로 구성된 무방향 그래프(undirected graph)가 주어진다. 정점 번호는 1번부터 N번이고 모든 간선의 가중치는 1이다. 정점 R에서 시작하여 깊이 우선 탐색으로 노드를 방문할 경우 노드의 방문 순서를 출력하자.
인접 정점은 오름차순으로 방문한다.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>첫째 줄에 정점의 수 N (5 ≤ N ≤ 100,000), 간선의 수 M (1 ≤ M ≤ 200,000), 시작 정점 R (1 ≤ R ≤ N)이 주어진다.</p>
<p>다음 M개 줄에 간선 정보 u v가 주어지며 정점 u와 정점 v의 가중치 1인 양방향 간선을 나타낸다. (1 ≤ u &lt; v ≤ N, u ≠ v) 모든 간선의 (u, v) 쌍의 값은 서로 다르다.</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>첫째 줄부터 N개의 줄에 정수를 한 개씩 출력한다. i번째 줄에는 정점 i의 방문 순서를 출력한다. 시작 정점의 방문 순서는 1이다. 시작 정점에서 방문할 수 없는 경우 0을 출력한다.</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>5 5 1
1 4
1 2
2 3
2 4
3 4</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>1
2
3
4
0</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">// 깊이 우선 탐색 1

package _00_TodayProblem.tp03._00_inflearn._02_24479;

import java.util.*;
import java.io.*;

public class Solution {
    final static int MAX = 1000000 + 10;
    static ArrayList&lt;Integer&gt;[] graph;
    static boolean[] visited;
    static int N, M, R;
    static int[] answer;
    static int order; // 순서를 담고 있음

    static void dfs(int idx) {
        visited[idx] = true;
        answer[idx] = order;
        order++;

        for (int i = 0; i &lt; graph[idx].size(); i++) {
            int next = graph[idx].get(i);

            if (visited[next] == false) {
                dfs(next);
            }
        }
    }

    public static void main(String[] args) throws IOException {
        // 0. 입력 및 초기화
        System.setIn(new FileInputStream(&quot;src/_00_TodayProblem/tp03/_00_inflearn/_02_24479/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        st = new StringTokenizer(br.readLine());
        N = Integer.parseInt(st.nextToken());
        M = Integer.parseInt(st.nextToken());
        R = Integer.parseInt(st.nextToken());

        // 1. graph에 연결 정보 채우기
        graph = new ArrayList[MAX];
        for (int i = 1; i &lt;= N; i++) {
            graph[i] = new ArrayList&lt;&gt;();
        }

        visited = new boolean[MAX];
        answer = new int[MAX];
        order = 1;

        for (int i = 0; i &lt; M; i++) {
            st = new StringTokenizer(br.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());

            graph[u].add(v);
            graph[v].add(u);
        }

        // 2. 오름차순 정렬
        for (int i = 1; i &lt;= N; i++) {
            Collections.sort(graph[i]);
        }

        // 3. dfs 재귀함수 호출
        dfs(R);

        // 4. 출력
        for (int i = 1; i &lt;= N; i++) {
            bw.write(String.valueOf(answer[i]));
            bw.newLine();

        }

        bw.close();
        br.close();
    }
}</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>핵심 로직</code></span></strong></p>
</blockquote>
<ul>
<li>리스트 배열의 각 인덱스가 <code>i</code>번째 정점의 순서가 됩니다.</li>
<li>각 리스트에는 해당 정점과 이어지는 모든 정점을 요소로 받습니다.</li>
<li>조건이 오름차순이기때문에, 각 리스트들의 요소들을 오름차순으로 정렬해줍니다.</li>
<li><code>answer</code>배열에는 DFS를 방문하는 순서를 담아줍니다.<ul>
<li><code>answer</code>배열의 각 인덱스는 정점 번호</li>
<li><code>answer[idx]</code>에 저장되는 값은 그 정점에 몇 번째로 방문했는지</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>전역 변수</code></span></strong></p>
</blockquote>
<ul>
<li><code>final static int MAX = 1000000 + 10;</code><ul>
<li><code>N</code>값의 범위</li>
</ul>
</li>
<li><code>static ArrayList&lt;Integer&gt;[] graph;</code><ul>
<li>2차원 배열 <code>N × N</code>으로 하면, 값이 100억입니다.</li>
<li><code>ArrayList&lt;&gt;[]</code>를 사용해서 동적 할당합니다.</li>
<li>이는 <code>ArrayList</code>의 각 인덱스가 <code>u</code>값이 되고, 해당 인덱스에 <code>v</code>값이 저장되는 것입니다.</li>
</ul>
</li>
<li><code>static boolean[] visited;</code><ul>
<li>방문 여부는 이전 DFS 코드와 동일합니다.</li>
</ul>
</li>
<li><code>static int N, M, R;</code><ul>
<li>정점의 수 <code>N</code></li>
<li>간선의 수 <code>M</code></li>
<li>시작 정점 <code>R</code></li>
</ul>
</li>
<li><code>static int[] answer;</code><ul>
<li>방문 순서를 저장할 배열</li>
</ul>
</li>
<li><code>static int order;</code><ul>
<li>현재 방문 위치</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>graph에 연결 정보 채우기</code></span></strong></p>
</blockquote>
<ul>
<li>값이 10만개가 들어올 수 있으니, 아래의 값들의 크기를 <code>MAX</code>로 잡습니다.<ul>
<li>전체 그래프인 <code>정수형 ArrayList</code>타입 <code>graph</code> 배열의 크기</li>
<li>방문 여부를 판단하는 정수형 <code>visited</code> 배열의 크기</li>
</ul>
</li>
<li>그리고 각 인덱스를 <code>ArrayList</code>로 구성하여 리스트들을 담는 배열로 만듭니다.</li>
<li>각 리스트에는 <code>i</code>번 정점과 연결된 정점들을 담습니다.</li>
<li><code>order</code>는 현재 DFS를 방문하는 순서를 담는 변수라서 <code>1</code>로 초기화합니다.</li>
<li><code>for</code>문에서 값을 받아오고, 각 정점의 연결 정보를 그래프에 담습니다.</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>오름차순 정렬과 DFS 호출</code></span></strong></p>
</blockquote>
<ul>
<li><code>Collections.sort();</code> 함수로 각 리스트의 요소들을 오름차순으로 정렬합니다.</li>
<li>인접 정점은 오름차순으로 방문하기 때문이죠.</li>
<li>시작 값은 <code>R</code>로 주어져있으니 넣어주면 됩니다. <code>dfs(R);</code></li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>dfs 출력</code></span></strong></p>
</blockquote>
<ul>
<li><code>dfs</code>함수가 모두 돌아서 방문이 완료되었다는 가정 하에 출력을 작성합니다.</li>
<li><code>answer</code>의 각 요소(방문 순서)를 출력하기 위해 반복문을 작성하고, 안에 같이 줄바꿈을 해줍니다.</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color: blue"><code>dfs 구현</code></span></strong></p>
</blockquote>
<ul>
<li><code>R</code>번째(=<code>idx</code>) 정점을 방문하였으니 <code>visited[idx] = true;</code></li>
<li>해당 정점을 첫 번째로 방문하였으니 <code>answer[idx] = order;</code>를 넣어줍니다. 이 때 <code>order</code>의 값은 <code>1</code>입니다.</li>
<li>이 후 추가 <code>dfs</code> 방문 시 해당 순서를 <code>order++;</code>로 저장합니다.</li>
<li>이제 반복문에서 해당 정점과 연결된 정점 리스트들을 순회하면서 재귀합니다.<ul>
<li>각 정점마다 연결되어있는 정점들의 수가 다르기 때문에 조건식에는 <code>graph[idx].size();</code>가 들어갑니다.</li>
<li>각 정점 리스트들 중 방문할 다음 요소를 첫 번째 요소(연결된 정점)부터 <code>next</code>변수에 담아줍니다.</li>
<li>처음 방문은 <code>R</code>번째 정점이 했으니, <code>next</code> 변수는 이제 방문할 두 번째 정점입니다.</li>
<li>그 정점을 방문하지 않았을 때 <code>dfs(next);</code>를 실행하여 두 번째 정점과 연결되어 있으며, 방문하지 않은 세 번째 정점을 찾게됩니다.</li>
</ul>
</li>
<li>이때 이미 오른차순으로 정렬이 되어있기 때문에 예시 입력에 대한 출력 값은 아래와 같습니다.<pre><code>1 
2
3
4
0</code></pre></li>
<li>마지막으로 <code>answer [5]</code>인 경우 해당 정점에 연결된 정점 리스트가 없기 때문에, 초기화된 값 <code>0</code>이 그대로 나오게 됩니다.</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[BOJ] 11724. 연결 요소의 개수]]></title>
            <link>https://velog.io/@xaexun_/BOJ-11724.-%EC%97%B0%EA%B2%B0-%EC%9A%94%EC%86%8C%EC%9D%98-%EA%B0%9C%EC%88%98</link>
            <guid>https://velog.io/@xaexun_/BOJ-11724.-%EC%97%B0%EA%B2%B0-%EC%9A%94%EC%86%8C%EC%9D%98-%EA%B0%9C%EC%88%98</guid>
            <pubDate>Tue, 21 Apr 2026 15:07:04 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>방향 없는 그래프가 주어졌을 때, 연결 요소 (Connected Component)의 개수를 구하는 프로그램을 작성하시오.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>첫째 줄에 정점의 개수 N과 간선의 개수 M이 주어진다. (1 ≤ N ≤ 1,000, 0 ≤ M ≤ N×(N-1)/2) 둘째 줄부터 M개의 줄에 간선의 양 끝점 u와 v가 주어진다. (1 ≤ u, v ≤ N, u ≠ v) 같은 간선은 한 번만 주어진다</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>첫째 줄에 연결 요소의 개수를 출력한다.</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>6 5
1 2
2 5
5 1
3 4
4 6</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<pre><code>2</code></pre><p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">// 연결 요소의 개수

package _00_TodayProblem.tp03._00_inflearn._02_11724;

import java.util.*;
import java.io.*;

public class Solution {
    final static int MAX = 1000 + 10;
    static boolean[][] graph;
    static boolean[] visited;
    static int N, M;
    static int answer;

    public static void dfs(int idx) {
        visited[idx] = true;

        for (int i = 1; i &lt;= N; i++) {
            if (visited[i] == false &amp;&amp; graph[idx][i]) {
                dfs(i);
            }
        }

    }

    public static void main(String[] args) throws IOException {
        // 0. 입력과 출력
        System.setIn(new FileInputStream(&quot;src/_00_TodayProblem/tp03/_00_inflearn/_02_11724/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        st = new StringTokenizer(br.readLine());
        N = Integer.parseInt(st.nextToken());
        M = Integer.parseInt(st.nextToken());

        graph = new boolean[N + 1][N + 1];
        visited = new boolean[N + 1];

        for (int i = 0; i &lt; M; i++) {
            st = new StringTokenizer(br.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());

            graph[u][v] = true;
            graph[v][u] = true;
        }

        // dfs를 어떻게 시작할 것인가가 중요함.
        for (int i = 1; i &lt;= N; i++) {
            if (visited[i] == false) {
                dfs(i);
                answer++;
            }
        }

        bw.write(String.valueOf(answer));
        bw.close();
        br.close();
    }
}</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
</blockquote>
<ul>
<li>입력 및 출력, 초기화, 연결 정보 저장까지 바이러스 문제와 동일하기에 코드가 전반적으로 비슷합니다.</li>
<li>바이러스는 연결된 정점의 갯수를 구하는 거였다면, 이 문제는 연결 요소의 개수 즉, 연결되어있는 덩어리가 몇 개인지를 출력하는 것이 문제의 요건입니다.</li>
<li>그렇기 때문에, 그래프를 그려보았을 때 연결된 정점 그룹들이 나누어져있는 것을 확인할 수 있습니다.</li>
<li>이 말은 즉, <code>dfs</code>를 바이러스와 동일하게 방문하면, 방문하지 않게 되는 연결된 정점 그룹이 있다는 이야기입니다.</li>
<li>따라서, 조건을 충족시키기 위해 출력을 다음과 같이 작성합니다.</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color:blue"><code>dfs 출력</code></span></strong></p>
</blockquote>
<ul>
<li>조건을 충족시키려면 <code>visited</code>배열을 모두 채워야합니다. 즉, 모든 정점들을 방문해야한다는 것입니다.</li>
<li>따라서, 모든 정점들을 방문하기 위해서 정점의 개수만큼 <code>dfs(i)</code>함수를 반복합니다.</li>
<li>이 때, 이미 방문했던 정점들은 방문하지 않아도 되기 때문에 <code>visited[i] == false</code>라는 조건을 걸어줍니다.</li>
<li>마지막으로 <code>for</code>문에서 <code>dfs(i)</code>함수를 반복한 횟수가 곧 연결 요소의 개수가 되기 때문에, <code>answer++;</code>를 실행합니다.</li>
</ul>
<blockquote>
<p>💡 <strong><span style="color:blue"><code>dfs 구현</code></span></strong></p>
</blockquote>
<ul>
<li>이제 마지막으로 <code>dfs</code>를 구현하면 끝입니다.</li>
<li>바이러스와 <code>dfs</code>함수 구현은 비슷하나, 다른 점은 방문 여부만 확인하면 된다는 점입니다.</li>
<li>그래서 <code>dfs</code> 함수에는 <code>visited[idx]</code> 값만 수정하는 로직이 담겨있습니다.</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[BOJ] 2606. 바이러스]]></title>
            <link>https://velog.io/@xaexun_/BOJ-2606.-%EB%B0%94%EC%9D%B4%EB%9F%AC%EC%8A%A4</link>
            <guid>https://velog.io/@xaexun_/BOJ-2606.-%EB%B0%94%EC%9D%B4%EB%9F%AC%EC%8A%A4</guid>
            <pubDate>Tue, 21 Apr 2026 07:21:32 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>신종 바이러스인 웜 바이러스는 네트워크를 통해 전파된다. 한 컴퓨터가 웜 바이러스에 걸리면 그 컴퓨터와 네트워크 상에서 연결되어 있는 모든 컴퓨터는 웜 바이러스에 걸리게 된다.</p>
<p>예를 들어 7대의 컴퓨터가 &lt;그림 1&gt;과 같이 네트워크 상에서 연결되어 있다고 하자. 1번 컴퓨터가 웜 바이러스에 걸리면 웜 바이러스는 2번과 5번 컴퓨터를 거쳐 3번과 6번 컴퓨터까지 전파되어 2, 3, 5, 6 네 대의 컴퓨터는 웜 바이러스에 걸리게 된다. 하지만 4번과 7번 컴퓨터는 1번 컴퓨터와 네트워크상에서 연결되어 있지 않기 때문에 영향을 받지 않는다.</p>
<p>어느 날 1번 컴퓨터가 웜 바이러스에 걸렸다. 컴퓨터의 수와 네트워크 상에서 서로 연결되어 있는 정보가 주어질 때, 1번 컴퓨터를 통해 웜 바이러스에 걸리게 되는 컴퓨터의 수를 출력하는 프로그램을 작성하시오.</p>
<p><span></span></p>
<h2 id="입력">입력</h2>
<p>첫째 줄에는 컴퓨터의 수가 주어진다. 컴퓨터의 수는 100 이하인 양의 정수이고 각 컴퓨터에는 1번 부터 차례대로 번호가 매겨진다. 둘째 줄에는 네트워크 상에서 직접 연결되어 있는 컴퓨터 쌍의 수가 주어진다. 이어서 그 수만큼 한 줄에 한 쌍씩 네트워크 상에서 직접 연결되어 있는 컴퓨터의 번호 쌍이 주어진다.</p>
<p><span></span></p>
<h2 id="출력">출력</h2>
<p>1번 컴퓨터가 웜 바이러스에 걸렸을 때, 1번 컴퓨터를 통해 웜 바이러스에 걸리게 되는 컴퓨터의 수를 첫째 줄에 출력한다.</p>
<p><span></span></p>
<h2 id="예제-입력">예제 입력</h2>
<pre><code>7
6
1 2
2 3
1 5
5 2
5 6
4 7</code></pre><p><span></span></p>
<h2 id="예제-출력">예제 출력</h2>
<p><code>4</code></p>
<p><span></span></p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">package _00_TodayProblem.tp03._00_inflearn._03_2606;

import java.util.*;
import java.io.*;

public class Solution {
    static boolean[][] graph;
    static boolean[] visited;
    static int N, M;
    static int answer;

    // 4) dfs 구현
    public static void dfs(int idx) {
        visited[idx] = true;
        answer++;

        for (int i = 1; i &lt;= N; i++) {
            if (visited[i] == false &amp;&amp; graph[idx][i]) {
                dfs(i);
            }
        }
    }

    public static void main(String[] args) throws IOException {
        // 0. 입력과 초기화
        System.setIn(new FileInputStream(&quot;src/_00_TodayProblem/tp03/_00_inflearn/_03_2606/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        N = Integer.parseInt(br.readLine());
        M = Integer.parseInt(br.readLine());

        graph = new boolean[N + 1][N + 1];
        visited = new boolean[N + 1];

        // 1. graph에 연결 정보 채우기
        for (int i = 0; i &lt; M; i++) {
            st = new StringTokenizer(br.readLine());
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());

            graph[x][y] = true;
            graph[y][x] = true;
        }

        // 2. dfs(재귀함수) 호출
        dfs(1);

        // 3. 출력
        bw.write(String.valueOf(answer - 1));
        br.close();
        bw.close();        
    }
}</code></pre>
<p><span></span></p>
<h2 id="풀이">풀이</h2>
<blockquote>
<p>💡<strong><span style="color: blue"><code>초기화</code></span></strong>
<code>1번 컴퓨터부터 7번 컴퓨터까지</code> 있기 때문에 인덱스에는 <code>+1</code>을 해야합니다.
이는 예제 입력값을 보면 이해하기 더 쉽습니다. 따라서,</p>
</blockquote>
<ul>
<li><code>graph = new boolean[N + 1][N + 1];</code></li>
<li><code>visited = new boolean[N + 1];</code></li>
</ul>
<blockquote>
<p>💡<strong><span style="color: blue"><code>graph에 연결 정보 채우기</code></span></strong></p>
</blockquote>
<ul>
<li>컴퓨터 쌍의 수 즉, 간선의 갯수만큼 <code>graph</code>에 채워야합니다.</li>
<li><code>StringTokenizer</code>로 값을 받아와 타입에 맞춰 변수에 담아줍니다.</li>
<li>받아온 <code>x</code>와 <code>y</code> 값은 간선으로 이어진 두 정점이며,</li>
<li><code>graph[x][y] = true; &amp; graph[y][x] = true;</code><ul>
<li><code>x정점</code>기준으로 연결된 <code>y정점</code>과 <code>y정점</code>기준으로 연결된 <code>x정점</code>을 의미합니다..</li>
<li>만약 <code>graph[x][y] = true;</code>만 있고, 입력값이 <code>2 1</code>이라고 들어오면<ul>
<li><code>dfs(1)</code>일 때 <code>1 2</code>가 없기 때문에 재귀함수가 바로 종료됩니다..</li>
</ul>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡<strong><span style="color: blue"><code>dfs 호출과 출력</code></span></strong></p>
</blockquote>
<ul>
<li><code>1번 컴퓨터</code>부터 시작한다고 했으니 <code>dfs(1)</code></li>
<li><code>BufferedWriter</code>를 사용하여 문자열 출력</li>
</ul>
<blockquote>
<p>💡<strong><span style="color: blue"><code>dfs 구현</code></span></strong></p>
</blockquote>
<ul>
<li><code>1번 컴퓨터</code>에서 시작하니 <code>visited[1] = true;</code>가 됩니다.</li>
<li>재귀가 진행될 때마다 <strong>방문한 컴퓨터의 갯수</strong>가 하나씩 증가하게 됩니다. <code>answer++;</code></li>
<li><code>visited[i] == false &amp;&amp; graph[idx][i]</code><ul>
<li><code>visited[i]</code><ul>
<li>방문 여부를 따지는 배열입니다.</li>
</ul>
</li>
<li><code>graph[idx][i]</code><ul>
<li><code>idx</code>라는 정점과 <code>i</code>라는 정점이 연결되어있는지 확인합니다.</li>
<li>이는 연결 정보 채우기에서 값을 <code>true</code>로 채운 값들이 조건이 됩니다.</li>
</ul>
</li>
</ul>
</li>
<li><code>idx = 1</code>이 들어왔을 때 <code>visited[1] = true;</code>가 되며,</li>
<li><code>i = 1</code>일 때 <code>visited[1] == false</code> 조건을 만족하지 못해 다음 반복문으로 넘어갑니다.</li>
<li><code>i = 2</code>일 때 <code>visited[2] == false &amp;&amp; graph[1][2]</code>는 성립합니다.</li>
<li>따라서, <code>dfs(2)</code>를 호출하게 되면서 <code>2번 컴퓨터</code>를 방문하게 됩니다.</li>
<li>이 때 함수가 재귀되면서, <code>visited[2] = true</code>로 방문했다는 점을 남깁니다.</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[BOJ] 2745. 진법 변환]]></title>
            <link>https://velog.io/@xaexun_/BOJ-2745.-%EC%A7%84%EB%B2%95-%EB%B3%80%ED%99%98</link>
            <guid>https://velog.io/@xaexun_/BOJ-2745.-%EC%A7%84%EB%B2%95-%EB%B3%80%ED%99%98</guid>
            <pubDate>Mon, 20 Apr 2026 14:37:59 GMT</pubDate>
            <description><![CDATA[<h2 id="문제">문제</h2>
<p>B진법 수 N이 주어진다. 이 수를 10진법으로 바꿔 출력하는 프로그램을 작성하시오.
10진법을 넘어가는 진법은 숫자로 표시할 수 없는 자리가 있다. 이런 경우에는 다음과 같이 알파벳 대문자를 사용한다.</p>
<h2 id="입력">입력</h2>
<p>첫째 줄에 N과 B가 주어진다. (2 ≤ B ≤ 36)
B진법 수 N을 10진법으로 바꾸면, 항상 10억보다 작거나 같다.</p>
<h2 id="출력">출력</h2>
<p>첫째 줄에 B진법 수 N을 10진법으로 출력한다.</p>
<h2 id="예제-입력">예제 입력</h2>
<p>ZZZZZ 36</p>
<h2 id="예제-출력">예제 출력</h2>
<p>60466175</p>
<h2 id="코드">코드</h2>
<pre><code class="language-java">// 진법 변환

package _00_TodayProblem.tp02._05_2745;

import java.util.*;
import java.io.*;

public class Solution {

    static int bToDecimal(char ch) {
        if (ch &gt;= &#39;0&#39; &amp;&amp; ch &lt;= &#39;9&#39;) {
            return ch - &#39;0&#39;;
        } else {
            return ch - &#39;A&#39; + 10;
        }
    }

    public static void main(String[] args) throws IOException {
        System.setIn(new FileInputStream(&quot;src/_00_TodayProblem/tp02/_05_2745/input.txt&quot;));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;

        st = new StringTokenizer(br.readLine());
        String N = st.nextToken();
        int B = Integer.parseInt(st.nextToken());

        int sum = 0;

        for (int i = 0; i &lt; N.length(); i++) {
            int num = bToDecimal(N.charAt(i));
            sum = sum * B + num;
        }
        System.out.print(sum);
        br.close();
    }
}</code></pre>
<h2 id="풀이">풀이</h2>
<blockquote>
<p><strong><span style="color: blue"><code>bToDecimal</code></span></strong></p>
</blockquote>
<ul>
<li>Java에서는 문자끼리 연산하면 <code>ascii</code> 값으로 반환된다.</li>
<li><code>ascii</code> 순서만 안다면, 일관된 값을 반환할 수 있다.</li>
<li><code>ascii</code> 순서<ul>
<li><code>0 ~ 9, A ~ Z, a ~ b</code></li>
</ul>
</li>
<li>문자가 <code>0</code> ~ <code>9</code> 사이로 들어왔을 때<ul>
<li>문자 그대로 출력하면 되니, 문자형 <code>0</code>을 빼서 정수형 <code>0</code>을 반환한다.</li>
</ul>
</li>
<li>문자가 <code>A</code> ~ <code>Z</code> 사이로 들어왔을 때<ul>
<li>들어온 문자에 대해 알파벳 중 최솟값인 <code>A</code>를 빼서 <code>A</code>의 값이 <code>0</code>이 되도록 한다.</li>
<li>이 때 <code>0</code> ~ <code>9</code> 사이의 값 뒤로 알파벳을 배치해야 올바른 정렬이 된다. 따라서, <code>+10</code>을 한다.</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong><span style="color: blue"><code>main</code></span></strong></p>
</blockquote>
<ul>
<li>진법을 계산하는 공식은 다음과 같다<ul>
<li>ex) 8진수 : <code>abcde</code><ul>
<li><code>e</code>값의 범위 : <code>0 ~ 7</code> = <code>8⁰ × (0 ~ 7)</code></li>
<li><code>d</code>값의 범위 : <code>8 ~ 56</code> = <code>8¹ × (0 ~ 7)</code>
...</li>
<li><code>a</code>값의 범위: 4,096 ~ 28,672 = <code>8⁴ × (0 ~ 7)</code></li>
</ul>
</li>
</ul>
</li>
<li>즉, <code>8ⁱ × 변환된 값(0 ~ 7 사이의 값)</code> 이 된다.</li>
<li><code>bToDecimal</code> 함수로 변환된 값을 <code>num</code> 변수에 받고, 예시 입력을 적용시키면,<ul>
<li><code>Bⁱ * num</code> 이라는 <code>Java</code> 공식이 나온다.</li>
<li>이 때 <code>i = 4, 3, 2, 1, 0</code> 이라면 <ul>
<li><code>B⁴ * num + B³ * num + B² * num + B¹ * num + B⁰ * num</code></li>
<li><code>= ((((num * B + num)B + num)B * num)B + num</code></li>
<li><code>(이 때 각 num의 값은 같거나 다를 수 있음)</code></li>
<li>이 되는데, 반복횟수에 따라서 동일한 제곱값을 갖는 걸 알 수 있다.</li>
<li>이 계산 방법이 바로 <code>sum = sum * B + num;</code> 에 해당하는 내용이다.</li>
</ul>
</li>
</ul>
</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[4. SQL 활용 : 고급 SQL]]></title>
            <link>https://velog.io/@xaexun_/4.-SQL-%ED%99%9C%EC%9A%A9-%EA%B3%A0%EA%B8%89-SQL</link>
            <guid>https://velog.io/@xaexun_/4.-SQL-%ED%99%9C%EC%9A%A9-%EA%B3%A0%EA%B8%89-SQL</guid>
            <pubDate>Wed, 15 Apr 2026 15:38:24 GMT</pubDate>
            <description><![CDATA[<h1 id="chapter-2--고급-sql">Chapter 2 : 고급 SQL</h1>
<hr>
<h2 id="🍀-section-1--인덱스-활용">🍀 Section 1 | 인덱스 활용</h2>
<h3 id="1-index">1. INDEX</h3>
<p><strong>1) 인덱스 개념</strong></p>
<ul>
<li>데이터를 빠르게 찾을 수 있는 수단</li>
<li>테이블에 대한 <strong>조회 속도를 높여주는 자료구조</strong></li>
<li>테이블의 특정 레코드 위치를 알려주는 용도로 사용</li>
<li>테이블에서 기본키로 지정할 경우 자동으로 인덱스가 생성된다.</li>
</ul>
<p><span></span>
<strong>2) 인덱스 활용</strong></p>
<p><span style="color: blue">2-1) 인덱스 생성</span></p>
<pre><code class="language-sql">CREATE [UNIQUE] INDEX &lt;index_name&gt; ON &lt;table_name&gt; (&lt;column(s)&gt;);</code></pre>
<ul>
<li>각각의 파라미터가 의미하는 내용은 다음과 같다.</li>
</ul>
<table>
<thead>
<tr>
<th>파라미터</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>[UNIQUE]</code></strong></td>
<td>인덱스가 걸린 컬럼에 중복값을 허용하지 않음 (생략 가능)</td>
</tr>
<tr>
<td><strong><code>&lt;index_name&gt;</code></strong></td>
<td>생성하고자 하는 인덱스 테이블 이름</td>
</tr>
<tr>
<td><strong><code>&lt;table_name&gt;</code></strong></td>
<td>인덱스 대상 테이블 이름</td>
</tr>
<tr>
<td><strong><code>&lt;column(s)&gt;</code></strong></td>
<td>인덱스 대상 테이블의 특정 컬럼 이름(들)</td>
</tr>
</tbody></table>
<p><span></span>
<span style="color: blue">2-2) 인덱스 변경</span></p>
<pre><code class="language-sql">ALTER [UNIQUE] INDEX &lt;index_name&gt; ON &lt;table_name&gt; (&lt;column(s)&gt;);</code></pre>
<ul>
<li>한 번 생성된 인덱스에 대해 변경이 필요한 경우는 드물다.</li>
<li>일부 제품은 인덱스에 대한 변경 <code>SQL</code>문이 없다.</li>
<li>이 경우 인덱스를 삭제하고 신규 인덱스를 생성하는 방식으로 사용이 권고되고 있다.</li>
</ul>
<p><span></span>
<span style="color: blue">2-3) 인덱스 삭제</span></p>
<pre><code class="language-sql">ALTER TABLE &lt;table_name&gt; DROP INDEX &lt;index_name&gt;;</code></pre>
<ul>
<li><code>&lt;index_name&gt;</code>은 생성된 인덱스 이름을 의미한다.</li>
<li>인덱스 관련 명령어에 대한 <code>SQL</code> 표준이 없기에 제품별 <code>DROP</code> 명령문의 사용법은 약간씩 다르다.</li>
<li>보통 인덱스를 테이블의 종속 구조로 생각하여 인덱스를 삭제하기 위해 테이블의 변경을 가하는 형식의 명령을 사용한다.</li>
<li>즉, <code>ALTER TABLE</code> 명령 뒤에 <code>DROP INDEX</code> 명령이 추가되는 형태로 사용된다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 데이터베이스에서 테이블에 있는 데이터를 빠르게 색인하기 위한 기능을 무엇이라고 하는지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong>인덱스(INDEX)</strong></span></li>
</ul>
<hr>
<p><span></span>
<span></span></p>
<h2 id="🍀-section-2--뷰-활용">🍀 Section 2 | 뷰 활용</h2>
<h3 id="1-뷰-view">1. 뷰 (View)</h3>
<p><strong>1) 뷰 개념</strong></p>
<ul>
<li>논리 테이블로서 사용자에게는 테이블과 동일하다. (생성 관점이 아닌 사용 관점에서)</li>
<li>하나의 물리 테이블로부터 생성가능하다.</li>
<li>다수의 테이블 도는 다른 뷰를 이용하여 만들 수 있다.</li>
<li>뷰와 같은 결과를 만들기 위해 조인(Join) 기능을 활용할 수 있다.</li>
<li>뷰가 만들어져 있다면 사용자는 조인 없이하나의 테이블을 대상으로 하는 단순한 질의어를 사용할 수 있다.</li>
</ul>
<p><span></span>
<strong>2) 뷰 특징</strong></p>
<ul>
<li>뷰를 사용하는 주된 이유는 다음과 같은 단순한 질의어를 사용할 수 있기 때문이다.</li>
</ul>
<pre><code class="language-sql">SELECT * FROM &lt;View_Name&gt;;</code></pre>
<ul>
<li>즉, <code>FROM</code> 절에 있는 하나의 <code>&lt;뷰&gt;</code>를 통해 뷰를 구성하는 복수의 <code>&lt;테이블&gt;</code>을 대체하는 단순성에 그 의의가 있다.</li>
<li>또 이러한 기능을 통해 테이블의 중요 데이터 일부만을 제공할 수 있다는 장점이 있다.</li>
</ul>
<blockquote>
<p>👍🏻 <strong>뷰의 장점</strong></p>
</blockquote>
<ul>
<li><strong>논리적 독립성 제공</strong><ul>
<li>뷰는 논리 테이블이므로 테이블의 구조가 변경되어도 뷰를사용하는 응용 프로그램은 변경하지 않아도 된다.</li>
</ul>
</li>
<li><strong>사용자 데이터 관리 용이</strong><ul>
<li>복수 테이블에 존재하는 여러 종류의 데이터에 대해 단순한 질의어 사용이 가능하다.</li>
</ul>
</li>
<li><strong>데이터 보안 용이</strong><ul>
<li>중요 보안 데이터를 저장 중인 테이블에 접근을 불허한다.</li>
<li>해당 테이블의 일부 정보만을 볼 수 있는 뷰에는 접근을 허용하는 방식</li>
<li>보안 데이터에 대한 접근 제어가 가능하다.</li>
</ul>
</li>
</ul>
<blockquote>
<p>👎🏻 <strong>뷰의 단점</strong></p>
</blockquote>
<ul>
<li><strong>뷰 자체 인덱스 불가</strong><ul>
<li>인덱스는 물리적으로 저장된 데이터를 대상으로 한다.</li>
<li>따라서 논리적 구성인 뷰 자체는 인덱스를 가지지 못한다.</li>
</ul>
</li>
<li><strong>뷰 정의 변경 불가</strong><ul>
<li>뷰의 정의를 변경하려면 뷰를 삭제하고 재생성해야 한다.</li>
</ul>
</li>
<li><strong>데이터 변경 제약 존재</strong><ul>
<li>뷰의 내용에 대한삽입, 삭제, 변경 제약이 있다.</li>
</ul>
</li>
</ul>
<p><span></span>
<strong>3) 뷰 생성</strong></p>
<ul>
<li>뷰 생성 명령의 일반 형태는 다음과 같다.</li>
</ul>
<pre><code class="language-sql">CREATE VIEW &lt;뷰 이름&gt;(컬럼목록) AS &lt;뷰를 통해 보여줄 데이터 조회용 쿼리문&gt;</code></pre>
<p><span style="color: green"><strong><code>[뷰 생성 방법]</code></strong></span></p>
<table>
<thead>
<tr>
<th>상황</th>
<th>뷰 생성 쿼리문</th>
</tr>
</thead>
<tbody><tr>
<td><strong>테이블A 그대로 뷰A</strong></td>
<td><code>CREATE VIEW 뷰A AS SELECT * FROM 테이블A;</code></td>
</tr>
<tr>
<td><strong>테이블A 일부 컬럼 뷰X</strong></td>
<td><code>CREATE VIEW 뷰X AS SELECT 컬럼1, 컬럼2 FROM 테이블A;</code></td>
</tr>
<tr>
<td><strong>테이블A와 테이블B 조인 결과를 뷰Y</strong></td>
<td><code>CREATE VIEW 뷰Y AS SELECT * FROM 테이블A, 테이블B</code></td>
</tr>
<tr>
<td></td>
<td><code>WHERE 테이블A.컬럼1 = 테이블B.컬럼2;</code></td>
</tr>
</tbody></table>
<p><span></span>
<strong>4) 뷰 삭제 및 변경</strong></p>
<ul>
<li>뷰 정의 자체를 변경하는 것은 불가능하다.</li>
<li>뷰를 정의하면 뷰의 물리적 내용은 뷰의 이름과 데이터를 조회하기 위한 쿼리문일 뿐이다.</li>
<li>이때 뷰의 이름이나 쿼리문을 변경하는수단은 제공되지 않는다.</li>
<li>이 경우 뷰의 삭제와 재생성을 통해 뷰에 대한 정의 변경이가능하다.</li>
<li>뷰를 삭제하는 쿼리문은 다음과 같다.</li>
</ul>
<pre><code class="language-sql">DROP VIEW &lt;View_Name&gt;;</code></pre>
<ul>
<li>뷰를 통해 접근 가능한 데이터에 대한 변경이 가능하다.</li>
<li>하지만 모든 경우에 데이터의 변경이 가능한 것이 아니라 일부 제약이 존재한다.</li>
<li>이러한 제약은 뷰 자체가 논리적 개념이기에 물리적 상황에 의존적임을 의미한다.</li>
<li>예를 들어 기본키에 해당하는 컬림이 뷰에 정의되어 있지 않은 경우 <code>INSERT</code>는 불가능하다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 학생 테이블에서 3학년 학생들의 성명, 학년으로 구성된 뷰를 동아리라는 이름으로 생성하려 한다. 동아리 뷰를 생성하는 SQL문을 완성하시오</strong></p>
<pre><code class="language-sql">CREATE VIEW 동아리
(      ) 성명, 학년
FROM 학생
WHERE 학년 = 3;</code></pre>
<ul>
<li>답 : <span style="color: blue"><strong><code>AS SELECT</code></strong></span></li>
</ul>
<hr>
<p><span></span>
<span></span></p>
<h2 id="🍀-section-2--다중-테이블">🍀 Section 2 | 다중 테이블</h2>
<h3 id="1-다중-테이블">1. 다중 테이블</h3>
<ul>
<li>다중 테이블 검색 방법<ul>
<li><code>RDB</code>는 데이터의 중복을 최소화하기 위해 <strong>데이터를 분해하여 저장하고 통합</strong>하여 사용한다.</li>
<li>데이터를 분해하는 방법으로 <strong>정규화 기법</strong>이 사용되며, 통합하는 기법으로 다중 테이블에 대한 검색이 사용된다.</li>
</ul>
</li>
<li>다중 테이블을 이요하는 보다 세부적인 기법은 다음과 같다.</li>
</ul>
<table>
<thead>
<tr>
<th>기법</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>조인</strong></td>
<td>두 개의 테이블을 결합하여 데이터를 추출하는 기법</td>
</tr>
<tr>
<td><strong>서브쿼리</strong></td>
<td>SQL문 안에 포함된 SQl문 형태의 사용 기법</td>
</tr>
<tr>
<td><strong>집합 연산</strong></td>
<td>테이블을 집합 개념으로 조작하는 기법</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="2-조인join">2. 조인(JOIN)</h3>
<p><strong>1) 조인 개념</strong></p>
<ul>
<li><strong>조인은 결합을 의미한다.</strong><ul>
<li><code>RDB</code>에서의 조인은 교집합 결과를 가지는 결합 방법을 의미한다.</li>
</ul>
</li>
<li><strong>조인은 두 테이블의 공통값을 이용하여 컬럼을 조합하는 수단이다.</strong><ul>
<li>보통 기본키와 후보키값을 결합하여 사용하는 것이 일반적이다.</li>
<li>보다 엄밀하게 말핮면 기본키, 후보키와 관계없이 논리적인 값들의 연관을 사용한다.</li>
</ul>
</li>
</ul>
<p><span></span>
<strong>2) 조인 유형</strong></p>
<ul>
<li>조인은 <code>RDB</code>에의 가장 큰 장점이면서 대표적인 핵심 기능이다.</li>
<li>크게 <strong>논리적 조인</strong>과 <strong>물리적 조인</strong>으로 구분할 수 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>논리적 조인</strong></p>
</blockquote>
<ul>
<li>사용자의 <code>SQL</code>문에 표현되는 테이블 결합 방식</li>
<li>두 테이블에 공통으로 존재하는 컬럼을 이용하는 방식 (공통 컬럼 기반)</li>
<li>종류<ul>
<li><strong>내부 조인 <code>Inner Join</code></strong></li>
<li><strong>외부 조인 <code>Outer Join</code></strong></li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong>물리적 조인</strong></p>
</blockquote>
<ul>
<li>DB의 옵티마이저에 의해 내부적으로 발생하는 테이블 결합 방식</li>
<li>틀정 테이블의 모든 데이터를 기준으로 다른 테이블의 정보를 추출<ul>
<li>다른 테이블에 정보가 없어도 출력됨</li>
</ul>
</li>
<li>종류<ul>
<li><strong>중첩 반복 조인 <code>Nested Loop Join</code></strong></li>
<li><strong>정렬 합병 조인 <code>Sort-Merge Join</code></strong></li>
<li><strong>해시 조인 <code>Hash Join</code></strong></li>
</ul>
</li>
</ul>
<p><span></span>
<span style="color: blue">2-1) 논리적 조인</span></p>
<blockquote>
<p>💡 <strong>내부 조인 <code>Inner Join</code></strong></p>
</blockquote>
<ul>
<li><strong>동등 조인 <code>Equi Join</code></strong><ul>
<li>공통 존재 컬럼의 값이 같은 경우를 추출</li>
</ul>
</li>
<li><strong>자연 조인 <code>Natural Join</code></strong><ul>
<li>두 테이블의 모든 컬럼을 비교하여 같은 컬럼명을 가진 모든 컬럼값이 같은 경우를 추출</li>
</ul>
</li>
<li><strong>교차 조인 <code>Cross Join</code></strong><ul>
<li>조인 조건이 없는 모든 데이터의 조합을 추출</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong>외부 조인 <code>Outer Join</code></strong></p>
</blockquote>
<ul>
<li><strong>왼쪽 외부 조인 <code>Left Outer Join</code></strong><ul>
<li>왼쪽 테이블의 모든 데이터와 오른쪽 테이블의 동일 데이터를 추출</li>
</ul>
</li>
<li><strong>오른쪽 외부 조인 <code>Right Outer Join</code></strong><ul>
<li>오른쪽 테이블의 모든 데이터와 왼쪽 테이블의 동일 데이터를 추출</li>
</ul>
</li>
<li><strong>완전 외부 조인 <code>Full Outer Join</code></strong><ul>
<li>양쪽의 모든 데이터를 추출</li>
</ul>
</li>
</ul>
<p><span></span>
<span style="color: blue">2-2) 물리적 조인</span></p>
<blockquote>
<p>💡 <strong>외부 조인 <code>Outer Join</code></strong></p>
</blockquote>
<ul>
<li><strong>중첩 반복 조인 <code>Nested Loop Join</code></strong><ul>
<li>2개 이상의 테이블에서 하나의 집합을 기준으로 바깥 테이블의 처리 범위를 하나씩 액세스하면서 그 추출된 값으로 안쪽 테이블을 조인하는 방식</li>
</ul>
</li>
<li><strong>정렬 합병 조인 <code>Sort-Merge Join</code></strong><ul>
<li>적당한 인덱스가 없을 때 사용되며 양쪽 테이블의 처리 범위를 각자 실행하여 정렬한 결과를 차례로 스캔하고, 연결고리 조건으로 합병하는 방식</li>
</ul>
</li>
<li><strong>해시 조인 <code>Hash Join</code></strong><ul>
<li>조인할 테이블에 대해서 해시 함수를 생성</li>
<li>해시 함수의 순서대로 결과를 출력하는 방식</li>
</ul>
</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="3-서브-쿼리sub-query">3. 서브 쿼리(Sub Query)</h3>
<p><strong>1) 서브 쿼리의 개념</strong></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/b3db56d0-5340-4568-aad2-139e13f9e615/image.png" alt=""></p>
<ul>
<li>서브 쿼리는 <code>SQL</code>문 안에 포함된 또 다른 <code>SQL</code>문을 의미한다.<ul>
<li>알려지지 않은 기준을 검색하기 위해 사용한다.</li>
</ul>
</li>
<li>메인 쿼리와 서브 쿼리 관계는 <strong>주종 관계</strong>이다.<ul>
<li>때문에, 서브 쿼리에 사용되는 컬럼 정보는 메인 쿼리의 컬럼 정보를 사용할 수 있으나 <strong>역으로는 성립하지 않는다.</strong></li>
</ul>
</li>
</ul>
<p><span></span>
<strong>2) 서브 쿼리의 유형</strong></p>
<p><span></span>
<span style="color: blue">2-1) 동작 방식에 따른 서브 쿼리</span></p>
<blockquote>
<p>💡 <strong>비연관(Un-Correlated) 서브 쿼리</strong></p>
</blockquote>
<ul>
<li>서브 쿼리가 메인 쿼리의 컬럼을 가지고 있지 않은 형태</li>
<li>메인 쿼리에 서브 쿼리에서 실행된 결과값의 제공 용도</li>
</ul>
<blockquote>
<p>💡 <strong>연관(Correlated) 서브 쿼리</strong></p>
</blockquote>
<ul>
<li>서브 쿼리가 메인 쿼리의 컬럼을 가지고 있는 형태</li>
<li>메인 쿼리가 먼저 수행되어 얻은 데이터를 서브 쿼리의 조건에 맞는지 확인하고자 할 경우에 사용</li>
</ul>
<p><span></span>
<span style="color: blue">2-1) 데이터 형태에 따른 서브 쿼리</span></p>
<blockquote>
<p>💡 <strong>Single Row (단일 행)</strong></p>
</blockquote>
<ul>
<li>서브 쿼리의 결과가 항상 <strong><code>1</code>건 이하</strong>인 서브 쿼리</li>
<li>단일 행 비교 연산자(<code>=, &lt;, &lt;=, &gt;, &gt;=, &lt;&gt;</code>)가 사용됨</li>
</ul>
<blockquote>
<p>💡 <strong>Multiple Row (다중 행)</strong></p>
</blockquote>
<ul>
<li>서브 쿼리 실행 결과가 <strong>여러 건</strong>인 서브 쿼리</li>
<li>다중 행 비교 연산자(<code>IN, ALL, ANY, SOME, EXISTS</code>)가 사용됨</li>
</ul>
<blockquote>
<p>💡 <strong>Multiple Column (다중 컬럼행)</strong></p>
</blockquote>
<ul>
<li>서브 쿼리 결과가 여러 컬럼으로 반환되는 서브 쿼리</li>
<li>메인 쿼리의 조건절에 <strong>여러 컬럼을 동시에 비교</strong>할 때, 서브 쿼리와 메인 쿼리에서 <strong>비교하는 컬럼 개수와 위치가 동일</strong>해야함.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="4-집합-연산">4. 집합 연산</h3>
<p><strong>1) 집합 연산의 개념</strong></p>
<ul>
<li>테이블을 집합 개념으로 보고, 투 테이블 연산에 집합 연산자를 사용하는 방식</li>
<li>집합 연산자는 <strong>2개 이상의 질의 결과를 하나의 결과</strong>로 만들어 준다.</li>
<li>일반적으로 집합 연산자를 사용하고자 하는 상황<ul>
<li><strong>서로 다른 테이블</strong>에서 유사한 형태의 결과를 반환하는 것을 하나의 결과로 합치고자 할 때</li>
<li><strong>동일 테이블</strong>에서 서로 다른 질의를 수행하여 결과를 합치고자 할 때</li>
</ul>
</li>
</ul>
<p><span></span>
<strong>2) 집합 연산의 유형</strong></p>
<table>
<thead>
<tr>
<th>집합 연산</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>UNION</code></strong></td>
<td>여러 SQL문의 결과에 대한 <strong>합집합(중복 행 제거함)</strong></td>
</tr>
<tr>
<td><strong><code>UNION ALL</code></strong></td>
<td>여러 SQL문의 결과에 대한 <strong>합집합(중복 행 제거하지 않음)</strong></td>
</tr>
<tr>
<td><strong><code>INTERSECTION</code></strong></td>
<td>여러 SQL문의 결과에 대한 <strong>교집합(중복 행 제거함)</strong></td>
</tr>
<tr>
<td><strong><code>MINUS</code></strong></td>
<td>앞의 SQL문의 결과와 뒤의 SQL문의 결과 사이의 <strong>차집합 (중복 행 제거함, 일부 제품의 경우 <code>EXCEPT</code> 사용</strong></td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 집합 연산자 중 앞의 SQL문의 결과와 뒤의 SQL문이 결과 사이의 차집합을 무엇이라 하는지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong><code>MINUS</code></strong></span></li>
</ul>
<p><span></span>
<strong>2) 아래는 book, magazine 두 테이블을 결합시킨 테이블이다. 표를 참고하여 SQL문의 빈칸을 완성하시오.</strong></p>
<p><code>&lt;SELECT * FROM book&gt;</code></p>
<table>
<thead>
<tr>
<th align="center">publisher</th>
<th align="center">price</th>
<th align="center">remark</th>
</tr>
</thead>
<tbody><tr>
<td align="center">youngjin</td>
<td align="center">20.2</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">miracle</td>
<td align="center">21.2</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">dotcom</td>
<td align="center">15.1</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">path</td>
<td align="center">11.9</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">siwon</td>
<td align="center">11.2</td>
<td align="center">3</td>
</tr>
</tbody></table>
<p><span></span>
<code>&lt;SELECT * FROM magazine&gt;</code></p>
<table>
<thead>
<tr>
<th align="center">id</th>
<th align="center">name</th>
<th align="center">subject</th>
</tr>
</thead>
<tbody><tr>
<td align="center">1</td>
<td align="center">rei</td>
<td align="center">it</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">quan</td>
<td align="center">cooking</td>
</tr>
<tr>
<td align="center">3</td>
<td align="center">jung</td>
<td align="center">military</td>
</tr>
</tbody></table>
<pre><code class="language-sql">SELECT * FROM book
(      ) magazine on book.remark = magazine.id;</code></pre>
<p><span></span>
<code>&lt;결과&gt;</code></p>
<table>
<thead>
<tr>
<th align="center">publisher</th>
<th align="center">price</th>
<th align="center">remark</th>
<th align="center">name</th>
<th align="center">subject</th>
</tr>
</thead>
<tbody><tr>
<td align="center">youngjin</td>
<td align="center">20.2</td>
<td align="center">1</td>
<td align="center">rei</td>
<td align="center">it</td>
</tr>
<tr>
<td align="center">miracle</td>
<td align="center">21.2</td>
<td align="center">1</td>
<td align="center">rei</td>
<td align="center">it</td>
</tr>
<tr>
<td align="center">dotcom</td>
<td align="center">15.1</td>
<td align="center">2</td>
<td align="center">quan</td>
<td align="center">cooking</td>
</tr>
<tr>
<td align="center">path</td>
<td align="center">11.9</td>
<td align="center">2</td>
<td align="center">quan</td>
<td align="center">cooking</td>
</tr>
<tr>
<td align="center">siwon</td>
<td align="center">11.2</td>
<td align="center">3</td>
<td align="center">jung</td>
<td align="center">military</td>
</tr>
</tbody></table>
<ul>
<li>답 : <span style="color: blue"><strong><code>LEFT JOIN</code></strong> 또는 <strong><code>LEFT OUTER JOIN</code></strong></span></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[4. SQL 활용 : 기본 SQL]]></title>
            <link>https://velog.io/@xaexun_/4.-SQL-%ED%99%9C%EC%9A%A9-%EA%B8%B0%EB%B3%B8-SQL</link>
            <guid>https://velog.io/@xaexun_/4.-SQL-%ED%99%9C%EC%9A%A9-%EA%B8%B0%EB%B3%B8-SQL</guid>
            <pubDate>Wed, 15 Apr 2026 06:44:57 GMT</pubDate>
            <description><![CDATA[<h1 id="chapter-1--기본-sql">Chapter 1 : 기본 SQL</h1>
<hr>
<h2 id="🍀-section-1--ddl">🍀 Section 1 | DDL</h2>
<h3 id="1-ddl데이터-정의어의-개념">1. DDL(데이터 정의어)의 개념</h3>
<p><strong>1) DDL 정의</strong></p>
<ul>
<li><strong><span style="color: green">D</span>ata <span style="color: green">D</span>efinition <span style="color: green">L</span>anguage</strong></li>
<li>데이터를 정의하는 언어 = 데이터를 담는 그릇을 정의하는 언어</li>
<li>이러한 그릇을 <code>DBMS</code>에서는 <code>오브젝트</code>라고 한다.</li>
<li><code>DDL</code> 을 통해 정의할 수 있는 대상, 오브젝트의 유형은 다음과 같다.</li>
</ul>
<table>
<thead>
<tr>
<th>DDL 대상</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>스키마(<code>Schema</code>)</strong></td>
<td>• <code>DBMS</code> 특성과 구현 환경을 감안한 데이터 구조</td>
</tr>
<tr>
<td></td>
<td>• 직관적으로 <strong>하나의 <code>DB</code></strong>로 이해 가능</td>
</tr>
<tr>
<td><strong>도메인(<code>Domain</code>)</strong></td>
<td>• 속성의 데이터 <strong>타입과 크기, 제약 조건 등</strong>을 지정한 정보</td>
</tr>
<tr>
<td></td>
<td>• 속성이 가질 수 있는 <strong>값의 범위</strong>로 이해 가능</td>
</tr>
<tr>
<td><strong>테이블(<code>Table</code>)</strong></td>
<td>• 데이터 저장 공간</td>
</tr>
<tr>
<td><strong>뷰(<code>View</code>)</strong></td>
<td>• 하나 이상의 물리 테이블에서 유도되는 <strong>가상의 논리 테이블</strong></td>
</tr>
<tr>
<td><strong>인덱스(<code>Index</code>)</strong></td>
<td>• 검색을 빠르게 하기 위한 <strong>데이터 구조</strong></td>
</tr>
</tbody></table>
<p><span></span>
<strong>2) DDL 유형</strong></p>
<table>
<thead>
<tr>
<th>구분</th>
<th>DDL 명령어</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td><strong>생성</strong></td>
<td><span style="color: green"><strong><code>CREATE</code></strong></span></td>
<td>• DB 오브젝트 생성</td>
</tr>
<tr>
<td><strong>수정</strong></td>
<td><span style="color: green"><strong><code>ALTER</code></strong></span></td>
<td>• DB 오브젝트 수정</td>
</tr>
<tr>
<td><strong>삭제</strong></td>
<td><span style="color: green"><strong><code>DROP</code></strong></span></td>
<td>• DB 오브젝트 삭제</td>
</tr>
<tr>
<td></td>
<td><span style="color: green"><strong><code>TRUNCATE</code></strong></span></td>
<td>• DB 오브젝트 내용 삭제, 테이블 구조는 유지</td>
</tr>
</tbody></table>
<blockquote>
<p><strong><code>💡 TRUNCATE</code></strong></p>
</blockquote>
<ul>
<li><strong><code>DELETE</code></strong>와 같이 데이터를 삭제하는 것은 동일하다.</li>
<li>하지만, 테이블 구조를 유지하므로 <strong><code>DDL</code></strong>에 포함된다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="2-ddl데이터-정의어의-활용">2. DDL(데이터 정의어)의 활용</h3>
<p><strong>1) 테이블 생성</strong></p>
<pre><code class="language-sql">-- 신규 생성
CREATE TABLE 테이블이름 (
  열이름 데이터 타입 [DEFAULT 값] [NOT NULL]
  [PRIMARY KEY (열 리스트)]
  {
    [
      FOREIGN KEY(열 리스트) REFERENCES 테이블이름 [(열이름)]
      [ON DELETE 옵션]
      [ON UPDATE 옵션]
    ]
  }
  [CHECK (조건식) | UNIQUE(열이름)]
);

-- 다른 테이블 정보를 이용한 테이블 생성
CREATE TABLE 테이블이름 AS SELECT 문;</code></pre>
<p><span></span>
<strong>2) 테이블 변경</strong></p>
<pre><code class="language-sql">-- 열 추가
ALTER TABLE 테이블이름 ADD 열이름 데이터 타입 [DEFAULT 값]

-- 열 데이터 타입 변경
ALTER TABLE 테이블이름 MODIFY 열이름 데이터 타입 [DEFAULT 값]

-- 열 삭제
ALTER TABLE 테이블이름 DROP 열이름</code></pre>
<p><span></span>
<strong>3) 테이블 삭제, 내용 삭제, 이름 변경</strong></p>
<pre><code class="language-sql">-- 테이블 삭제
DROP TABLE 테이블이름

-- 테이블 내용 삭제
TRUNCATE TABLE 테이블이름

-- 테이블 이름 변경
RENAME TABLE 이전 테이블이름 TO 새로운 테이블이름
ALTER TABLE 이전 테이블이름 RENAME 새로운 테이블이름</code></pre>
<p><span></span>
<strong>4) 데이터 타입</strong></p>
<table>
<thead>
<tr>
<th>유형</th>
<th>정의</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>CHAR</code></strong></td>
<td><strong>고정</strong> 길이 문자열 데이터 타입</td>
</tr>
<tr>
<td><strong><code>VARCHAR</code></strong></td>
<td><strong>가변</strong> 길이 문자열 데이터 타입</td>
</tr>
<tr>
<td><strong><code>INT</code></strong></td>
<td><strong>숫자</strong>에 사용되는 데이터 타입</td>
</tr>
<tr>
<td><strong><code>FLOAT</code></strong></td>
<td><strong>소수형</strong> 데이터 타입</td>
</tr>
<tr>
<td><strong><code>DATE</code></strong></td>
<td><strong>날짜</strong>에 사용되는 데이터 타입</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="3-제약조건-적용">3. 제약조건 적용</h3>
<p><strong>1) 제약조건 유형</strong></p>
<table>
<thead>
<tr>
<th>제약조건</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>PRIMARY KEY</code></strong></td>
<td>• 테이블의 <strong>기본키</strong>를 정의함</td>
</tr>
<tr>
<td></td>
<td>• 기본으로 <strong><code>NOT NULL</code></strong>, <strong><code>UNIQUE</code></strong> 제약이 포함됨</td>
</tr>
<tr>
<td><strong><code>FOREIGN KEY</code></strong></td>
<td>• <strong>외래키</strong>를 정의함</td>
</tr>
<tr>
<td></td>
<td>• 참조 대상을 <strong>테이블 이름(열 이름)</strong>으로 명시해야 함</td>
</tr>
<tr>
<td></td>
<td>• <strong>참조 무결성 위배</strong> 상황 발생 시 처리 방법으로 옵션 지정 가능</td>
</tr>
<tr>
<td></td>
<td>• <strong><code>NO ACTION</code></strong>, <strong><code>SET DEFAULT</code></strong>, <strong><code>SET NULL</code></strong>, <strong><code>CASCADE</code></strong>, <strong><code>RESTRICT</code></strong></td>
</tr>
<tr>
<td><strong><code>UNIQUE</code></strong></td>
<td>• 테이블 내에서 열은 <strong>유일한 값</strong>을 가져야함</td>
</tr>
<tr>
<td></td>
<td>• 테이블 내에서 동일한 값을 가져서는 안 되는 항목에 지정함</td>
</tr>
<tr>
<td><strong><code>NOT NULL</code></strong></td>
<td>• 테이블 내에서 관련 열의 값은 <strong><code>NULL</code></strong>일 수 없음</td>
</tr>
<tr>
<td></td>
<td>• 필수 입력 항목에 대해 <strong>제약조건</strong>으로 설정함</td>
</tr>
<tr>
<td><strong><code>CHECK</code></strong></td>
<td>• <strong>개발자</strong>가 정의하는 제약조건</td>
</tr>
<tr>
<td></td>
<td>• 상황에 따라 다양한 조건 설정 가능</td>
</tr>
</tbody></table>
<p><span></span>
<strong>2) 제약조건 변경</strong></p>
<pre><code class="language-sql">-- 제약조건 추가
ALTER TABLE 테이블이름
ADD [CONSTRAINT 제약조건이름] 제약조건(열이름)

-- 제약조건 삭제
ALTER TABLE 테이블이름 `주문테이블` DROP FOREIGN KEY [제약조건이름];

-- 제약조건 활성화
ALTER TABLE 테이블이름
ENABLE CONSTRAINT 제약조건이름

-- 제약조건 비황설화
ALTER TABLE 테이블이름
DISABLE CONSTRAINT 제약조건이름</code></pre>
<blockquote>
<p><strong><code>💡 ALTER TABLE</code></strong></p>
</blockquote>
<ul>
<li>테이블에 제약조건을 추가하거나 삭제할 수 있다.</li>
<li>테이블에 제약조건을 <strong>수정 불가능</strong>하다</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="4-예제로-알아보는-sql---ddl">4. 예제로 알아보는 SQL - DDL</h3>
<p><strong>1) 테이블 생성 : <span style="color: green"><code>CREATE</code></span></strong></p>
<ul>
<li>급여라는 테이블을 생성하며 길이에 상관 없는 문자열로 ID와 고객명 컬럼을 설정하고, 나이는 숫자, 입사연도는 날짜로 정의하시오.</li>
<li>기본키는 ID로 설정하고, ID와 입사연도는 공백을 허용하지 않으며, 입사연도가 입력되지 않을 시 2020으로 입력되도록 기본값을 설정하시오.</li>
</ul>
<pre><code class="language-sql">CREATE TABLE 급여 (
  ID VARCHAR(20) NOT NULL
  고객명 VARCHAR(20)
  나이 INT
  입사연도 DATE NOT NULL DEFAULT 2020
  PRIMARY KEY(ID)
)</code></pre>
<p><span></span>
<strong>2) 컬럼 이름 및 타입 변경 : <span style="color: green"><code>ALTER</code></span></strong></p>
<pre><code class="language-sql">-- 주문 테이블의 배송지를 배송지역으로 변경하시오.
ALTER TABLE `주문` CHANGE `배송지` `배송지역`;

-- 주문 테이블의 상품 데이터 형식을 가변 문자형으로 표현하고 null값을 허용하지 않도록 하시오
ALTER TABLE `주문` ALTER COLUMN `상품` VARCHAR(20) NOT NULL;</code></pre>
<p><span></span>
<strong>3) 테이블 또는 컬럼 삭제 : <span style="color: green"><code>DROP</code></span></strong></p>
<pre><code class="language-sql">-- 급여 테이블을 삭제하시오.
DROP TABLE `급여`;

-- 급여 테이블에서 부서 컬럼만 삭제하시오.
ALTER TABLE `급여` DROP COLUMN `부서`;</code></pre>
<blockquote>
<p><strong>💡 <code>DROP</code> 문에서 쓰이는 기타 SQL 명령어들</strong></p>
</blockquote>
<ul>
<li><strong><code>RESTRICT</code></strong><ul>
<li>삭제할 테이블(데이터)가 참조 중이면삭제하지 않는다.</li>
</ul>
</li>
<li><strong><code>CASCADE</code></strong><ul>
<li>삭제할 테이블(데이터)가 참조 중이라도 삭제를 하게 되면, 삭제할 요소와 참조된 모든 요소에 대해서 연쇄적으로 같이 삭제된다.</li>
</ul>
</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 데이터 정의 언어(<code>DDL</code>, Data Define Language)에서 테이블 구조는 유지하며 테이블 내용을 제고하는 명령어를 작성하시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong><code>TRUNCATE</code></strong></span></li>
</ul>
<p><span></span>
<strong>2)  아래 보기에는 <code>영진</code> 테이블의 기본키를 삭제하는 SQL문이다. 빈칸에 들어갈 알맞은 SQL을 모두 작성하시오.</strong></p>
<pre><code class="language-sql">( ① ) TABLE 영진 ( ② ) PRIMARY KEY</code></pre>
<ul>
<li>답 : <ul>
<li>① : <span style="color: blue"><strong><code>ALTER</code></strong></span></li>
<li>② : <span style="color: blue"><strong><code>DROP</code></strong></span></li>
</ul>
</li>
</ul>
<hr>
<p><span></span></p>
<h2 id="🍀-section-2--dml">🍀 Section 2 | DML</h2>
<h3 id="1-dml데이터-조작어의-개념">1. DML(데이터 조작어)의 개념</h3>
<p><strong>1) DML 정의</strong></p>
<ul>
<li><strong><span style="color: green">D</span>ata <span style="color: green">M</span>anipulation <span style="color: green">L</span>anguage</strong></li>
<li>여기서 조작이란, 데이터 관점에서 생명 주기를 제어하는 것</li>
</ul>
<p><strong>2) DML 유형</strong></p>
<table>
<thead>
<tr>
<th>구분</th>
<th>DML 명령어</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td><strong>데이터 조회</strong></td>
<td><span style="color: green"><strong><code>SELECT</code></strong></span></td>
<td>• 테이블의 내용을 조회</td>
</tr>
<tr>
<td><strong>데이터 변경</strong></td>
<td><span style="color: green"><strong><code>UPDATE</code></strong></span></td>
<td>• 테이블의 내용을 변경</td>
</tr>
<tr>
<td><strong>데이터 추가</strong></td>
<td><span style="color: green"><strong><code>INSERT</code></strong></span></td>
<td>• 테이블의 내용을 추가</td>
</tr>
<tr>
<td><strong>데이터 삭제</strong></td>
<td><span style="color: green"><strong><code>DELETE</code></strong></span></td>
<td>• 테이블의 내용을 삭제</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="2-dml데이터-조작어의-활용">2. DML(데이터 조작어)의 활용</h3>
<p><strong>1) 데이터 조회</strong></p>
<ul>
<li>데이터 내용을 조회할 때 사용하는 명령어</li>
<li>가장 많이 사용되는 <code>SQL</code>명령어</li>
<li>다른 <code>DML</code> 명령어와 같이 사용되어 <code>SQL</code>의 활용을 풍부하게 한다.</li>
</ul>
<blockquote>
<p>💡<strong><code>SELECT</code> 명령어의 기본 형식</strong></p>
</blockquote>
<pre><code class="language-sql">SELECT [OPTION] columns FROM table [WHERE 절];</code></pre>
<p><span style="color: green"><strong>[<code>SELECT</code> 문에서 사용되는 요소]</strong></span></p>
<table>
<thead>
<tr>
<th>요소</th>
<th>요소값</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>OPTION</code></strong></td>
<td><strong><code>ALL</code></strong></td>
<td>• <strong>중복을 포함한</strong> 조회 결과 출력</td>
</tr>
<tr>
<td></td>
<td><strong><code>DISTINCT</code></strong></td>
<td>• <strong>중복을 제외한</strong> 조회 결과 출력</td>
</tr>
<tr>
<td><strong><code>columns</code></strong></td>
<td><strong><code>컬럼명 목록</code></strong></td>
<td>• <strong><code>SELECT</code></strong>를 통해 조회할 컬럼명 지정</td>
</tr>
<tr>
<td></td>
<td><strong><code>와일드카드</code></strong></td>
<td>• 모두 또는 전체를 의미하는 <strong><code>&#39;*&#39;</code></strong></td>
</tr>
</tbody></table>
<blockquote>
<p><strong>💡 <code>SELECT</code> 문에서 쓰이는 기타 SQL 명령어들</strong></p>
</blockquote>
<ul>
<li><strong><code>DISTINCT</code></strong><ul>
<li>중복된 값을 한 번만 검색되도록 한다.</li>
</ul>
</li>
<li><strong><code>BETWEEN</code></strong><ul>
<li><code>A AND B</code>, 즉 <code>A</code>값과 <code>B</code>값 사이를 만족하는 부분을 검색한다.</li>
</ul>
</li>
<li><strong><code>IN</code></strong><ul>
<li><code>IN(A, B)</code>, <code>OR</code>과 동일하게 참조하는 부분 중 하나라도 만족하는 부분을 검색한다.</li>
</ul>
</li>
<li><strong><code>ORDER BY</code></strong><ul>
<li>오름차순은 <code>ASC</code>, 내림차순은 <code>DESC</code>를 사용하여 정렬한다.</li>
</ul>
</li>
<li><strong><code>HAVING</code></strong><ul>
<li><code>GROUP BY</code> 에 의해 그룹으로 분류된 부분에서 <code>WHERE</code> 대신 조건절을 대신한다.</li>
</ul>
</li>
</ul>
<p><span></span>
<strong>2) 데이터 변경</strong></p>
<ul>
<li>데이터를 <strong>변경 및 수정</strong>할 때 다음과 같은 형태의 <code>UPDATE</code> 명령문을 사용한다.</li>
<li><code>UPDATE</code> 명령문은 보통 <code>WHERE</code> 절을 통해 어떤 조건을 만족할 경우에만 특정 컬럼의 값을 수정하는 용도로 많이 사용된다.</li>
</ul>
<pre><code class="language-sql">UPDATE table SET column1 = value1, column2 = value2, ... [WHERE 절];</code></pre>
<p><span></span>
<strong>3) 데이터 추가</strong></p>
<ul>
<li>데이터를 <strong>삽입</strong>하기 위한 명령어로 다음과 같이 두 가지 형태의 명령문 형식을 제공한다.</li>
<li>이때 데이터 삽입 결과로 하나의 레코드가 추가된다.</li>
<li>따라서 삽입에 사용되는 정보는 하나의 레코드를 충분히 묘사해야 한다.</li>
</ul>
<pre><code class="language-sql">INSERT INTO table_name (column1, column2, ..) VALUES (value1, value2, ...);

INSERT INTO table_name VALUES (value1, value2, ...);</code></pre>
<p><span></span>
<strong>4) 데이터 삭제</strong></p>
<ul>
<li>레코드를 삭제할 때 다음과 같은 형태의 <code>DELETE</code> 명령문을 사용한다.</li>
<li>조건절 없이 <code>DELETE</code>를 사용하는 경우, 테이블 전체가 한 번에 삭제된다.</li>
</ul>
<pre><code class="language-sql">DELTE FROM table [WHERE 절];</code></pre>
<p><span></span>
<span></span></p>
<h3 id="3-예제로-알아보는-sql---dml">3. 예제로 알아보는 SQL - DML</h3>
<p><strong>1) 데이터 조회 : <code>SELECT</code></strong></p>
<pre><code class="language-sql">-- 아무 조건 없이 학생 테이블의 모든 컬럼을 조회하시오.
SELECT * FROM 학생;

-- 학생 테이블에서 학년이 2학년인 모든 컬럼을 조회하시오.
SELECT * FROM 학생 WHERE 학년 = 2;

-- 학생 테이블에서 중복을 제외한 동아리명 컬럼을 조회하시오.
SELECT DISTINCT 동아리명 FROM 학생

-- 학생 테이블에서 학년이 3학년이고, 과목이 영어인 학생의 성명과 연락처를 조회하시오.
SELECT 성명, 연락처 FROM 학생 WHERE 학년 = 3 AND 과목 = 영어;</code></pre>
<p><span></span>
<strong>2) 데이터 수정 : <code>UPDATE</code></strong></p>
<pre><code class="language-sql">-- 판매내역 테이블에 재고가 없으면 상태를 &#39;판매불가&#39;라고 수정하시오.
UPDATE &#39;판매내역&#39; SET 상태 = &#39;판매불가&#39; FROM 재고 IS NULL;
</code></pre>
<p><span></span>
<strong>3) 데이터 추가 : <code>INSERT</code></strong></p>
<pre><code class="language-sql">-- 회원 테이블에서 회원번호 1112, 성명 &#39;윤지영&#39;, 지역 &#39;인천&#39;, 연락처 &#39;486-1112&#39;인 회원을 추가하시오.
INSERT INTO 회원(회원번호, 성명, 지역, 연락처)
VALUES (1112, &#39;윤지영&#39;, &#39;인천&#39;, &#39;486-1112&#39;);
</code></pre>
<p><span></span>
<strong>4) 데이터 삭제 : <code>DELETE</code></strong></p>
<pre><code class="language-sql">-- 학생 테이블에서 전체 행을 제거하시오
DELETE FROM &#39;학생&#39;;

-- 학생 테이블에서 학년이 3학년인 데이터를 삭제하시오.
DELETE FROM &#39;학생&#39; WHERE 학년 = 3;
</code></pre>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 다음 학생 테이블에서 수학이 80점 이하인 학생이 3명 이상인 반의 튜플 수를 구하는 SQL문이다. 빈칸에 들어갈 명령어를 작성하시오.</strong></p>
<pre><code class="language-sql">SELECT 반, COUNT(*) AS 학생수
FROM 학생
WHERE 수학 &lt;= 80
GROUP BY 반
(      ) COUNT(*) &gt;= 3;</code></pre>
<ul>
<li>답 : <span style="color: blue"><strong><code>HAVING</code></strong></span></li>
</ul>
<p><span></span>
<strong>2)  PATH 테이블에서 점수 열을 내림차순으로 검색하려고 한다. 빈칸에 들어갈 알맞은 SQL을 작성하시오.</strong></p>
<pre><code class="language-sql">SELECT * FROM ORDER BY 점수 (      )</code></pre>
<ul>
<li>답 : <span style="color: blue"><strong><code>DESC</code></strong></span></li>
</ul>
<hr>
<p><span></span></p>
<h2 id="🍀-section-3--dcl">🍀 Section 3 | DCL</h2>
<h3 id="1-dml데이터-조작어의-개념-1">1. DML(데이터 조작어)의 개념</h3>
<p><strong>1) DML 정의</strong></p>
<ul>
<li><strong><span style="color: green">D</span>ata <span style="color: green">C</span>ontrol <span style="color: green">L</span>anguage</strong></li>
<li>데이터 이외의 오브젝트에 대해 조작할 때</li>
</ul>
<table>
<thead>
<tr>
<th>오브젝트</th>
<th>목적</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td><strong>사용자 권한</strong></td>
<td>접근 통제</td>
<td>• 사용자를 등록하고, 사용자에게 특정 DB를 사용할 수 있는 권리를 부여하는 작업</td>
</tr>
<tr>
<td><strong>트랜잭션</strong></td>
<td>안전한 거래 보장</td>
<td>• 동시에 다수의 작업을 독립적으로 안전하게 처리하기 위한 상호작용 단위</td>
</tr>
</tbody></table>
<p><span></span>
<strong>2) DCL 유형</strong></p>
<table>
<thead>
<tr>
<th>구분</th>
<th>DML 명령어</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td><strong>DCL</strong></td>
<td><span style="color: green"><strong><code>GRANT</code></strong></span></td>
<td>• DB 사용자 권한 부여</td>
</tr>
<tr>
<td></td>
<td><span style="color: green"><strong><code>REVOKE</code></strong></span></td>
<td>• DB 사용자 권한 회수</td>
</tr>
<tr>
<td><strong>TCL</strong></td>
<td><span style="color: green"><strong><code>COMMIT</code></strong></span></td>
<td>• 트랜잭션 확정</td>
</tr>
<tr>
<td></td>
<td><span style="color: green"><strong><code>ROLLBACK</code></strong></span></td>
<td>• 트랜잭션 취소</td>
</tr>
<tr>
<td></td>
<td><span style="color: green"><strong><code>CHECKPOINT</code></strong></span></td>
<td>• 트랜잭션 설정</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>TCL</strong></p>
</blockquote>
<ul>
<li><strong><span style="color: green">T</span>ransaction <span style="color: green">C</span>ontrol <span style="color: green">L</span>anguage</strong></li>
<li>트랜잭션 제어를 위한 명령어</li>
<li><code>TCL</code>과 <code>DCL</code>은 대상이 달라 서로 별개의 개념으로 분류할 수 있으나, 제어 기능이라는 공통점으로 <code>DCL</code>의 일부로 분류하기도 한다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="2-dcl의-활용">2. DCL의 활용</h3>
<p><strong>1) 사용자 권한 부여</strong></p>
<ul>
<li>권한은 <strong>시스템 권한</strong>과 <strong>객체 권한</strong>으로 분류한다.</li>
<li>각 권한을 부여하기 위한 명령어 사용법은 다음과 같다.</li>
</ul>
<table>
<thead>
<tr>
<th>권한</th>
<th>명령어 문법</th>
</tr>
</thead>
<tbody><tr>
<td><strong>시스템 권한 부여</strong></td>
<td><code>GRANT 권한1, 권한2 TO 사용자계정</code></td>
</tr>
<tr>
<td><strong>객체 권한 부여</strong></td>
<td><code>GRANT 권한1, 권한2 ON 객체명 TO 사용자계정</code></td>
</tr>
</tbody></table>
<ul>
<li><strong>시스템 권한</strong>과 <strong>객체 권한</strong>의 종류는 다음과 같다.</li>
</ul>
<pre><code class="language-sql">-- 시스템 권한

CREATE USER       // 계정 생성 권한
DROP USER         // 계정 삭제 권한

CREATE TABLE      // 테이블 생성 권한
DROP ANY TABLE    // 테이블 삭제 권한

CREATE SESSION    // DB 접속 권한
CREATE VIEW       // 뷰 생성 권한
CREATE SEQUENCE   // 시퀀스 생성 권한
CREATE PROCEDURE  // 함수 생성 권한</code></pre>
<pre><code class="language-sql">-- 객체 권한

ALTER    // 테이블 변경 권한

INSERT   // 데이터 조작 권한
DELETE   // 데이터 조작 권한
SELECT   // 데이터 조작 권한
UPDATE   // 데이터 조작 권한

EXECUTE ON PROCEDURE  //  실행 권한</code></pre>
<p><span></span>
<strong>2) 사용자 권한 회수</strong></p>
<ul>
<li><code>GRANT</code>에 대응하는 권한 회수 명령은 <code>REVOKE</code>이다.</li>
<li>권한 유형별 대응하는 명령어 구조는 다음과 같다.</li>
</ul>
<table>
<thead>
<tr>
<th>권한</th>
<th>명령어 문법</th>
</tr>
</thead>
<tbody><tr>
<td><strong>시스템 권한 회수</strong></td>
<td><code>REVOKE 권한1, 권한2 TO 사용자계정</code></td>
</tr>
<tr>
<td><strong>객체 권한 회수</strong></td>
<td><code>REVOKE 권한1, 권한2 ON 객체명 FROM 사용자계정</code></td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="3-접근-통제">3. 접근 통제</h3>
<p><strong>1) 접근 통제 개념</strong></p>
<ul>
<li><strong>DB의 보안을 구현하는 방법</strong>으로 <strong>접근 통제 방법</strong>을 사용한다.</li>
</ul>
<blockquote>
<p>💡 <strong>접근 통제</strong></p>
</blockquote>
<ul>
<li>보안 정책에 따라 <strong>접근 객체에 접근 주체의 접근 권한을 확인</strong><ul>
<li>접근 객체 : 시스템 자원, 통신자원 등</li>
<li>접근 권한 : 사용자, 프로세스 등</li>
</ul>
</li>
<li>이를 기반으로 한 접근 제어를 통해 자원에 대한 비인가된 사용을 방지하는 <strong>정보 보호 기능</strong></li>
</ul>
<p><span></span>
<strong>2) 접근 통제 유형</strong></p>
<blockquote>
<p>💡 <strong>DAC</strong></p>
</blockquote>
<ul>
<li><strong>D</strong>iscretionary <strong>A</strong>ccess <strong>C</strong>ontrol, <strong>임의 접근 통제</strong></li>
<li>시스템 객체에 대한 접근을 <strong>사용자 개인 또는 그룹의 식별자를 기반</strong>으로 제한하는 방법</li>
<li>임의적이라는 말은,<ul>
<li><span style="color: green">어떤 종류의 접근 권한을 갖는 사용자</span>는 <span style="color: green">다른 사용자</span>에게</li>
<li>자신의 판단에 의해서 권한을 줄 수 있다는 것</li>
</ul>
</li>
<li><span style="color: green">주체와 객체의 신분 및 임의적 접근 통제 규칙</span>에 기초하여 <span style="color: blue">객체에 대한 주체의 접근을 통제</span>하는 기능</li>
<li>통제 권한이 주체에 있음</li>
<li>주체가 임의적으로 접근 통제 권한을 배분하며 제어할 수 있음</li>
</ul>
<blockquote>
<p>💡 <strong>MAC</strong></p>
</blockquote>
<ul>
<li><strong>M</strong>andatory <strong>A</strong>ccess <strong>C</strong>ontrol, <strong>강제 접근 통제</strong></li>
<li>정보 시스템 내에서 어떤 주체가 특정 객체에 접근하려 할 때,</li>
<li>양쪽의 <strong>보안 레이블(Secuity Label)</strong>에 기초하여,</li>
<li><strong>높은</strong> 보안 수준을 요구하는 <strong>정보(객체)</strong>가,</li>
<li><strong>낮은</strong> 보안 수준의 <strong>주체</strong>에게 노출되지 않도록</li>
<li><strong>접근을 제한</strong>하는 통제 방법</li>
</ul>
<p><span></span>
<strong>3) 접근 통제와 DCL의 관계</strong></p>
<ul>
<li>강제 접근 통제의 경우, 제 3자의 종류에 따라, 보다 세분화 된 정책이 존재한다.</li>
<li>접근 통제 정책의 두 가지 가운데 <strong><code>DBMS</code>에서 채택한 접근 통제 정책은 <code>DAC</code> 방식</strong>이다.</li>
<li>DB 관리, 특히 접근 용도로 <code>SQL</code>에서 사용하는 명령어가 바로 <code>DCL</code>이다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="4-tcl-활용-방법">4. TCL 활용 방법</h3>
<p><strong>1) 트랜잭션 개념</strong></p>
<ul>
<li><strong><code>Transaction = 일 처리 단위</code></strong></li>
<li>보다 다양한 관점에서 트랜잭션은 다음과 같은 모습을 가진다.<ul>
<li><code>Transaction = 논리적 연산 단위</code></li>
<li><code>Transaction = 한 개 이상의 DB 조작</code><ul>
<li>즉, 하나 이상의 <code>SQL</code> 문장이 포함된다.</li>
</ul>
</li>
<li><code>Transaction = 분할할 수 없는 최소 단위</code></li>
<li><code>Transaction = 거래</code><ul>
<li>이때 거래 결과가 모두 반영되거나 모두 취소되어야 한다.</li>
<li>DB에서의 트랜잭션은 특별한, 엄격한 거래를 의미한다.</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><span></span>
<strong>2) 트랜잭션 제어</strong></p>
<ul>
<li>트랜잭션을 제어한다는 것<ul>
<li>흐름의 구조를 바꾼다는 것이 아님</li>
<li>트랜잭션의 결과를 수용하거나 취소하는 것</li>
</ul>
</li>
<li>이러한 작업을 수행하는 TCL 관련 명령어는 다음과 같다.</li>
</ul>
<table>
<thead>
<tr>
<th>명령어</th>
<th>내용</th>
<th>비고</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>COMMIT</code></strong></td>
<td>트랜잭션을 확정함</td>
<td></td>
</tr>
<tr>
<td><strong><code>ROLLBACK</code></strong></td>
<td>트랜잭션을 취소함</td>
<td></td>
</tr>
<tr>
<td><strong><code>CHECKPOINT</code></strong></td>
<td>저장점 설정</td>
<td>ROLLBACK할 위치를 지정함</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 사용자 PATH에게 계정 생성 권한(CREATE USER)을 부여하는 SQL문을 작성하시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong><code>GRANT CREATE USER TO PATH</code></strong></span></li>
</ul>
<p><span></span>
<strong>2) 사용자 PATH에게 점수 테이블의 갱신(UPDATE)과 삭제(DELETE) 권한을 해제하는 SQL문을 작성하시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong><code>REVOKE UPDATE, DELETE ON 점수 FROM PATH</code></strong></span></li>
</ul>
<hr>
<p><span></span></p>
<h2 id="🍀-section-4--데이터-사전-검색">🍀 Section 4 | 데이터 사전 검색</h2>
<h3 id="1-데이터-사전의-개념">1. 데이터 사전의 개념</h3>
<ul>
<li><strong>Data Dictionary</strong></li>
<li>DB의 데이터를 제외한 모든 정보가 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>데이터를 제외한 모든 정보?</strong></p>
</blockquote>
<ul>
<li>데이터 구조와 정의 정보를 의미한다.<pre><code class="language-sql">-- EX)
-- 데이터 : 실제 값
학생 테이블
이름 = &quot;재재&quot;, 나이 = 200
-- 메타 데이터
테이블 이름 :학생
컬럼 : 이름(VARCHAR), 나이(INT)
기본키 : 학번</code></pre>
</li>
<li>데이터 사전은 <strong>메타 데이터(Meta Data)</strong>로 구성되어 있다고 할 수 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>Meta Data</strong></p>
</blockquote>
<ul>
<li><p><code>데이터의 데이터</code>, 즉 어떠한 목적을 가지고 만들어진 데이터</p>
</li>
<li><p>데이터에 관해 구조화 된 데이터로, 다른 데이터를 설명해주는 데이터라고 볼 수 있다.</p>
</li>
<li><p>데이터 사전의 내용을 변경하는 권한은 시스템이 가진다.</p>
</li>
<li><p>사용자에게는 읽기 전용 테이블 형태로 제공되므로 단순 조회만 가능하다.</p>
</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="2-데이터-사전의-내용">2. 데이터 사전의 내용</h3>
<blockquote>
<p>💡 <strong>데이터 사전 안에 존재하는 메타 데이터의 유형</strong></p>
</blockquote>
<ul>
<li><p><strong>사용자 정보</strong></p>
<ul>
<li>아이디, 패스워드 및 권한 등</li>
</ul>
</li>
<li><p><strong>DB 객체 정보</strong></p>
<ul>
<li>Table, View, Index 등</li>
</ul>
</li>
<li><p><strong>무결성 제약 정보</strong></p>
</li>
<li><p><strong>함수, 프로시저 및 트리거 등</strong></p>
</li>
<li><p>데이터 사전 내용이 메타 데이터라는 것은 모든 <code>DBMS</code> 제품에 공통이다.</p>
</li>
<li><p>데이터 사전을 구현하고 관리하는 방법 등의 차이로 메타 데이터의 구체적인 내용은 제품마다 다르다.</p>
</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="3-데이터-사전의-용도">3. 데이터 사전의 용도</h3>
<ul>
<li>사용자에게 데이터 사전은 단순 조회의 대상일 뿐이다.</li>
<li>DB 엔진을 이루는 컴파일러, 옵티마이저 등과 같은 구성요소에게 데이터 사전은 작업을 수행하는데 필요한 참조 정보일 뿐만 아니라 작업의 대상이기도 한다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제-3">🚀 예상문제</h3>
<p><strong>1) 다음에서 설명하는 정의에 대한 용어를 작성하시오</strong></p>
<pre><code>데이터를 제외한 데이터를 구성하는 정보 또는 &#39;데이터의 데이터&#39;를 말하며 어떠한 목적을 가지고 만들어진 데이터</code></pre><ul>
<li>답 : <span style="color: blue"><strong><code>메타 데이터(Meta Data)</code></strong></span></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[3. 응용 SW 기초 기술 활용 : 데이터베이스]]></title>
            <link>https://velog.io/@xaexun_/3.-%EC%9D%91%EC%9A%A9-SW-%EA%B8%B0%EC%B4%88-%EA%B8%B0%EC%88%A0-%ED%99%9C%EC%9A%A9-%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B2%A0%EC%9D%B4%EC%8A%A4</link>
            <guid>https://velog.io/@xaexun_/3.-%EC%9D%91%EC%9A%A9-SW-%EA%B8%B0%EC%B4%88-%EA%B8%B0%EC%88%A0-%ED%99%9C%EC%9A%A9-%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B2%A0%EC%9D%B4%EC%8A%A4</guid>
            <pubDate>Mon, 06 Apr 2026 09:11:40 GMT</pubDate>
            <description><![CDATA[<h1 id="chapter-3--데이터베이스">Chapter 3 : 데이터베이스</h1>
<hr>
<h2 id="🍀-section-1--데이터베이스-종류-및-선정">🍀 Section 1 | 데이터베이스 종류 및 선정</h2>
<h3 id="1-데이터-베이스">1. 데이터 베이스</h3>
<p><strong>1) 데이터 베이스 개념</strong></p>
<ul>
<li>다수의 인원, 시스템 또는 프로그램이 사용할 목적으로 통합하여 관리되는 <strong>데이터의 집합</strong></li>
<li>IT 시스템의 발달로 인한 급증하는 데이터에 대한 효과적인 관리가 중요해졌다.</li>
<li><strong>데이터베이스 관리의 핵심</strong><ul>
<li>자료의 <strong>중복성 제거</strong></li>
<li><strong>무결성</strong> 확보</li>
<li><strong>일관성</strong> 유지</li>
<li><strong>유용성</strong> 보장</li>
</ul>
</li>
</ul>
<p><span></span>
<span style="color: blue">1-1) 데이터베이스 특징</span></p>
<ul>
<li>실시간 접근성(Real-time Accessibility)</li>
<li>계속적인 변화(Continuous Evolution)</li>
<li>동시 공유(Concurrent Sharing)</li>
<li>내용에 의한 참조(Content Reference)</li>
</ul>
<p><span></span>
<span style="color: blue">1-2) 데이터베이스 설계 순서</span></p>
<p>➀ 요구조건 분석
➁ 개념적 설계
➂ 논리적 설계
➃ 물리적 설계
➄ 구현</p>
<p><span></span>
<strong>2) 데이터베이스용어</strong></p>
<ul>
<li><strong>릴레이션(Relation)</strong><ul>
<li>속성(열)과 튜플(행)로 구성된 <strong>중복 없는 데이터의 집합</strong></li>
</ul>
</li>
<li><strong>속성(Atrribute)</strong><ul>
<li><strong>릴레이션 내의 하나의 열</strong></li>
<li>어떤 개체(Entity)를 표현하고 저장한 것</li>
<li><strong>컬럼(Column)</strong> 또는 <strong>필드(Feild)</strong>로 표현하기도 한다.</li>
</ul>
</li>
<li><strong>튜플(Tuple)</strong><ul>
<li><strong>릴레이션 내의 하나의 행</strong></li>
<li><strong>레코드(Record)</strong> 또는 <strong>로우(Row)</strong>로 표현하기도 한다.</li>
</ul>
</li>
<li><strong>차수(Degree)</strong><ul>
<li>하나의 릴레이션 내에 들어있는 <strong>속성의 수(열의 개수)</strong></li>
</ul>
</li>
<li><strong>기수(Cardinality)</strong><ul>
<li>하나의 릴레이션 내에 들어있는 <strong>튜플의 수(행의 개수)</strong></li>
</ul>
</li>
<li><strong>도메인(Doamin)</strong><ul>
<li>릴레이션 내 각각의 <strong>속성</strong>들이 가질 수 있는 <strong>값들의 집합</strong></li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/cec6d052-92c6-4adc-8eca-29ab839f8e0e/image.png" alt=""></p>
<ul>
<li><strong>뷰(View)</strong><ul>
<li>하나 이상의 <strong>기본 테이블</strong>로부터 <strong>유도된 가상의 테이블</strong></li>
<li>구조와 조작도 기본 테이블과 매우 유사하다.</li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/4d9a509b-7d11-47b2-88e4-396e8ee1a321/image.png" alt=""></p>
<ul>
<li><strong>트랜잭션(Transaction)</strong><ul>
<li>데이터베이스 내에서 <strong>하나의 작업 수행을 위한 연산들의 집합</strong></li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/4738a0b5-192f-452e-9590-590bd576707a/image.png" alt=""></p>
<blockquote>
<p>💡 <strong>ACID (트랜잭션의 안정성)</strong></p>
</blockquote>
<ul>
<li><strong><code>A</code></strong><code>tomicity</code><ul>
<li><strong>원자성</strong></li>
<li>전부 실행되거나, 전부 취소</li>
<li>부분 성공은 없음</li>
</ul>
</li>
<li><strong><code>C</code></strong><code>onsistency</code><ul>
<li><strong>일관성</strong></li>
<li>데이터는 항상 규칙을 만족해야한다</li>
</ul>
</li>
<li><strong><code>I</code></strong><code>solation</code><ul>
<li><strong>독립성</strong></li>
<li>트랜잭션끼리 서로 간섭하지 않는다.</li>
</ul>
</li>
<li><strong><code>D</code></strong><code>urability</code><ul>
<li><strong>지속성</strong></li>
<li>커밋되면 무조건 저장된다.</li>
<li>데이터 유지</li>
</ul>
</li>
</ul>
<ul>
<li><p><strong>스키마(Schema)</strong></p>
<ul>
<li><p>데이터베이스의 구조와 제약조건에 관한 전반적인 <strong>명세</strong></p>
</li>
<li><p><strong>스키마 종류</strong></p>
<table>
<thead>
<tr>
<th>스키마</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>내부 스키마(물리)</strong></td>
<td><strong>시스템 프로그래머나 설계자</strong>의 관점에서 정의하는 데이터베이스</td>
</tr>
<tr>
<td><strong>개념 스키마(논리)</strong></td>
<td>사용자들이 필요로 하는 데이터를 <strong>기관이나 조직</strong>의 관점에서 정의하는 데이터베이스</td>
</tr>
<tr>
<td><strong>외부 스키마(서브)</strong></td>
<td><strong>사용자 등의 개인적 입장</strong>에서 필요로 하는 데이터베이스</td>
</tr>
</tbody></table>
</li>
</ul>
</li>
</ul>
<ul>
<li><strong>키(Key)</strong><ul>
<li>무언가를 식별하는 <strong>고유한 식별자(Identifier) 기능</strong>을 하는 것</li>
<li><strong>슈퍼키</strong><ul>
<li><strong>Super Key</strong></li>
<li><span style="color:green">유일성 만족</span>, <span style="color:red">최소성 불만족</span>하는 속성들의 집합</li>
</ul>
</li>
<li><strong>후보키</strong><ul>
<li><strong>Candidate Key</strong></li>
<li><span style="color:green">유일성 만족</span>, <span style="color:green">최소성 만족</span>하는 속성들의 집합</li>
</ul>
</li>
<li><strong>기본키</strong><ul>
<li><strong>Primary Key</strong></li>
<li>후보키 중 선정된 키</li>
<li>중복값 입력 불가능</li>
<li>Null 값을 가질 수 없음</li>
</ul>
</li>
<li><strong>대체키</strong><ul>
<li><strong>Alternate Key</strong></li>
<li>후보키 중 기본키로 선택되지 못한 후보키들</li>
</ul>
</li>
<li><strong>외래키</strong><ul>
<li><strong>Foreign Key</strong></li>
<li>다른 테이블의 행을 식별하는 키</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/14ff906b-1a55-4515-ae1d-24933aa21bd8/image.png" alt=""></p>
<blockquote>
<p>💡 <strong>유일성</strong></p>
</blockquote>
<ul>
<li>하나의 키로 특정 행을 바로 찾아낼 수 있는 고유한 데이터의 속성</li>
<li>유일성만 만족해도 슈퍼키가 될 수 있다.</li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="2-데이터베이스-관리-시스템-dbms-database-management-system">2. 데이터베이스 관리 시스템 (DBMS, DataBase Management System)</h3>
<p><strong>1) 데이터베이스 관리 시스템 개념</strong></p>
<ul>
<li>데이터 관리의 <strong>복잡성을 해결</strong>할 수 있다.</li>
<li>데이터 <strong>추가/변경/검색/삭제 및 백업/복구/보안 등의 기능</strong>을 지원하는 소프트웨어</li>
<li>저장되는 정보는 텍스트, 이미지, 음악 파일, 지도 데이터 등으로 매우 다양하다.</li>
<li>SNS의 발달과 빅데이터의 폭넓은 활용으로 데이터의 종류와 양이 급격히 증가하는 추세이다.</li>
</ul>
<p><span></span></p>
<table>
<thead>
<tr>
<th>DBMS</th>
<th>장점</th>
</tr>
</thead>
<tbody><tr>
<td>• 데이터 중복 최소화</td>
<td>• 데이터 표준화 적용 가능</td>
</tr>
<tr>
<td>• 데이터 공유(<strong>일관성</strong> 유지)</td>
<td>• 데이터 접근 용이</td>
</tr>
<tr>
<td>• <strong>정합성</strong>, <strong>무결성</strong>, <strong>보안성</strong> 유지</td>
<td>• 데이터 저장 공간 공유로 인한 절약</td>
</tr>
<tr>
<td>• <strong>사용자 중심</strong>의 데이터 처리</td>
<td></td>
</tr>
</tbody></table>
<p><span></span></p>
<table>
<thead>
<tr>
<th>DBMS</th>
<th>단점</th>
</tr>
</thead>
<tbody><tr>
<td>• 데이터베이스 전문가(DBA) 필요</td>
<td>• 시스템의 복잡성</td>
</tr>
<tr>
<td>• DBMS 구축 서버 필요 및 유지비</td>
<td>• 대용량 디스크로 엑세스 집중 시 병목 현성으로 과부하 발생</td>
</tr>
<tr>
<td>• 데이터 백업과 복구가 어려움</td>
<td>• 대용량 데이터 처리가 어려움</td>
</tr>
</tbody></table>
<p><strong>2) DBMS 특징</strong></p>
<table>
<thead>
<tr>
<th>DBMS 특징</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>데이터 무결성</strong></td>
<td>• 부적절한 자료가 입력되어 동일한 내용에 대하여 <strong>서로 다른 데이터가 저장되는 것을 허용하지 않는 성질</strong></td>
</tr>
<tr>
<td><strong>데이터 일관성</strong></td>
<td>• 삽입, 삭제, 갱신, 생성 후에도 저장된 데이터가 변함없이 <strong>일정</strong>해야하는 성질</td>
</tr>
<tr>
<td><strong>데이터 회복성</strong></td>
<td>• 장애가 발생하였을 시 특정 상태로 <strong>복구</strong>되어야 하는 성질</td>
</tr>
<tr>
<td><strong>데이터 보안성</strong></td>
<td>• 불법적인 노출, 변경, 손실로부터 <strong>보호</strong>되어야 하는 성질</td>
</tr>
<tr>
<td><strong>데이터 효율성</strong></td>
<td>• 응답 시간, 저장 공간 활용 등이 <strong>최적화</strong>되어 사용자, 소프트웨어, 시스템 등의 요구 조건을 만족시켜 하는 성질</td>
</tr>
</tbody></table>
<p><strong>3) 데이터베이스 관리자 (DBA, DataBase Administrator)</strong></p>
<ul>
<li>DB를 직접 활용하기보다는 사용자를 위해 <strong>DB</strong>를 <strong>설계 및 구축</strong>하고, 제대로 서비스할 수 있도록 <strong>DB</strong>를 <strong>관리</strong>하고 <strong>제어</strong>한다.</li>
</ul>
<blockquote>
<p>💡 <strong>DBA의 주요 업무</strong></p>
</blockquote>
<ul>
<li>DB 구성요소 선정</li>
<li>DB 스키마 정의</li>
<li>물리적 저장 구조와 접근 방법 결정</li>
<li>무결성 유지를 위한 제약조건 정의</li>
<li>보안 및 접근 권한 정책 결정</li>
<li>백업 및 회복 기법 정의</li>
<li>시스템 DB 관리</li>
<li>시스템 성능 감시 및 성능 분석</li>
<li>DB 재구성</li>
</ul>
<p><strong>4) DBMS 종류</strong></p>
<p><span style="color: blue">4-1) 파일 시스템</span></p>
<ul>
<li>파일에 <strong>이름</strong>을 부여</li>
<li><strong>저장</strong>이나 <strong>검색</strong>을 위하여 노리적으로 그것들을 어디에 위치시켜야 하는지 등을 정의한 뒤 관리</li>
<li>DB 전 단계의 관리 방식</li>
</ul>
<table>
<thead>
<tr>
<th align="center">파일 시스템</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>ISAM</strong></td>
<td>• <strong><code>I</code></strong>ndexed <strong><code>S</code></strong>equential <strong><code>A</code></strong>ccess <strong><code>M</code></strong>ethod</td>
</tr>
<tr>
<td align="center"></td>
<td>• 자료 내용은 주 저장부</td>
</tr>
<tr>
<td align="center"></td>
<td>• 자료의 색인은 자료가 기록된 위치와 함께 <strong>색인부</strong>에 기록되는 시스템</td>
</tr>
<tr>
<td align="center"><strong>VSAM</strong></td>
<td>• <strong><code>V</code></strong>irtual <strong><code>S</code></strong>torage <strong><code>A</code></strong>ccess <strong><code>M</code></strong>ethod</td>
</tr>
<tr>
<td align="center"></td>
<td>• <strong>대형</strong> 운영 체계에서 사용되는 파일 관리 시스템</td>
</tr>
</tbody></table>
<p><span></span>
<span style="color: blue">4-2) 계층형 DB 관리 시스템</span></p>
<ul>
<li><strong>HDBMS</strong> : <strong>H</strong>ierarchical <strong>DBMS</strong></li>
<li>데이터를 <strong>상하 종속적인 관계</strong>로 계층화하여 관리하는 DB이다.</li>
<li>데이터에 대한 접근 속도가 빠르다.</li>
<li>종속적인 구조로 인하여 변화하는 데이터 구조에 <strong>유연하게 대응하기가 쉽지 않다.</strong></li>
<li>IMS, System 2000과 같은 제품이 있다.</li>
</ul>
<p><span></span>
<span style="color: blue">4-3) 망형 DB 관리 시스템</span></p>
<ul>
<li><strong>NDBMS</strong> : <strong>N</strong>etwork <strong>DBMS</strong></li>
<li><strong>데이터의 구조를 네트워크 상의 망상 형태</strong>로 논리적으로 표현한 데이터 모델</li>
<li>트리 구조나 <strong>HDBMS</strong>보다는 유연하지만 <strong>설계가 복잡</strong>하다는 단점이 있다.</li>
<li>IDS, TOTAL, IDMS와 같은 제품이 있다.</li>
</ul>
<p><span></span>
<span style="color: blue">4-4) 관계형 DB 관리 시스템</span></p>
<ul>
<li><strong>RDBMS</strong> : <strong>R</strong>elational <strong>DBMS</strong></li>
<li>가장 보편화 된 DB 관리 시스템</li>
<li>데이터를 저장하는 테이블의 일부를 다른 테이블과 <strong>상하 관계</strong>로 표시하며 <strong>상관 관계</strong>를 정리한다.</li>
<li>변화하는 업무나 데이터 구조에 대한 유연성이 좋아 유지 관리가 용이하다.</li>
</ul>
<table>
<thead>
<tr>
<th>RDBMS</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Oracle</strong></td>
<td>• <strong>미국 오라클사</strong>에서 개발한 RDBMS로, 유료이다.</td>
</tr>
<tr>
<td></td>
<td>• 리눅스, 유닉스, 윈도우 모두를 지원하며 <strong>대형 시스템</strong>에서 많이 사용한다.</td>
</tr>
<tr>
<td><strong>SQL Server</strong></td>
<td>• <strong>MS</strong>사에서 개발한 RDBMS</td>
</tr>
<tr>
<td></td>
<td>• MS사 제품 이기 때문에 <strong>Windows</strong>에서만 구동된다.</td>
</tr>
<tr>
<td></td>
<td>• MS사의 개발 언어인 <code>C#</code> 등과 가장 잘 호환된다.</td>
</tr>
<tr>
<td><strong>MySQL</strong></td>
<td>• 썬 마이크로시스템에서 소유했던 RDBMS였으나 <strong>오라클</strong>에서 인수했다.</td>
</tr>
<tr>
<td></td>
<td>• 리눅스, 유닉스, 윈도우에서 모두 사용이 가능하고, <strong>오픈소스 기반</strong>을 ㅗ개발되었다.</td>
</tr>
<tr>
<td><strong>Maria DB</strong></td>
<td>• <code>MySQL</code> 출신 개발자가 만든 DB이다.</td>
</tr>
<tr>
<td></td>
<td>• <strong>MySQL</strong>과 완벽히 호환된다.</td>
</tr>
</tbody></table>
<p><span></span>
<span style="color: blue">4-5) NoSQL</span></p>
<ul>
<li><strong>N</strong>ot <strong>O</strong>nly <strong>SQL</strong></li>
<li>전통적인 <code>RDBMS</code>보다 덜 제한적인 일관성 모델을 이용</li>
<li><strong>빅 데이터</strong>와 <strong>실시간 웹 앱</strong>의 상업적 이용에 쓰인다.</li>
</ul>
<p><span></span>
<strong>5) DBMS 구조</strong></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/85c353a8-b078-4cc1-baca-a4b79d587d67/image.png" alt=""></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/e7b02575-fb6c-41ea-b263-051d97d4b1ff/image.png" alt=""></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/c78cedc7-a300-46ad-b1e2-472ca8f7a94b/image.png" alt=""></p>
<p><span></span>
<strong>6) DBMS 분류</strong></p>
<p><span style="color: blue">6-1) 시스템 특징별 분류</span></p>
<ul>
<li>관리하는 데이터의 형태 및 관리 방식에 따라 구분할 수 있다.</li>
<li><code>관계형 DB</code>, <code>문서 저장 시스템</code>, <code>그래프 DB</code>, <code>Key-Value 스토어</code> 등으로 구분된다.</li>
</ul>
<table>
<thead>
<tr>
<th>DBMS</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>관계형 DBMS</strong></td>
<td>• <span style="color: green"><strong><code>RDBMS</code></strong>(<strong>R</strong>elational <strong><code>DBMS</code></strong>)</span></td>
</tr>
<tr>
<td></td>
<td>• 테이블의 구조(스키마)를 정의하고 테이블 간의 <strong>관계</strong>를 정의하여 데이터 관리</td>
</tr>
<tr>
<td></td>
<td>• 가장 광범위하게 쓰이는 DBMS</td>
</tr>
<tr>
<td></td>
<td>• <strong>비관계형 부분까지 확장</strong>하여 관리 범위를 넓힌 형태의 관계형 DBMS 출시</td>
</tr>
<tr>
<td></td>
<td>• ex) Oracle, MySQL, MS SQL Server, PostgreSQL, DB2, Maria DB</td>
</tr>
<tr>
<td><strong>문서 저장 DBMS</strong></td>
<td>• <span style="color: green"><strong><code>DSDBMS</code></strong>(<strong>D</strong>ocument <strong>S</strong>troe <strong><code>DBMS</code></strong>)</span></td>
</tr>
<tr>
<td></td>
<td>• 관계형 DBMS와는 달리 <strong>스키마 구조가 필요 없음</strong></td>
</tr>
<tr>
<td></td>
<td>• 일관된 구조가 필요 없음</td>
</tr>
<tr>
<td></td>
<td>• <strong>컬럼은 하나 이상의 값을 가질 수 있음</strong></td>
</tr>
<tr>
<td></td>
<td>• <strong>Client에서 후처리 필요</strong></td>
</tr>
<tr>
<td></td>
<td>• ex) Mongo DB, Amazon Dynamo DB, Couchbase, MS Azure cosmos DB</td>
</tr>
<tr>
<td><strong>그래프 DBMS</strong></td>
<td>• <span style="color: green"><strong><code>GDBMS</code></strong>(<strong>G</strong>raph <strong><code>DBMS</code></strong>)</span></td>
</tr>
<tr>
<td></td>
<td>• <strong>노드와 에지</strong>로 특징되는 요소 특화</td>
</tr>
<tr>
<td></td>
<td>• <strong>노드 간 관계를 구조화</strong>하여 저장</td>
</tr>
<tr>
<td></td>
<td>• ex) Neo4j, MS Azure cosmos DB, Orient DB, Arango DB</td>
</tr>
<tr>
<td><strong>키값 DBMS</strong></td>
<td>• <span style="color: green"><strong><code>Key-Value DBMS</code></strong></span></td>
</tr>
<tr>
<td></td>
<td>• <strong>가장 간단한 형태</strong>의 DBMS</td>
</tr>
<tr>
<td></td>
<td>• <strong>임베디드</strong> 시스템과 같은 간단한 시스템에 적합</td>
</tr>
<tr>
<td></td>
<td>• ex) Redis, Amazon Dynamo DB, Memcached</td>
</tr>
</tbody></table>
<p><span></span>
<span style="color: blue">6-1) 시스템 특징별 분류</span></p>
<table>
<thead>
<tr>
<th>DBMS</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>상용화 DBMS</strong></td>
<td>• <strong>상업적</strong> 목적으로나, <strong>판매</strong>를 목적으로 생성되는 소프트웨어</td>
</tr>
<tr>
<td></td>
<td>• ex) Oracle, MS SQL Server, DB2, Microsoft Access, Teradata</td>
</tr>
<tr>
<td><strong>오픈소스 기반 DBMS</strong></td>
<td>• 누구에게나 공개해 <strong>누구나 제한 없이</strong> 사용할 수 있는 소프트웨어</td>
</tr>
<tr>
<td></td>
<td>• MySQL, PostgreSQL, Mongo DB, Rdis, Elasticsearch</td>
</tr>
</tbody></table>
<p><span></span></p>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><span></span>
<strong>1) 다음 보기에서 설명하는 데이터베이스 관리 시스템은 무엇인지 쓰시오.</strong></p>
<blockquote>
<p>관계형 데이터베이스 시스템인 RDBMS 중 하나로, 유료이며 리눅스/유닉스/윈도우 모드를 지원하고 대형 시스템에서 많이 사용한다.</p>
</blockquote>
<ul>
<li>답 : <span style="color: blue"><strong>Oracle</strong></span></li>
</ul>
<p><span></span>
<strong>2) 다음 보기에서 설명하는 용어를 작성하시오.</strong></p>
<blockquote>
<p>데이터베이스의 중앙처리시스템인 DBMS를 관리하며 데이터의 검색, 삽입, 수정, 삭제를 수행하는 관리자를 의미한다.</p>
</blockquote>
<ul>
<li>답 : <span style="color: blue"><strong>DBA</strong></span></li>
</ul>
<p><span></span>
<strong>3) 아래 테이블의 카디널리티(Cardinality)의 수와 디그리(Degree)의 수를 구하시오.</strong></p>
<table>
<thead>
<tr>
<th align="center">사번</th>
<th align="center">부서</th>
<th align="center">직급</th>
<th align="center">성명</th>
<th align="center">전화번호</th>
</tr>
</thead>
<tbody><tr>
<td align="center">111</td>
<td align="center">영업부</td>
<td align="center">팀장</td>
<td align="center">김*</td>
<td align="center">111-1111</td>
</tr>
<tr>
<td align="center">222</td>
<td align="center">무역부</td>
<td align="center">과장</td>
<td align="center">이*</td>
<td align="center">222-2222</td>
</tr>
<tr>
<td align="center">333</td>
<td align="center">홍보부</td>
<td align="center">사원</td>
<td align="center">박*</td>
<td align="center">333-3333</td>
</tr>
</tbody></table>
<ul>
<li>답<ul>
<li>카디널리티 : <span style="color: blue"><strong>3</strong></span></li>
<li>디그리 : <span style="color: blue"><strong>5</strong></span></li>
</ul>
</li>
</ul>
<hr>
<h2 id="🍀-section-2--관계형-데이터베이스-활용">🍀 Section 2 | 관계형 데이터베이스 활용</h2>
<h3 id="1-개체-관계-다이어그램erd-e-r-diagram">1. 개체-관계 다이어그램(ERD, E-R Diagram)</h3>
<p><strong>1) ERD 개요</strong></p>
<ul>
<li>업무 분석 결과로 도출된 실체(<code>Entity</code>)와 <code>Entity</code> 간의 관계를 <strong>도식화</strong>한 것</li>
<li>요소들 간 <strong>연관성을 도식화</strong>하기 때문에 데이터베이스 관리자, 개발자, 사용자 모두 데이터의 흐름과 연관성을 공통적으로 쉽게 확인할 수 있다.</li>
</ul>
<p><span></span>
<strong>2) E-R Model</strong></p>
<ul>
<li>ERD의 구성요소인 <strong>개체, 관계, 속성</strong>을 추출하기 위해서는 업무나 시스템에 대한 명확한 정의가 있어야 한다.</li>
<li>ERD로 도식화하기 전 각 객체를 <span style="color: green"><strong>사각형, 화살표, 마름모</strong></span>로 표기한 형태를 <strong><code>E-R Model</code></strong>이라고 한다.</li>
<li>ex) <strong>업무</strong>에 대한 <strong>개체, 관계 속성</strong> 추출</li>
</ul>
<table>
<thead>
<tr>
<th>정의</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>업무</strong></td>
<td>• 각각의 <strong>종업원</strong>은 한 <strong>매장</strong>에 <strong>소속</strong>된다.</td>
</tr>
<tr>
<td></td>
<td>• <strong>종업원</strong>에 관해서는 <strong>사번, 이름, 주소, 휴대전화번호의 정보</strong>를 <strong>관리</strong>한다.</td>
</tr>
<tr>
<td></td>
<td>• <strong>매장</strong>에 대해서는 <strong>매장 코드, 매장명, 매장 전화번호, 매장 주소 정보</strong>가 유지된다.</td>
</tr>
<tr>
<td><strong>개체, 관계, 속성</strong></td>
<td>• <strong>개체</strong> : 종업원, 매장</td>
</tr>
<tr>
<td></td>
<td>• <strong>관계</strong> : 소속</td>
</tr>
<tr>
<td></td>
<td>• <strong>속성</strong> : 사번, 이름, 주소, 휴대전화번호, 매장 코드, 매장명, 매장 전화번호, 매장 주소</td>
</tr>
</tbody></table>
<p><span></span>
<span style="color: blue">2-1) 엔티티(Entity)</span></p>
<ul>
<li>사물 또는 사건을 의미하며, <strong>개체</strong>라고도 한다.</li>
<li>ERD에서 <strong><code>Entity</code></strong>는 <strong>사각형( ▢ )</strong>으로 나타내고, <strong>사각형 안</strong>에는 <strong><code>Entity</code>의 이름</strong>을 넣는다.<ul>
<li><code>Entity</code> 이름은 가능한 <strong>대문자</strong>로 쓰며 <strong>단수명</strong>으로 명명한다.</li>
<li><strong>유일한 단어</strong>로 정한다.</li>
</ul>
</li>
</ul>
<p><span></span>
<span style="color: blue">2-2) 속성(Attribute)</span></p>
<ul>
<li><code>Entity</code>가 가지고 있는 <strong>요소</strong> 또는 <strong>성질</strong></li>
<li><strong>속성</strong>은 선으로 연결된 <strong>타원( ○ )</strong>으로 <strong>표기(Chen Model)</strong>하거나 <strong>표</strong> 형식으로 <strong>표기(Crow&#39;s Foot Model)</strong>한다.</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/8ec9f1ed-a319-4ae8-8351-b6fc6ff81c54/image.png" alt=""></p>
<ul>
<li>관계형 데이터베이스 <strong>활용</strong>을 위해서는 <strong><code>Crow&#39;s Foot Model</code></strong>이 편리하다.<ul>
<li><strong>속성명</strong>은 <strong>단수형</strong>으로 명명</li>
<li><strong>엔티티명</strong>을 사용하지 <strong>않는다.</strong></li>
<li>속성이 <strong>필수사항(Not Null)</strong>인지 <strong>필수 사항이 아닌지(Null)</strong>를 고려하여 작성한다.</li>
</ul>
</li>
</ul>
<p><span></span>
<span style="color: blue">2-3) 관계(Relationship)</span></p>
<ul>
<li>두 <code>Entity</code> 간의 관계를 정의한다.</li>
<li>개체는 <strong>사각형( ▢ )</strong>, <strong>속성</strong>은 <strong>타원( ○ )</strong>을 이용하여 표시한다.</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/e4fc8f32-ce7c-45bf-a244-c4386c313a35/image.png" alt=""></p>
<p><span></span>
<strong>3) E-R Model 표기법</strong></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/6bc149f8-a4da-4750-91d8-6feee5ff3921/image.png" alt=""></p>
<p><span></span></p>
<h3 id="2-erd-작성-절차">2. ERD 작성 절차</h3>
<p><strong>1) ERD 작성을 위한 요소 추출</strong></p>
<blockquote>
<p>📝 <strong>시나리오</strong>
</span>
(1) <strong>보험사</strong>에서 사용하는 데이터베이스를 설계한다.
(2) <strong>고객</strong>이있고 고객이 이용하는 <span style="color: green"><strong>계좌</strong></span>가 있다.
(3) <strong>고객에 대한 정보</strong>로는 <span style="color: green"><strong>이름, 주소, 휴대전화번호, 주민등록번호</strong></span>가 있다.
(4) <strong>고객 계좌에 대한 정보</strong>로는 <span style="color: green"><strong>계좌번호, 계좌종류, 잔고, 개설일자, 인출한도</strong></span>가 있다.
(5) <strong>주소에 대한 정보</strong>로는 <span style="color: green"><strong>시군구, 동, 상세 주소, 우편번호</strong></span>가 있다.</p>
</blockquote>
<table>
<thead>
<tr>
<th align="center">업무로부터 추출</th>
<th>내용</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>개체</strong></td>
<td>• 고객, 계좌, 주소</td>
</tr>
<tr>
<td align="center"><strong>속성</strong></td>
<td>• 이름, 휴대전화번호, 주민등록번호</td>
</tr>
<tr>
<td align="center"></td>
<td>• 계좌번호, 계좌종류, 잔고, 개설일자, 인출한도</td>
</tr>
<tr>
<td align="center"></td>
<td>• 시군구, 동, 상세주소, 우편번호</td>
</tr>
<tr>
<td align="center"><strong>관계</strong></td>
<td>• 고객이 계좌번호를 소유한다.</td>
</tr>
<tr>
<td align="center"></td>
<td>• 고객이 주소를 소유한다.</td>
</tr>
</tbody></table>
<p><span></span>
<strong>2) E-D Model 작성</strong></p>
<ul>
<li>추출된 요소를 가지고 ERD를 작성한다.</li>
<li>일부 작성된 ERD에 추출 요소들을 입력한다.</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/00dce791-929b-4b5d-b4c2-9e79e3f8d739/image.png" alt=""></p>
<p><span></span>
<strong>3) ERD 관계형 스키마 작성</strong></p>
<p><span style="color: blue">3-1) 관계형 스키마 작성을 위한 테이블 형태를 표시한다.</span></p>
<ul>
<li>테이블의 가장 윗칸은 유일하게 필드를 구분할 수 있는 <strong>구분자(유일키)</strong>가 되어야 한다.</li>
<li><strong>유일키</strong>를 만드는 방법은 여러 가지가 있으며, <strong>일련번호</strong>를 부여하기도 한다.</li>
<li>유일키 아래 칸에는 <strong>속성</strong>들을 기입한다.</li>
<li>제약조건<ul>
<li>고객은 다수의 집을 보유할 수 있다.</li>
<li>고객은 다수의 계좌를 보유할 수 있다.</li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/8ae805d1-c89a-4202-a4e7-27a2346b0365/image.png" alt=""></p>
<p><span></span>
<span style="color: blue">3-2) 테이블 간 관계를 한다.</span></p>
<ul>
<li>테이블 간 관계를 표시한다.</li>
<li>표시 시에는 <code>1:1</code>, <code>1:N</code>, <code>M:1</code>, <code>M:N</code>의 관계를 고려해야 한다.</li>
<li>테이블 간 연결할 수 있는 속성을 부여하여, 하나의 테이블에서 다른 테이블의 값을 찾아갈 수 있어야 한다.</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/4db37252-5a29-4f93-a5ea-710d8d0ce354/image.png" alt=""></p>
<p><span></span>
<strong>4) 관계형 데이터베이스 테이블 생성</strong></p>
<p><span style="color: blue">4-1) 관계형 테이블 생성을 위한 물리 스키마를 작성한다.</span></p>
<ul>
<li>SQL 표준 언어는 한글 입력이 허용되지 않는다.</li>
<li>위 <strong>논리 스키마</strong>와 매칭되는 <strong>물리 스키마</strong>를 작성한다.</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/6411d926-94fd-4ee6-b8a0-d1c63d6c3662/image.png" alt=""></p>
<p><span></span>
<span style="color: blue">4-2) 테이블 생성을 위한 SQL 명령어를 작성한다.</span></p>
<ul>
<li>작성 시 필요한 <code>datatype</code>은 정수형, 실수형, 날짜형 등 다양하다.</li>
<li>SQL 표준을 참조하여 필요로 하는 데이터형을 입력한다.</li>
</ul>
<blockquote>
<p>💡 <strong>SQL 명령어</strong></p>
</blockquote>
<pre><code class="language-sql">CREATE TABLE table_name(
  column1 datatype,
  column2 datatype,
  ....
)</code></pre>
<blockquote>
<p>💡 <strong>SQL 예제</strong></p>
</blockquote>
<pre><code class="language-sql">CREATE TABLE Address(
  Address1 varchat(255),
  Address2 varchat(255),
  Address3 varchat(255),
  Postal_Code varchat(255),
  Client_ID varchat(255);
)</code></pre>
<p><span></span></p>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) E-R Diagram은 1976년 P.Chen이 제안한 현실 세계를 개념적으로 표현한 방법으로 업무 분석 결과로 도출된 개체와 관계를 도식화한 표현이다. 다음 괄호에 들어갈 단어를 쓰시오.</strong></p>
<table>
<thead>
<tr>
<th>기호</th>
<th>의미</th>
</tr>
</thead>
<tbody><tr>
<td>사각형</td>
<td>개체 집합</td>
</tr>
<tr>
<td>타원</td>
<td>( ➀ )</td>
</tr>
<tr>
<td>마름모</td>
<td>( ➁ )</td>
</tr>
<tr>
<td>선</td>
<td>연결</td>
</tr>
</tbody></table>
<ul>
<li>답<ul>
<li>➀ : <span style="color:blue"><strong>속성</strong></span></li>
<li>➁ : <span style="color:blue"><strong>관계</strong></span></li>
</ul>
</li>
</ul>
<hr>
<h2 id="🍀-section-3--데이터베이스-관리">🍀 Section 3 | 데이터베이스 관리</h2>
<h3 id="1-데이터베이스-연산">1. 데이터베이스 연산</h3>
<ul>
<li><strong><code>CRUD</code></strong>는 데이터베이스가 가지는 기본적인 데이터 처리 기능이다.<ul>
<li><code>Create</code> : 생성</li>
<li><code>Read</code> : 읽기</li>
<li><code>Update</code> : 수정</li>
<li><code>Delete</code> : 삭제</li>
</ul>
</li>
</ul>
<table>
<thead>
<tr>
<th>기본 처리</th>
<th><code>SQL</code></th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><code>Create</code></td>
<td><code>Insert</code></td>
<td>데이터 내 컬럼에 데이터를 <strong>추가한다.</strong></td>
</tr>
<tr>
<td><code>Read</code></td>
<td><code>Select</code></td>
<td>데이터 내 컬럼에 저장된 데이터를 <strong>불러온다.</strong></td>
</tr>
<tr>
<td><code>Update</code></td>
<td><code>Update</code></td>
<td>데이터 내 컬럼에 저장된 데이터를 <strong>수정한다.</strong></td>
</tr>
<tr>
<td><code>Delete</code></td>
<td><code>Delete</code></td>
<td>데이터 내 컬럼에 저장된 데이터를 <strong>삭제한다.</strong></td>
</tr>
</tbody></table>
<p><span></span></p>
<h3 id="2-데이터베이스-연산-수행-절차">2. 데이터베이스 연산 수행 절차</h3>
<p><strong>1) 데이터 삽입</strong></p>
<ul>
<li>테이블에서 데이터를 삽입하기 위해서는 <strong><code>&quot;Insert&quot;</code></strong> 명령어를 사용한다.</li>
</ul>
<pre><code class="language-sql"># SQL 명령어
INSERT INTO table_name
VALUES(value1, value2, value3, ...);

# SQL 예제
INSERT INTO Address
VALUES(&#39;서울특별시&#39;, &#39;성동구 XX동&#39;, &#39;대신아파트 1동 101호&#39;, &#39;09100&#39;, &#39;121&#39;);</code></pre>
<p><span></span>
<strong>2) 데이터 읽기</strong></p>
<ul>
<li>테이블에서 데이터를 읽기 위해서는 <strong><code>&quot;Select&quot;</code></strong> 명령어를 사용한다.</li>
<li><code>Select</code> 다음 <strong><code>*</code></strong> 표기를 사용하면 <strong>모든 데이터</strong>를 읽어온다.<ul>
<li><strong>컬러명</strong>을 지정하면 <strong>특정 컬럼만</strong>을 읽어 온다.</li>
</ul>
</li>
</ul>
<pre><code class="language-sql"># SQL 명령어
SELECT column1, column2, ...
FROM table_name;

# SQL 예제
SELECT * FROM Address

# 또는
SELECT SEQ_ID, address1 FROM Address;</code></pre>
<p><span></span>
<strong>3) 데이터 갱신</strong></p>
<ul>
<li>테이블에서 데이터를 갱신하기 위해서는 <strong><code>&quot;Update&quot;</code></strong> 명령어를 사용한다.</li>
<li><strong><code>where</code> 조건절</strong>을 사용하여 업데이트 할 데이터를 특정해야 한다.</li>
</ul>
<pre><code class="language-sql"># SQL 명령어
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

# SQL 예제
UPDATE Address
SET address1 = `제주도`, address2 = `서귀포시 색달동`, address3 = `청아아파트 111동 11호`
WHERE SEQ_ID = 1;</code></pre>
<p><span></span>
<strong>4) 데이터 삭제</strong></p>
<ul>
<li>테이블에서 데이터를 삭제하기 위해서는 <strong><code>&quot;Delete&quot;</code></strong> 명령어를 사용한다.</li>
<li><strong><code>where</code> 조건절</strong>을 사용하여 삭제할 데이터를 특정해야 한다.</li>
</ul>
<pre><code class="language-sql"># SQL 명령어
DELETE FROM table_name
WHERE condition;

# SQL 예제
DELETE FROM Address
WHERE address1 = &#39;서울특별시&#39;;</code></pre>
<p><span></span>
<strong>5) 기타 SQL 명령어</strong></p>
<ul>
<li><strong><code>ALTER DATABASE</code></strong>명령어로 데이터베이스를 <strong>수정한다.</strong></li>
<li><strong><code>ALTER TABLE</code></strong>명령어로 테이블 구조를 <strong>수정한다.</strong></li>
<li><strong><code>DROP TABLE</code></strong>명령어로 테이블을 전체 <strong>삭제한다.</strong></li>
<li><strong><code>CREATE INDEX</code></strong>명령어로 테이블 내 데이터의 검색 속도를 향상시킬 수 있는 인덱스를 생성한다.</li>
<li><strong><code>DROP INDEX</code></strong>명령어로 인덱스를 삭제한다.</li>
<li><strong><code>JOINT</code></strong>기능으로 <strong>복수의 테이블로부터 데이터를 조합하여 가져온다.</strong></li>
<li>그 외 <strong><code>UNION</code></strong>, <strong><code>GROUP BY</code></strong> 등의 다양한 명령어를 활용한다.</li>
</ul>
<p><span></span></p>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 데이터베이스 연산 CRUD는 기본적인 데이터 처리 기능인 Create(생성), Read(읽기), Update(갱신) 그리고 이것이 있는데 이것은 무엇인지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color:blue"><strong>Delete(삭제)</strong></span></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[3. 응용 SW 기초 기술 활용 : 네트워크]]></title>
            <link>https://velog.io/@xaexun_/3.-%EC%9D%91%EC%9A%A9-SW-%EA%B8%B0%EC%B4%88-%EA%B8%B0%EC%88%A0-%ED%99%9C%EC%9A%A9-%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC</link>
            <guid>https://velog.io/@xaexun_/3.-%EC%9D%91%EC%9A%A9-SW-%EA%B8%B0%EC%B4%88-%EA%B8%B0%EC%88%A0-%ED%99%9C%EC%9A%A9-%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC</guid>
            <pubDate>Wed, 01 Apr 2026 08:35:38 GMT</pubDate>
            <description><![CDATA[<h1 id="chapter-2--네트워크">Chapter 2 : 네트워크</h1>
<hr>
<h2 id="🍀-section-1--네트워크-기초-활용">🍀 Section 1 | 네트워크 기초 활용</h2>
<h3 id="1-네트워크-계층-구조">1. 네트워크 계층 구조</h3>
<p><strong>1) 네트워크</strong></p>
<ul>
<li>원하는 <strong>정보</strong>를 원하는 <strong>수신자</strong> 또는 <strong>기기</strong>에 정확하게 <strong>전송</strong>하기 위한 <strong>기반 인프라</strong>를 말한다.</li>
</ul>
<blockquote>
<p>💡 <strong>프로토콜</strong></p>
</blockquote>
<ul>
<li>네트워크를 사용하여 정보를 전달할 때 약속한 규칙</li>
</ul>
<p><strong>2) 거리에 따른 네트워크 분류</strong></p>
<table>
<thead>
<tr>
<th>네트워크 종류</th>
<th>네트워크 속성</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>LAN</strong> (<strong>L</strong>ocal <strong>A</strong>rea <strong>N</strong>etwork)</td>
<td>근거리 통신망</td>
<td>‧ <strong>한 건물</strong> 또는 <strong>작은 지역</strong>을 커버하는 네트워크</td>
</tr>
<tr>
<td><strong>WAN</strong> (<strong>W</strong>ide <strong>A</strong>rea <strong>N</strong>etwork)</td>
<td>장거리 통신망</td>
<td>‧ 국가, 대륙과 같이 <strong>광범위한 지역</strong>을 연결하는 네트워크</td>
</tr>
<tr>
<td></td>
<td></td>
<td>‧ 거리에 제약이 없고 <strong>라우팅 알고리즘</strong>이 필요함</td>
</tr>
<tr>
<td></td>
<td></td>
<td>‧ 다양한 경로를 지나 정보가 전달됨</td>
</tr>
<tr>
<td></td>
<td></td>
<td>‧ LAN보다 속도가 느리고 에러율도 높음</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="2-osi-open-system-interconnection-7계층">2. OSI (Open System Interconnection) 7계층</h3>
<ul>
<li>국제 표준화 기구인 <strong><code>ISO(International Standardization Organization)</code></strong> 에서 개발한 <strong>네트워크 계층 표현 모델</strong></li>
<li>각 계층은 서로 독립적으로 구성됨</li>
<li><strong>하위 계층의 기능을 이용하여 상위 계층의 기능을 제공</strong>한다.</li>
<li>1계층인 물리계층부터 7계층인 애플리켕션 계층으로 정의되어 있다.</li>
</ul>
<p><span style="color:green"><strong><code>물데네전세표응</code></strong></span></p>
<table>
<thead>
<tr>
<th align="center"></th>
<th align="center">계층 순서</th>
<th align="left">이름</th>
<th>설명</th>
<th align="center">주요 장비 및 기술</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>하위 계층</strong></td>
<td align="center"><strong><code>1</code></strong></td>
<td align="left"><span style="color:green"><strong><code>물</code></strong></span>리 계층 (Physical)</td>
<td><strong>실제 장비</strong>들을 연결하기 위한 연결 장치</td>
<td align="center">허브, 리피터</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong><code>2</code></strong></td>
<td align="left"><span style="color:green"><strong><code>데</code></strong></span>이터링크 계층 (DataLink)</td>
<td>오류와 흐름을 제거하여 <strong>신뢰성</strong> 있는 데이터 전송</td>
<td align="center">브리지, 스위치</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong><code>3</code></strong></td>
<td align="left"><span style="color:green"><strong><code>네</code></strong></span>트워크 계층 (Network)</td>
<td>다수의 중개 시스템 중 <strong>올바른 경로</strong>를 선택하도록 지원</td>
<td align="center">라우터</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong><code>4</code></strong></td>
<td align="left"><span style="color:green"><strong><code>전</code></strong></span>송 계층 (Transport)</td>
<td>송신과 수신 <strong>프로세스</strong> 간의 연결</td>
<td align="center">TCP/IP, UDP</td>
</tr>
<tr>
<td align="center"><strong>상위 계층</strong></td>
<td align="center"><strong><code>5</code></strong></td>
<td align="left"><span style="color:green"><strong><code>세</code></strong></span>션 계층 (Session)</td>
<td>송신과 수신 간의 <strong>논리적</strong> 연결</td>
<td align="center">호스트 (PC 등)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong><code>6</code></strong></td>
<td align="left"><span style="color:green"><strong><code>표</code></strong></span>현 계층 (Presentation)</td>
<td>코드 문자 등을 번역하여 일관되게 전송하고 <strong>압축, 해제, 보안</strong> 기능 담당</td>
<td align="center">호스트 (PC 등)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong><code>7</code></strong></td>
<td align="left"><span style="color:green"><strong><code>응</code></strong></span>용 계층 (Application)</td>
<td><strong>사용자 친화</strong> 환경 제공 (이메일, 웹 등)</td>
<td align="center">호스트 (PC 등)</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="3-네트워크-주요-장비">3. 네트워크 주요 장비</h3>
<p><strong>1) 허브</strong></p>
<ul>
<li><strong>여러 대의 컴퓨터</strong>를 연결하여 <strong>네트워크</strong>로 보내거나,</li>
<li><strong>하나의 네트워크</strong>로 수신된 정보를 <strong>여러 대의 컴퓨터</strong>로 송신하기 위한 장비</li>
<li>수신한 프레임을 수신 포트를 제외한 <strong>모든 포트로 전송</strong>한다.</li>
</ul>
<blockquote>
<p>💡 <strong>허브의 종류</strong></p>
</blockquote>
<ul>
<li><strong>더미 허브</strong><ul>
<li>데이터를 단순히 연결한 <strong>성형 구조</strong>로 구성되어 있는 허브</li>
</ul>
</li>
<li><strong>스위치 허브</strong><ul>
<li>스위치 기능을 가진 허브</li>
<li><strong>데이터의 유무 및 흐름을 제어</strong>하는 지능형 허브</li>
<li>요즘 사용되는 대부분의 허브</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong>성형 구조</strong></p>
</blockquote>
<ul>
<li><strong>스타형 구조(Star Topology)</strong>라고도 불린다. (성 = 별)</li>
<li>중앙 장치(허브)를 중심으로 각 노드가 연결되어 있음
<img src="https://velog.velcdn.com/images/xaexun_/post/cd3cc506-e640-4779-8d39-d4c8577ef45f/image.png" alt=""></li>
</ul>
<p><strong>2) 리피터</strong></p>
<ul>
<li>감쇠된 전송 신호를 새롭게 <strong>재생</strong>하여 다시 전달하는 <strong>재생 중계 장치</strong></li>
<li>허브 등으로 연결하여 통신하는 경우, <strong>감쇠된 디지털 신호를 증폭</strong>시켜 주는 역할을 한다.</li>
<li>신호가 약해지지 않고 컴퓨터로 수신되도록 한다.</li>
</ul>
<p><strong>3) 브리지와 스위치</strong></p>
<ul>
<li>브리지와 스위치는 두 시스템을 연결하는 네트워크 장치이다. (성격은 반대)</li>
<li>두 개의 LAN을 연결하여 훨씬 더 큰 LAN을 만들어 준다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">브리지</th>
<th align="center">스위치</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>소프트웨어</strong> 방식</td>
<td align="center"><strong>하드웨어</strong> 방식</td>
</tr>
<tr>
<td align="center"><strong>저속</strong></td>
<td align="center"><strong>고속</strong></td>
</tr>
<tr>
<td align="center">포트들이 <strong>동일한</strong> 속도로 전송</td>
<td align="center">포트들이 <strong>다른</strong> 속도로 전송</td>
</tr>
<tr>
<td align="center"><strong>2~3개</strong> 포트</td>
<td align="center"><strong>수백 개</strong> 이상의 포트</td>
</tr>
<tr>
<td align="center">목적지 주소를 기준으로 <strong>1:1</strong> 연결</td>
<td align="center">목적지 주소 기준으로 <strong>1:N</strong> 연결</td>
</tr>
<tr>
<td align="center"><strong>Store and Forwarding</strong> 방식만 사용</td>
<td align="center"><strong>Cut Through</strong> 또는 <strong>Fragment Free</strong> 방식 사용</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<p><span style="color:green"><strong><code>프레임 전송 방식</code></strong></span></p>
<table>
<thead>
<tr>
<th align="center">프레임 전송 방식</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>Store and Forwarding</strong></td>
<td>‧ 프레임 전체를 다 받은 후 에러 검사 및 전송</td>
</tr>
<tr>
<td align="center"><strong>Cut Through</strong></td>
<td>‧ 목적지 MAC 주소만 확인 후 바로 전송 시작</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 에러 검출 없음</td>
</tr>
<tr>
<td align="center"><strong>Fragment Free</strong></td>
<td>‧ 처음 64바이트만 에러 검사 후 전송</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ Cut Through 기반</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ Store and Forwarding 방식의 에러 검사</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<p><span style="color:green"><strong><code>프레임 구조</code></strong></span> : <code>[목적지 MAC][출발지 MAC][데이터][에러검사]</code></p>
<p><span></span>
<span></span></p>
<p><strong>4) 라우터</strong></p>
<ul>
<li><strong>서로 다른 구조의 망을 연결하는 연동 장비</strong></li>
<li>라우팅 프로토콜은 경로를 설정하여 원하는 목적지까지 지정된 데이터가 안전하게 전달되도록 한다.</li>
</ul>
<p><strong>5) 게이트웨이</strong></p>
<ul>
<li>프로토콜을 서로 다른 통신망에 접속할 수 있게 해주는 장치</li>
<li>프로토콜을 다른 종류의 네트워크 등을 상호 접속하게 해주는 장치</li>
</ul>
<p><strong>6) NIC (Network Interface Card)</strong></p>
<ul>
<li>외부 네트워크와 접속하여 가장 빠른 속도로 데이터를 주고받을 수 있게하는 장치이다.</li>
<li>컴퓨터 내에 설치된다.</li>
</ul>
<p><span></span>
<span></span></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/4cf7d2f4-4430-4d26-abf8-98706df724b4/image.png" alt=""></p>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 다음 보기에서 설명하는 네트워크 장비를 쓰시오.</strong></p>
<blockquote>
<p>소프트웨어적인 방법을 통해 프레임(데이터)을 목적지 주소를 기준으로 1:1로 연결하여 전송</p>
</blockquote>
<ul>
<li>답 : <span style="color:blue"><strong>브리지</strong></span></li>
</ul>
<p>**2) OSI 7계층은 크게 상위 계층과 하위 계층으로 나눌 수 있는데 다음 보기에 있는 OSI 7계층 중 하위 계층으로 올바르지 않은 것을 모두 골라 쓰시오.</p>
<blockquote>
</blockquote>
<p>ㄱ. 세션 계층
ㄴ. 네트워크 계층
ㄷ. 물리 계층
ㄹ. 전송 계층</p>
<ul>
<li>답 : <span style="color:blue"><strong>ㄱ</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-2--네트워크-프로토콜-파악">🍀 Section 2 | 네트워크 프로토콜 파악</h2>
<h3 id="1-네트워크-프로토콜">1. 네트워크 프로토콜</h3>
<p><strong>1) 네트워크 프로토콜 개념</strong></p>
<ul>
<li>컴퓨터나 원거리 통신 장비 사이에서 메시지를 주고받는 <strong>양식과 규칙의 체계</strong></li>
<li>통신 규약 또는 규칙에는<ul>
<li>전달/통신/오류 검증 방식, 자료의 형식, 코드 변환 규칙, 전송 속도 등이 있다.</li>
</ul>
</li>
<li>다른 기종의 장비는 <strong>각기 다른 통신 규약</strong>을 사용하는데, <strong>프로토콜</strong>을 사용하면 다른 기기 간 정보의 전달을 <strong>표준화</strong>할 수 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>프로토콜의 기본 요소</strong></p>
</blockquote>
<ul>
<li>구문(Syntax)</li>
<li>의미(Semantics)</li>
<li>시간(Timing)</li>
</ul>
<p><span></span>
<span></span></p>
<p><span style="color:blue">1-1) 네트워크 프로토콜의 종류</span></p>
<table>
<thead>
<tr>
<th align="center">네트워크 프로토콜</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>HTTP</strong></td>
<td>‧ <strong>웹(인터넷) 상</strong>에서 <strong>데이터</strong>를 주고받을 수 있는 프로토콜</td>
</tr>
<tr>
<td align="center"><strong>FTP</strong></td>
<td>‧ <strong>네트워크</strong>를 통해 <strong>컴퓨터들 간의 파일</strong>을 교환하기 위한 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ Anonymous FTP는 익명성을 보장함</td>
</tr>
<tr>
<td align="center"><strong>Telnet</strong></td>
<td>‧ 원격 통신에 이용되는 프로토콜 중 하나</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 데이터의 전송 시에 암호화 작업이 존재하지 않아 <strong>보안성이 낮은</strong> 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 포트번호 : 23</td>
</tr>
<tr>
<td align="center"><strong>SSH</strong></td>
<td>‧ 원격 통신에 이용되는 프로토콜 중 하나</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 데이터의 전송 시에 암호화 작업이 존재하여 <strong>보안성이 높은</strong> 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 포트번호 : 22</td>
</tr>
<tr>
<td align="center"><strong>rlogin</strong></td>
<td>‧ <strong>UNIX</strong>와 같은 시스템의 같은 네트워크 상에서 사용되는 <strong>원격 통신</strong> 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 포트 번호 : 513</td>
</tr>
<tr>
<td align="center"><strong>SOAP</strong></td>
<td>‧ HTTP, HTTPS 등을 통해 XML 기반의 데이터를 컴퓨터 네트워크 상에서 교환하는 프로토콜</td>
</tr>
<tr>
<td align="center"><strong>TCP</strong></td>
<td>‧ 데이터를 주고받는 과정에서 데이터를 검수하는 작업을 통해 서로 확인하는 과정을 거침</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 데이터 누락 등을 확인할 수 있는 <strong>신뢰성 있는</strong> 데이터 전송 프로토콜</td>
</tr>
<tr>
<td align="center"><strong>UDP</strong></td>
<td>‧ 데이터를 주고받는 과정에서 확인하는 과정을 거치지 않아 <strong>신뢰성이 떨어지는</strong> 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 확인하는 과정이 없기 때문에 TCP보다 데이터 전송이 빠름</td>
</tr>
<tr>
<td align="center"><strong>DHCP</strong></td>
<td>‧ 각종 TCP/IP 프로토콜 및 IP 주도 등을 <strong>자동적으로 클라이언트가 제공 및 사용</strong>할 수 있도록 해주는 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 유동 IP 설정</td>
</tr>
<tr>
<td align="center"><strong>ARP</strong></td>
<td>‧ <strong><code>A</code></strong><code>ddress</code> <strong><code>R</code></strong><code>esolution</code> <strong><code>P</code></strong><code>rotocol</code></td>
</tr>
<tr>
<td align="center"></td>
<td>‧ IP(논리적 주소)에 대응되는 이더넷 카드의 MAC(물리적 주소)을 검색하여 변환해주는 프로토콜</td>
</tr>
<tr>
<td align="center"><strong>RARP</strong></td>
<td>‧ ARP와 다르게 MAC(물리적 주소)을 IP(논리적 주소)로 변환해주는 프로토콜</td>
</tr>
<tr>
<td align="center"><strong>SMTP</strong></td>
<td>‧ 전자우편 <strong>송신</strong> 프로토콜</td>
</tr>
<tr>
<td align="center"><strong>POP3</strong></td>
<td>‧ 전자우편 <strong>수신</strong> 프로토콜</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<p><span style="color:blue">1-2) 네트워크 프로토콜의 특징</span></p>
<table>
<thead>
<tr>
<th align="center">특징</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>단편화</strong></td>
<td>전송이 가능한 <strong>작은 블록</strong>으로 나누어지는 것</td>
</tr>
<tr>
<td align="center"><strong>재조립</strong></td>
<td>단편화 된 조각들을 원래 데이터로 <strong>복원</strong>하는 것</td>
</tr>
<tr>
<td align="center"><strong>캡슐화</strong></td>
<td>상위 계층의 데이터에 각종 정보를 추가하여 <strong>하위 계층으로</strong> 보내는 것</td>
</tr>
<tr>
<td align="center"><strong>연결 제어</strong></td>
<td><strong>데이터의 전송량이나 속도를 제어</strong>하는 것</td>
</tr>
<tr>
<td align="center"><strong>오류 제어</strong></td>
<td>전송 중 잃어버리는 데이터나 <strong>오류</strong>가 발생한 데이터를 <strong>검증</strong>하는 것</td>
</tr>
<tr>
<td align="center"><strong>동기화</strong></td>
<td>송신과 수신측의 <strong>시점</strong>을 맞추는 것</td>
</tr>
<tr>
<td align="center"><strong>다중화</strong></td>
<td>하나의 통신 회선에 여러 기기들이 <strong>접속</strong>할 수 있는 것</td>
</tr>
<tr>
<td align="center"><strong>주소 지정</strong></td>
<td>송신과 수신지의 주소를 부여하여 <strong>정확한</strong> 데이터 전송을 보장하는 것</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<p><strong>2) IP(Internet Protocol) 주소</strong></p>
<ul>
<li><p>전 세계 컴퓨터에 부여되는 유일한 식별자</p>
</li>
<li><p><strong>IP</strong>는 각 나라의 <strong>공인 기관</strong>에서 할당하고 관리한다.</p>
<ul>
<li>한국 : <strong>한국인터넷진흥원(KR-NIC)</strong></li>
</ul>
<blockquote>
<p> 💡 <strong>IPv4</strong></p>
</blockquote>
<ul>
<li>인터넷 초기부터 현재까지 쓰고있는 <strong>주소 체계</strong></li>
<li>000.000.000.000과 같이 <strong>12자리로 표시</strong>하고 약 43억 개를 부여할 수 있다.</li>
<li>최근에는 디바이스의 증가로 IPv4가 가진 주소의 양이 부족할 수 있어 *<em>IPv6</em>를 공표하였다.</li>
</ul>
</li>
<li><p>2018년부터 현재까지 <strong>IPv4와 IPv6</strong>가 공존하면서 <strong>두 개의 주소 체계를 변환</strong>하여 사용하고 있다.</p>
</li>
<li><p>이를 담당하는 것을 <strong>NAT(Network Address Translator)</strong>이라고 한다.</p>
</li>
</ul>
<p><span></span>
<span style="color:blue">2-1) IPv4와 IPv6의 비교</span></p>
<table>
<thead>
<tr>
<th align="center">구분</th>
<th align="center">IPv4</th>
<th align="center">IPv6</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>주소 길이</strong></td>
<td align="center">32bit</td>
<td align="center">128bit</td>
</tr>
<tr>
<td align="center"><strong>표시 방법</strong></td>
<td align="center">8비트씩 4부분(10진수)</td>
<td align="center">16비트씩 8부분(16진수)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">000.000.000.000</td>
<td align="center">0000:0000:0000:0000</td>
</tr>
<tr>
<td align="center"><strong>주소 개수</strong></td>
<td align="center">약 43억 개</td>
<td align="center">약 43억 × 43억 × 43억 × 43억 개</td>
</tr>
<tr>
<td align="center"><strong>주소 할당</strong></td>
<td align="center">A, B, C 등 클래스 단위의 비순차적 할당</td>
<td align="center">네트워크 규모 및 단말기 수에 따른 순차적 할당</td>
</tr>
<tr>
<td align="center"><strong>품질 제어</strong></td>
<td align="center">지원 수단 없음</td>
<td align="center">등급별, 서비스별로 패킷 구분</td>
</tr>
<tr>
<td align="center"><strong>보안 기능</strong></td>
<td align="center">IPsec 프로토콜 별도 설치</td>
<td align="center">확장 기능에서 기본으로 제공</td>
</tr>
<tr>
<td align="center"><strong>헤더 크기</strong></td>
<td align="center">가변</td>
<td align="center">고정</td>
</tr>
<tr>
<td align="center"><strong>pnp</strong></td>
<td align="center">지원 수단 없음</td>
<td align="center">지원</td>
</tr>
<tr>
<td align="center"><strong>웹 캐스팅</strong></td>
<td align="center">곤란</td>
<td align="center">용이</td>
</tr>
<tr>
<td align="center"><strong>전송 방식</strong></td>
<td align="center">멀티캐스트, <strong>브로드 캐스트</strong>, 유니캐스트</td>
<td align="center">멀티캐스트, <strong>애니케스트</strong>, 유니캐스트</td>
</tr>
</tbody></table>
<p><span></span>
<span style="color:blue">2-2) 네트워크 클래스</span></p>
<ul>
<li>네트워크 단말의 증가로 가용 가능한 <strong>IPv4</strong>의 주소가 부족해짐</li>
<li>이에 <strong>사용 목적에 따라 IP 대역대</strong>를 나누어 각 규모에 따라 관리하기 쉽게 표현한 것</li>
</ul>
<table>
<thead>
<tr>
<th align="center">클래스</th>
<th>IP 주소의 첫 번째 옥텟</th>
<th>사용 목적</th>
<th>IP 주소 첫 번째 바이트 범위</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>A</strong></td>
<td>0xxx xxxx</td>
<td><strong>대형</strong> 기관(대륙 간)</td>
<td>0 ~ 127</td>
</tr>
<tr>
<td align="center"><strong>B</strong></td>
<td>10xx xxxx</td>
<td><strong>중형</strong> 기관(국가 간)</td>
<td>128 ~ 191</td>
</tr>
<tr>
<td align="center"><strong>C</strong></td>
<td>110x xxxx</td>
<td><strong>소형</strong> 기관(기업 간)</td>
<td>192 ~ 223</td>
</tr>
<tr>
<td align="center"><strong>D</strong></td>
<td>1110 xxxx</td>
<td><strong>그룹</strong> 통신, 멀티캐스트용</td>
<td>224 ~ 239</td>
</tr>
<tr>
<td align="center"><strong>E</strong></td>
<td>1111 xxxx</td>
<td><strong>연구, 실험용</strong></td>
<td>240 ~ 254</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>옥텟</strong></p>
</blockquote>
<ul>
<li><strong>IP 주소(32비트)를 8비트씩 나눈 단위</strong></li>
<li>IPv4 주소는 <strong>4개의 옥텟</strong>으로 나뉘고, 각 옥텟은 다음과 같은 값을 가진다.<ul>
<li><strong><code>2진수</code></strong> : <code>00000000 ~ 11111111</code></li>
<li><strong><code>10진수</code></strong> : <code>0 ~ 255</code></li>
</ul>
</li>
<li><code>192.168.1.1</code> : <strong>4개의 옥텟</strong>으로 구성된 IP 주소</li>
<li><strong>맨 왼쪽 옥텟</strong><ul>
<li>첫 번째 옥텟</li>
<li>IP 클래스를 결정하는데 사용한다.</li>
<li>네트워크 ID의 일부로 사용되어 네트워크를 식별</li>
</ul>
</li>
<li><strong>맨 오른쪽 옥텟</strong><ul>
<li>마지막 옥텟</li>
<li>호스트 ID의 일부로 사용</li>
<li>네트워크 내 특정 장치(호스트)를 식별</li>
</ul>
</li>
</ul>
<p><span></span>
<span style="color:blue">2-3) 서브넷 마스크</span></p>
<blockquote>
</blockquote>
<ul>
<li>IP 주소는 <strong>네트워크 주소</strong>와 <strong>호스트 주소</strong>로 구성된다.</li>
<li>서브넷 마스크는 이 둘을 구분하는 역할을 한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">클래스</th>
<th align="center">디폴트 서브넷 마스크</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>A</strong></td>
<td align="center">255.0.0.0</td>
</tr>
<tr>
<td align="center"><strong>B</strong></td>
<td align="center">255.255.0.0</td>
</tr>
<tr>
<td align="center"><strong>C</strong></td>
<td align="center">255.255.255.0</td>
</tr>
</tbody></table>
<h3 id="2-tcpip-프로토콜">2. TCP/IP 프로토콜</h3>
<p><strong>1) TCP/IP 프로토콜 개념</strong></p>
<blockquote>
<p>💡 <strong>TCP/IP ?</strong>
<span></span>
다음 아래를 통칭한다.
<span></span></p>
</blockquote>
<ul>
<li><strong>TCP</strong>(<strong>T</strong>ransmission <strong>C</strong>ontrol <strong>P</strong>rotocol)</li>
<li><strong>IP</strong>(<strong>I</strong>nternet <strong>P</strong>rotocol)</li>
<li><strong>UDP</strong>(<strong>U</strong>ser <strong>D</strong>iagram <strong>P</strong>rotocol)</li>
<li><strong>ICMP</strong>(<strong>I</strong>nternet <strong>C</strong>ontrol <strong>P</strong>rotocol)</li>
<li><strong>ARP</strong>(<strong>A</strong>ddress <strong>R</strong>esolution <strong>P</strong>rotocol)</li>
<li><strong>RARP</strong>(<strong>R</strong>everse <strong>ARP</strong>)</li>
</ul>
<p><span></span>
<span></span></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/4cf7d2f4-4430-4d26-abf8-98706df724b4/image.png" alt=""></p>
<p><span></span>
<span></span></p>
<p><strong>2) TCP와 UDP의 차이점</strong></p>
<ul>
<li><strong>데이터 전송의 신뢰성</strong><ul>
<li><strong>TCP</strong><ul>
<li>수신측의 수신 가능 상태와 수신 여부 등을 단계별로 <strong>체크</strong>해가며 데이터 전송</li>
</ul>
</li>
<li><strong>UDP</strong><ul>
<li>망으로 데이터를 송신할 뿐, <strong>확인 작업을 수행하지 않는다.</strong></li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/e5d3c8cd-9c5a-4ce8-8586-756e663d3fac/image.png" alt=""></p>
<p><span></span>
<span style="color:blue">2-1) TCP(Transmission Control Protocol)</span></p>
<ul>
<li>전송 제어 프로토콜</li>
<li>CRC 체크와 재전송 기능을 통해 신뢰성 있는 전송을 확보한다.</li>
<li>Flow Control 기능을 수행하여 단계별 데이터 전송 상황을 체크한다.</li>
<li>논리적인 1:1 가상 회선을 지원하여 해당 결로로만 데이터가 전달되도록 한다.</li>
<li>대표 서비스 : FTP, Telnet, Http, SMTP, POP, IMAP 등</li>
</ul>
<p><span></span>
<span style="color:blue">2-2) UDP(User Datagram Protocol)</span></p>
<ul>
<li>연결되어 있으면 데이터를 송신할 수 있지만, 수신측 <strong>수신 여부는 확인하기 어렵다.</strong></li>
<li>Flow Control, Error Control을 하지 않아 신뢰성 있는 데이터 전송에는 부적합하다.</li>
<li><strong>하나</strong>의 송신 정보를 <strong>다수</strong>의 인원이 수신해야 할 경우세 사용한다.</li>
<li>대표 서비스 : SNMP, DNS, TFTP, NFS, NETBIOS, 인터넷 게임/방송/증권 등</li>
</ul>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 다음 보기의 설명 중 OSI 7계층 정의에 맞는 계층을 쓰시오.</strong></p>
<blockquote>
</blockquote>
<p>논리적 주소(IP)를 이용하여 최적의 경로를 선택하며, 데이터가 전송될 수신측 주소를 확인하여 일치하면 다음 계층으로 전송한다.</p>
<ul>
<li>답 : <span style="color:blue"><strong>네트워크 계층</strong></span></li>
</ul>
<p><strong>2) IP 주소를 사용 목적에 따라 나누어 각 규모에 따라 관리하기 쉽게 표현한 것을 네트워크 클래스라고 하는데, 그 중 사용 목적이 연구 또는 실험용으로 쓰이는 네트워크 클래스는 무엇인지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color:blue"><strong>E 클래스</strong></span></li>
</ul>
<p><span></span>
<span></span></p>
<hr>
<p><span></span></p>
<h2 id="🍀-section-3--네트워크-핵심-알고리즘">🍀 Section 3 | 네트워크 핵심 알고리즘</h2>
<h3 id="1-패킷-스위칭패킷-교환">1. 패킷 스위칭(패킷 교환)</h3>
<blockquote>
<p>💡 <strong>Packet Switching</strong></p>
</blockquote>
<ul>
<li>컴퓨터 네트워크 통신 방식 중 하나</li>
<li>작은 블록의 패킷으로 데이터를 전송</li>
<li><strong>데이터를 전송하는 동안만 네트워크 자원을 사용</strong>하도록 하는 방법</li>
</ul>
<blockquote>
<p>💡 <strong>Packet</strong></p>
</blockquote>
<ul>
<li>정보 전달의 단위</li>
<li>여러 통신 지점(Node)을 연결하는 데이터 연결 상의 모든 노드들 사이에 개별적으로 경로가 제어된다.</li>
<li>이 방식은 회선 교환 방식과는 달리 짤막한 데이터 트래픽에 적합하다.</li>
</ul>
<blockquote>
<p>💡 ** 회선 교환 방식**</p>
</blockquote>
<ul>
<li>통신 기간 동안 독점적인 사용을 위해 두 통신 노드 사이를 연결함</li>
</ul>
<p><strong>1) X.25</strong></p>
<ul>
<li>패킷이라고 불리는 데이터 블록을 사용하여 <strong>대용량의 데이터</strong>를 <strong>다수의 패킷으로 분리</strong>하여 송신</li>
<li><strong>수신측</strong>에서는 <strong>다수의 패킷을 결합</strong>하여 원래의 <strong>데이터</strong>로 <strong>복원</strong></li>
<li>전기 통신 국제기구인 ITU-T에서 관리 감독하는 프로토콜</li>
<li>OSI 7계층의 레이어 중 <code>1~3</code>계층까지 담당한다.</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/ab8fbfe5-ee8e-4068-ab00-4a7d716364b3/image.png" alt=""></p>
<ul>
<li><code>X.25</code>는 데이터 송수신의 신뢰성을 확보하기 위해 양자 간 통신 연결을 확립해 나가는 프로세스를 거친다.</li>
<li>초기에 에러 제어나 흐름 제어를 위한 복잡한 기능을 가지고 있었음<ul>
<li><strong>성능 상의 오버헤드 발생</strong></li>
</ul>
</li>
<li>현재는 <strong>프레임 릴레이, ISDN, ATM 등 고속망</strong>으로 대체되었다.</li>
</ul>
<p><span></span>
<span></span></p>
<p><strong>2) 프레임 릴레이</strong></p>
<ul>
<li>ISDN을 사용하기 위한 프로토콜</li>
<li>ITU-T에 의해 표준으로 작성되었고 다음과 같은 특징이 있다.</li>
</ul>
<blockquote>
</blockquote>
<ul>
<li>망의 성능 향상을 위해 <strong>에러 제어 기능</strong>과 <strong>흐름 제어 기능</strong>을 <strong>단순화</strong> 시켰다.</li>
<li>전용선을 사용하는 것보다 가격이 <strong>저렴</strong>하며 기술적으로는 <strong><code>X.25</code></strong>에 비해 <strong>우위</strong>에 있다.</li>
<li><strong><code>X.25</code></strong>은 고정된 대역폭을 가짐<ul>
<li><strong><code>프레임 릴레이</code></strong>는 사용자의 요청에 따라 <strong>유연한 대역폭</strong>을 할당한다.</li>
</ul>
</li>
<li><strong><code>X.25</code></strong>는 OSI 7계층 중 <code>1~3</code> 계층을 담당<ul>
<li><strong><code>프레임 릴레이</code></strong>는 <code>1~2</code> 계층을 담당</li>
</ul>
</li>
</ul>
<p><span></span>
<span></span></p>
<p><strong>3) ATM</strong></p>
<ul>
<li><strong>A</strong>synchronous <strong>T</strong>ransfer <strong>M</strong>ode : 비동기 전송 모드</li>
<li>광대역 전송에 쓰이는 <strong>스위칭 기법</strong></li>
<li>동기화를 맞추지 않아 보낼 데이터가 없는 사용자의 슬롯을 다른 사람이 사용할 수 있도록 하여 네트워크상의 효율성을 높였다.</li>
<li><strong><code>ATM</code></strong>망은 연결형 회선이기 때문에 <strong>하나</strong>의 패킷을 보내 연결을 설정하게 되고, 이후 실데이터 전송이 이루어진다.</li>
<li><strong><code>ATM</code></strong>은 OSI 7계층과는 다른 고유한 참조 모델을 가지고 있다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">계층</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>물리 계층</strong></td>
<td>‧ Physical Layer</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 물리적 전송 매체를 다룬다.</td>
</tr>
<tr>
<td align="center"><strong>ATM 계층</strong></td>
<td>‧ 셀과 셀 전송을 담당한다.</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 셀의 레이아웃을 정의하고 헤더 필드가 의미하는 것을 알려준다.</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 가상 회선의 연결 및 해제, 혼잡 제어를 다룬다.</td>
</tr>
<tr>
<td align="center"><strong>AAL 계층</strong></td>
<td>‧ <strong>A</strong>TM <strong>A</strong>daptation <strong>L</strong>ayer</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 패킷을 작은 조각인 셀로 전송</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 이후 다시 조립하여 원래 데이터로 복원하는 역할</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="2-서킷-스위칭회선-교환">2) 서킷 스위칭(회선 교환)</h3>
<ul>
<li>패킷 스위칭과 달리 <strong>네트워크 리소스를 특정 사용층이 독점</strong>하도록 하는 것</li>
<li>네트워크를 독점적으로 사용하기 때문에 전송이 <strong>보장(Guarantedd)</strong>된다는 특징이 있다.</li>
<li><strong>서킷</strong>을 <strong>확보</strong>하기 위한 작업을 진행하고 <strong>실데이터</strong>를 <strong>전송</strong>하며 <strong>서킷</strong>을 <strong>닫는 프로세스</strong>로 진행된다. 이러한 작업이 일어나는 동안 <strong>다른 기기들은 해당 경로를 사용할 수 없다.</strong></li>
</ul>
<p><span></span>
<span></span></p>
<h3 id="3-라우팅-알고리즘">3) 라우팅 알고리즘</h3>
<ul>
<li><strong>목적지까지의 최적 경로를 산출하기 위한 법칙</strong></li>
<li>데이터는 송신측으로부터 수신측까지 데이터를 전달하는 과정에서 <strong>다양한 물리적인 장치들</strong>을 거쳐간다.</li>
</ul>
<p><strong>1) 거리 벡터 알고리즘</strong></p>
<ul>
<li>Distance Vector Algorithm</li>
<li>라우터와 라우터 간의 <strong>최단 경로 스패닝 트리</strong>를 찾는다.</li>
<li>그 최적 경로를 이용할 수 없는 경우 <strong>다른 경로</strong>를 찾는다.</li>
<li>각 라우터가 업데이트 될 때마다 <strong>전체 라우팅 테이블</strong>을 보내라고 요청</li>
<li><strong>수신된 경로 비용 정보는 아웃 라우터에게만</strong> 보내진다.</li>
<li><strong>링크 상태 알고리즘</strong>보다 계산면에서 단순하다.</li>
</ul>
<p><strong>2) 링크 상태 알고리즘</strong></p>
<ul>
<li>라우터와 라우터 간의 <strong>모든 정보를 파악</strong>한 뒤 <strong>대체 경로</strong>를 사전에 마련해두는 방식</li>
<li>네트워크를 일관성 있게 파악할 수 있으나, 거리 벡터 알고리즘에 비하여 <strong>계산이 더 복잡</strong>하고 <strong>트래픽을 광범위한 범위까지</strong> 전달해야 한다.</li>
</ul>
<p><strong>3) 라우팅 프로토콜의 종류</strong></p>
<table>
<thead>
<tr>
<th align="center">프로토콜</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>RIP</strong></td>
<td>‧ <strong>최초</strong>의 라우팅 프로토콜</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ <strong>거리 벡터 알고리즘</strong> 활용</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 30초 주기로 전체 라우팅 정보 갱신</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 변화 업데이트 시 많은 시간 소요</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ <strong>라우팅 루프 발생 가능</strong></td>
</tr>
<tr>
<td align="center"><strong>IFRP</strong></td>
<td>‧ RIP의 문제점 개선을 위해 시스코에서 개발</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ <strong>네트워크 상태를 고려</strong>하여 라우팅(대역폭, 속도 등)</td>
</tr>
<tr>
<td align="center"><strong>OSPF</strong></td>
<td>‧ <strong>링크 상태 알고리즘</strong> 사용</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 발생한 변경 정보에 대해 RIP보다 빠른 업데이트</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 토폴로지에 대한 정보가 전체 라우터에 동일하게 유지</td>
</tr>
<tr>
<td align="center"><strong>BGP</strong></td>
<td>‧ <strong>규모가 큰 네트워크의 상호 연결</strong></td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 대형 사업자(<code>ISP</code>)간의 라우팅</td>
</tr>
</tbody></table>
<p><span></span>
<span></span></p>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 다음 보기 중 라우팅 프로토콜의 종류로 올바른 것만 작성하시오.</strong></p>
<blockquote>
</blockquote>
<ul>
<li><p>RIP</p>
</li>
<li><p>FTP</p>
</li>
<li><p>IGRP</p>
</li>
<li><p>SMTP</p>
</li>
<li><p>답 : <span style="color=blue"><strong>RIP, IGRP</strong></span></p>
</li>
</ul>
<p><strong>2) 컴퓨터 네트워크 통신 방식 중 작은 블록의 단위로 데이터를 전송하며 데이터를 전송하는 동안에만 네트워크 자원을 사용하도록 하는 방법으로, 현재 가장 많은 사람들이 사용하는 통신 방법이 무엇인지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color=blue"><strong>패킷 스위칭(패킷 교환)</strong></span></li>
</ul>
<p><span></span>
<span></span></p>
<hr>
<p><span></span>
<span></span></p>
<h1 id="💡-references">💡 References</h1>
<ul>
<li><a href="https://m.blog.naver.com/on21life/221516295248">네트워크 - 옥텟, Octet 이란 무엇인가</a></li>
<li><a href="https://se-juno.tistory.com/4">서브넷 마스크 쉽게 이해하기</a></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[3. 응용 SW 기초 기술 활용 : 운영체제]]></title>
            <link>https://velog.io/@xaexun_/3.-%EC%9D%91%EC%9A%A9-SW-%EA%B8%B0%EC%B4%88-%EA%B8%B0%EC%88%A0-%ED%99%9C%EC%9A%A9-%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C</link>
            <guid>https://velog.io/@xaexun_/3.-%EC%9D%91%EC%9A%A9-SW-%EA%B8%B0%EC%B4%88-%EA%B8%B0%EC%88%A0-%ED%99%9C%EC%9A%A9-%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C</guid>
            <pubDate>Fri, 27 Mar 2026 05:17:02 GMT</pubDate>
            <description><![CDATA[<h1 id="📍-chapter-1--운영-체제">📍 Chapter 1 : 운영 체제</h1>
<hr>
<h2 id="🍀-section-1--운영체제-기초-활용">🍀 Section 1 | 운영체제 기초 활용</h2>
<h3 id="1-운영체제">1. 운영체제</h3>
<p><strong>1) 운영체제의 특징</strong></p>
<blockquote>
<p>💡 <strong>운영체제</strong></p>
</blockquote>
<ul>
<li>사용자로 하여금 컴퓨터의 <strong>하드웨어</strong>를 보다 쉽게 사용할 수있도록 <strong>인터페이스를 제공</strong>해주는 소프트웨어</li>
</ul>
<table>
<thead>
<tr>
<th align="center">하드웨어 구분</th>
<th>역할</th>
<th>종류</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>중앙 처리 장치</strong></td>
<td>컴퓨터의 장치를 제어하고 데이터를 처리</td>
<td>CPU(Central Processing Unit)</td>
</tr>
<tr>
<td align="center"><strong>기억 장치</strong></td>
<td>데이터를 저장</td>
<td>메모리, 디스크</td>
</tr>
<tr>
<td align="center"><strong>통신 장치</strong></td>
<td>외부와의 통신을 담당</td>
<td>외부 장치(무선랜, 모뎀)</td>
</tr>
<tr>
<td align="center"><strong>입출력 장치</strong></td>
<td>데이터 입력과 출력을 담당</td>
<td>마우스, 키보드, ...etc</td>
</tr>
</tbody></table>
<p><span style="color: green"><strong><code>운영체제 제어 범위</code></strong></span></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/9c2538e3-1c9b-4891-bda0-04a8089c24fc/image.png" alt=""></p>
<p><strong>2) 운영체제의 목적 및 성능 평가 항목</strong></p>
<table>
<thead>
<tr>
<th align="center">성능 평가 항목</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>처리 능력(Throughput)</strong></td>
<td>일정한 단위 시간 내에 처리할 수 있는 <strong>일의 양</strong></td>
</tr>
<tr>
<td align="center"><strong>반환 시간(Turn Around Time)</strong></td>
<td>하나의 작업을 시작한시간에서부터 결과를 얻을 때까지 <strong>걸린 시간</strong></td>
</tr>
<tr>
<td align="center"><strong>사용 가능도(Availability)</strong></td>
<td>시스템을 이용하려 할 때, <strong>얼마나 빨리</strong> 사용할 수 있는지의 정도</td>
</tr>
<tr>
<td align="center"><strong>신뢰도(Reliability)</strong></td>
<td>시스템이 주어진 문제를 <strong>정확하게</strong> 해결할 수 있는지의 정도</td>
</tr>
</tbody></table>
<p><strong>3) 운영체제 발달 과정</strong></p>
<blockquote>
<p><strong>1️⃣ 1950년대</strong></p>
</blockquote>
<ul>
<li><strong>일괄 처리 시스템</strong><ul>
<li>데이터를 모아두었다가 묶어서 한번에 처리한다.</li>
</ul>
</li>
<li><strong>버퍼링</strong><ul>
<li>입출력장치와 프로세서의 속도 차이를 보완하기 위해 다음 레코드를 주기억장치에 보관함으로써 CPU가 필요로 하는 레코드를 기다림 없이 전달해 줄 수 있다.</li>
<li>레코드를 저장하는 주기억장치를 <span style="color: green"><strong>버퍼</strong></span>라고 한다.</li>
</ul>
</li>
<li><strong>스풀링</strong><ul>
<li>주기억장치 대신 <strong>디스크를 매우 큰 버퍼처럼 사용</strong>한다.</li>
<li><strong>여러 작업의 입출력과 계산을 함께</strong> 할 수 있다는 장점이 있다.</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>2️⃣ 1960년대</strong></p>
</blockquote>
<ul>
<li><strong>다중 프로그래밍</strong><ul>
<li>여러 프로그램을 <strong>메모리에 나눠 적재한 후 번갈아 할당</strong>하며, <strong>여러 프로그램을 동시에 실행</strong>한다.</li>
</ul>
</li>
<li><strong>시분할 시스템</strong><ul>
<li>다중 프로그래밍 시스템을 확장하여 <strong>프로세서 스케줄링</strong>이라는 개념을 더한 시스템</li>
<li>여러 사용자에게 짧은 간격으로 <strong>프로세서를 번갈아가며 할당</strong>해 마치 독점하는 것처럼 사용할 수 있다.</li>
</ul>
</li>
<li><strong>다중 처리 시스템</strong><ul>
<li>하나의 시스템에서 <strong>여러 개의 프로세서를 사용</strong>하는 시스템</li>
</ul>
</li>
<li><strong>실시간 시스템</strong><ul>
<li>데이터가 발생하는 <strong>즉시 응답</strong>하는 시스템</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>3️⃣ 1970년대 초반</strong></p>
</blockquote>
<ul>
<li><strong>다중 모드</strong><ul>
<li>일괄, 시분할, 실시간, 다중 처리 등을 <strong>모두 제공</strong>하는 시스템</li>
<li>고가이며 사용에도 고도의 훈련이 필요하다.</li>
</ul>
</li>
<li><strong>범용 시스템</strong><ul>
<li>특별히 정해진 용도로만 사용되는 것이 아니다.</li>
<li>메모리에 적재되어 실행되는 프로그램에 따라 여러 가지 용도로 사용할 수 있는 시스템</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>3️⃣ 1970년대 중반 이후</strong></p>
</blockquote>
<ul>
<li><strong>분산 처리 시스템</strong><ul>
<li>독립적인 처리 능력을 가진 <strong>컴퓨터 시스템을 통신망으로 연결</strong>하여 네트워크 상에서 서로 통신하며 협력하여 처리하는 시스템</li>
</ul>
</li>
<li><strong>병렬 처리 시스템</strong><ul>
<li><strong>하나 이상의 연산을 동시에 수행</strong>하여 연산 속도를 증가시키는 시스템</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>4️⃣ 2000년대</strong></p>
</blockquote>
<ul>
<li><strong>임베디드</strong><ul>
<li>내장형 시스템, 기계나 기타 제어가 필요한 시스템에 대해 <strong>특정 기능을 수행</strong>하는 시스템</li>
<li>장치 내에 존재</li>
</ul>
</li>
<li><strong>가상화</strong><ul>
<li>물리적 하드웨어 등을 사용자로부터 은폐</li>
<li>대체품으로 논리적인 리소스를 제공하거나 하나의 물리적인 리소스를 여러 개로 보이게 하는 기술</li>
<li><span style="color: green"><strong>호스트 OS형</strong></span><ul>
<li>물리적 하드웨어 위에 OS를 설치하여 <strong>가상화 소프트웨어와 가상 머신</strong>을 이용하는 방식</li>
<li>ex) 기존 OS 위에 가상화 OS를 설치</li>
</ul>
</li>
<li><span style="color: green"><strong>하이퍼바이저형</strong></span><ul>
<li>HOST OS를 필요로 하지 않고, 직업 <strong>물리 하드웨어</strong>를 움직여 독립한 호스트와 같이 행동하는 방식</li>
<li>ex) 가상화를 위한 독립적 OS를 직접 설치</li>
</ul>
</li>
<li><span style="color: green"><strong>컨테이터형</strong></span><ul>
<li><strong>컨테이너</strong>라는 <strong>가상화 소프트웨어</strong>를 이용하여 사용하는 방식</li>
<li>ex) 미리 구축해 놓은 가상화 OS(컨테이너)를 설치</li>
</ul>
</li>
</ul>
</li>
<li><strong>클라우드 컴퓨팅</strong><ul>
<li>인터넷 기반으로 구동되는 컴퓨팅 기술</li>
<li>정보를 자신의 컴퓨터가 아닌 <strong>클라우드(인터넷)에 연결된 다른 컴퓨터</strong>로 처리하는 기술</li>
<li><span style="color: green"><strong>IaaS</strong> (Infrastructure as a Service)</span><ul>
<li>사용자가 관리할 수 있는 <strong>범위가 가장 넓은</strong> 클라우드 컴퓨팅</li>
<li>서버 OS, 미들웨어, 런타임, 데이터 등 직접 구성하고 관리할 수 있다.</li>
</ul>
</li>
<li><span style="color: green"><strong>PaaS</strong> (Platform as a Service)</span><ul>
<li><strong>미리 구축된 플랫폼</strong>을 이용하는 클라우드 컴퓨팅</li>
<li>관리상의 자유도가 낮지만 개발 자체에 집중할 수 있다.</li>
</ul>
</li>
<li><span style="color: green"><strong>SaaS</strong> (Software as a Service)</span><ul>
<li>소프트웨어 및 관련 데이터는 <strong>중앙 호스팅</strong></li>
<li>사용자는 제공해주는 <strong>소프트웨어</strong>를 서비스 받아 사용한다.</li>
</ul>
</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>❗️ 운영체제 발달 과정 순서 외우기</strong></p>
</blockquote>
<ul>
<li><strong>1950년대</strong> : <strong><code>일괄 처리</code></strong>, <strong><code>버퍼링</code></strong>, <strong><code>스풀링</code></strong></li>
<li><strong>1960년대</strong> : <strong><code>다중 프로그래밍</code></strong>, <strong><code>시분할 시스템</code></strong>, <strong><code>다중 처리 시스템</code></strong>, <strong><code>실시간 시스템</code></strong></li>
<li><strong>1970년대 초반</strong> : <strong><code>다중 모드</code></strong>, <strong><code>범용 시스템</code></strong></li>
<li><strong>1970년대 중반 이후</strong> : <strong><code>분산 처리 시스템</code></strong>, <strong><code>병렬 처리 시스템</code></strong></li>
<li><strong>2000년대</strong> : <strong><code>임베디드</code></strong>, <strong><code>가상화</code></strong>, <strong><code>클라우드 컴퓨팅</code></strong></li>
</ul>
<h3 id="2-운영체제-계열별-특징">2. 운영체제 계열별 특징</h3>
<p><strong>1) 윈도우 계열</strong> </p>
<ul>
<li>1995년도에 MS(Microsoft) 사에서 Windows 95를 발표한 이후 지속적으로 98, ME, XP, 7, ...등의 버전으로 출시되고 있다.</li>
</ul>
<p><span style="color:green"><strong><code>장점</code></strong></span></p>
<ul>
<li>사용자가 마우스의 아이콘으로 소프트웨어를 실행시키는 편리한 인터페이스를 지원한다.</li>
<li>MS사만이 수정 및 배포할 수 있으며, 고객 지원이 체계적이다.</li>
</ul>
<p><span style="color:red"><strong><code>단점</code></strong></span></p>
<ul>
<li>문제점(버그 등)이 발견되었을 시 수정에 시간이 걸린다.</li>
<li>문제 발생과 해결의 시간적인 차이를 이용하는 악성 해커들로 인해 유닉스 계열의 운영체제에 비하여 보안이 취약하다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">윈도우 특징 및 용어</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>선점형 멀티태스킹</strong></td>
<td>운영체제가 수행 중인 각 프로그램의 실행시간을 할당하고, 실행 중에 문제가 발생하면 해당 프로그램을 강제 종료시킨 후, 모든 시스템 자원을 반환하는 <strong>멀티태스킹 운영 방식</strong></td>
</tr>
<tr>
<td align="center"><strong>PNP(Plug&amp;Play)</strong></td>
<td>장치와 장치를 연결할 때, 별도의 사용자 조작이 필요 없이 <strong>자동으로 장치를 인식</strong>하여 사용 가능</td>
</tr>
<tr>
<td align="center"><strong>핫플러그</strong></td>
<td>시스템 전원이 켜져있는 상태에서 <strong>장치를 추가</strong>하는 것은 가능하나, 제거하는 것은 불가능</td>
</tr>
<tr>
<td align="center"><strong>핫스왑</strong></td>
<td>전원 켜져있는 상태로 <strong>장치의 교체 가능</strong></td>
</tr>
<tr>
<td align="center"><strong>가상화</strong></td>
<td>단일 호스트에서 <strong>서로 다른 운영체제</strong>를 구동할 수 있게 하는 기능</td>
</tr>
<tr>
<td align="center"><strong>하이퍼바이저</strong></td>
<td>단일 호스트에서 <strong>다른 운영체제를 가상으로 구동 지원하는 플랫폼</strong>, 대표적으로 VMWARE 사의 VMware, ORACLE 사의  Virtualbox 등</td>
</tr>
<tr>
<td align="center"><strong>FAT 파일 시스템</strong></td>
<td><strong>파일 할당 테이블(File Allocation Table)</strong>을 의미하며, 운영체제를 운용하는데 디스크 공간을 할당</td>
</tr>
<tr>
<td align="center"><strong>NTFS 파일 시스템</strong></td>
<td><strong>Windows가 현재 사용 중인 압축 파일 시스템</strong>으로 이전 버전의 FAT에 비해 신뢰성, 성능 등이 개선되어 디스크 공간을 효율적으로 사용 가능</td>
</tr>
<tr>
<td align="center"><strong>ReFS 파일 시스템</strong></td>
<td>MS에서 <strong>NTFS를 대체</strong>하기 위해 개발한 차세대 파일 시스템</td>
</tr>
</tbody></table>
<p><strong>2) 유닉스 계열</strong></p>
<ul>
<li>1960년대에 <code>AT&amp;T Bell 연구소</code>, <code>MIT</code>, <code>General Electric</code> 이 공동 연구로 개발한 운영체제</li>
<li><strong>멀티태스크 기능에 초점</strong>을 맞추었으며 초기 운영체제 <code>Multics</code>를 만들었다.</li>
<li><strong>C언어</strong>로 이식되어 대중화의 기반을 마련하였다.</li>
<li>1970년에 <code>AT&amp;T</code>가 본격적으로 유닉스 시스템을 판매하게 되었다.</li>
</ul>
<p><span style="color: green"><strong><code>유닉스의 구성</code></strong></span></p>
<table>
<thead>
<tr>
<th align="center">구성</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>커널(Kernel)</strong></td>
<td>‧ 운영체제의 핵심적인 구성요소 중 하나</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ <strong>프로세스 수행에 필요한 하드웨어의 성능 등을 조정</strong>할 수 있도록 이어주는 <strong>서비스를 제공</strong></td>
</tr>
<tr>
<td align="center"><strong>쉘(Shell)</strong></td>
<td>‧ 실행한 프로세스 등을 <strong>커널에게 전달</strong>할 수 있도록 번역해주는 <strong>명령 번역기</strong></td>
</tr>
<tr>
<td align="center"><strong>유틸리티(Utility)</strong></td>
<td>‧ 운영체제에서 제공하는 것이 아닌 그 외의 실행 가능한 프로그램</td>
</tr>
</tbody></table>
<p><span style="color: green"><strong><code>유닉스의 특징 및 용어</code></strong></span></p>
<table>
<thead>
<tr>
<th align="center">특징 및 용어</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>시분할 시스템</strong></td>
<td>‧ 사용자에게 컴퓨터의 <strong>자원을 시간에 따라 분할</strong>하는 시스템</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 사용자와 컴퓨터 간의 대화를 통해 작업을 처리하는 시스템</td>
</tr>
<tr>
<td align="center"><strong>UFS 파일 시스템</strong></td>
<td>‧ 유닉스 파일 시스템</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 유닉스 및 유닉스 기반의 운영체제 등에서 쓰이는 <strong>디스크 기반의 파일 시스템</strong></td>
</tr>
<tr>
<td align="center"><strong>아이노드(i-node)</strong></td>
<td>‧ 정규 파일, 디렉터리 등의 파일 시스템을 보유한 유닉스 시스템 및 유닉스 계열의 운영체제에서 사용하는 <strong>자료 구조 시스템</strong></td>
</tr>
<tr>
<td align="center"><strong>소프트 링크(심볼링 링크)</strong></td>
<td>‧ 유닉스 계열 운영체제에서 사용되는 기능</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ <strong><code>i-node</code>를 이용하여</strong> <code>Windows</code>의 바로가기와 동일하게 링크 파일 삭제시 <strong>원본을 유지시키는 링크 시스템</strong></td>
</tr>
<tr>
<td align="center"><strong>하드 링크</strong></td>
<td>‧ <strong>원본과 동기화</strong>된 바로가기 기능</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ <strong>링크 파일 삭제 시 원본 파일도 삭제</strong>되는 링크 시스템</td>
</tr>
</tbody></table>
<p><strong>3) 리눅스 계열</strong></p>
<ul>
<li><strong>유닉스의 호환 커널</strong></li>
<li>1991년에 Linus Tovalds는 <strong><code>자유 소프트웨어(Free Software)</code></strong> 정책 하에서 완전히 자유롭고 재배포가 가능한 운영체제 <strong>리눅스</strong>를 만들었다.</li>
</ul>
<blockquote>
<p>💡 <strong>자유 소프트웨어</strong>
금전적 무료가 아닌 원하는 대로의 실행, 무료나 유료로 복제물 재배포, 필요에 따른 개작 등 <strong>포괄적인 자유</strong>를 부여하는 것</p>
</blockquote>
<ul>
<li>수천 명 이상의 개발자들이 코드를 보고 업데이트를 하고 있으므로, 버그 발생 시 다수의 개발자가 수정에 참여하여 빠른 업데이트가 가능하다.</li>
<li><code>Windows</code>와 같은 체계적인 지원이 상대적으로 부족하여 일반인들보다는 전문가들이 사용하고 있다.</li>
</ul>
<p><span style="color: green"><strong><code>리눅스 VS 유닉스</code></strong></span></p>
<table>
<thead>
<tr>
<th align="center">분류</th>
<th>리눅스</th>
<th>유닉스</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>비용</strong></td>
<td>‧ 대부분 무료</td>
<td>‧ 대부분 유료</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 지원 정책에 따라 일부 유료 서비스 품도 있음</td>
<td></td>
</tr>
<tr>
<td align="center"><strong>주 사용자</strong></td>
<td>‧ 개발자, 일반 사용자</td>
<td>‧ 메인프레임, 워크스테이션 등 대형 시스템 관리자</td>
</tr>
<tr>
<td align="center"><strong>개발사</strong></td>
<td>‧ 커뮤니티</td>
<td>‧ IBM, HP 등</td>
</tr>
<tr>
<td align="center"><strong>개발 배포</strong></td>
<td>‧ 오픈 소스 개발</td>
<td>‧ 대부분 사업자에 의해 배포</td>
</tr>
<tr>
<td align="center"><strong>사용량</strong></td>
<td>‧ 모바일폰, 태블릿 등 다양하게 사용</td>
<td>‧ 인터넷 서버, 워크스테이션 등 대형 서비스에 주로 사용</td>
</tr>
<tr>
<td align="center"><strong>사용자 편의</strong></td>
<td>‧ GUI 제공, 파일 시스템 지원</td>
<td>‧ 커멘드 기반이 주였으나 GUI도 제공하는 추세</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ Bash shell 사용</td>
<td>‧ 기본은 Bourne Shell, 현재는 다른 많은 Shell과 호환 가능</td>
</tr>
</tbody></table>
<p><strong>4) 매킨토시 운영체제(<code>Macintoh OS X</code>)</strong></p>
<ul>
<li><strong>유닉스 기반</strong>으로 만들어져 애플사의 제품군</li>
<li><strong>그래픽 기반 운영체제</strong></li>
<li>프로그램을 카피하고 삭제함으로써 <code>install</code>과 <code>uninstall</code>의 과정을 단훈화하였다.</li>
<li>드라이버 설치를 <code>OS</code>의 확장 폴더에 넣고 재부팅을 하면 인식되어 간단하다.</li>
</ul>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 다음 운영체제의 목적을 나타내는 표에서 빈칸을 완성하시오.</strong></p>
<table>
<thead>
<tr>
<th>운영체제의 목적</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>(  ⓵  )</strong></td>
<td>일정한 단위 시간 내에 처리할 수 있는 일의 양</td>
</tr>
<tr>
<td><strong>반환 시간(Turn Around Time)</strong></td>
<td>하나의 작업을 시작한 시간에서부터 결과를 얻을 때까지 걸린 시간</td>
</tr>
<tr>
<td><strong>사용 가능도(Availability)</strong></td>
<td>시스템을 이용하려 할 때 얼마나 빨리 사용할 수 있는지의 정도</td>
</tr>
<tr>
<td><strong>(  ⓶  )</strong></td>
<td>시스템이 주어진 문제를 정확하게 해결할 수 있는지의 정도</td>
</tr>
</tbody></table>
<ul>
<li>답<ul>
<li><span style="color:blue"><strong>⓵ 처리 능력(Throughput)</strong></span></li>
<li><span style="color:blue"><strong>⓶ 신뢰도(Reliability)</strong></span></li>
</ul>
</li>
</ul>
<p><strong>2) 다음 보기에서 설명하는 운영체제의 이름을 작성하시오.</strong></p>
<blockquote>
</blockquote>
<p>지원 정책에 따라 일부 유료 서비스 제품도 있지만 대부분 무료이며 모바일폰, 태블릿 등 다양한 용도로 사용이 가능하다.</p>
<ul>
<li>답 : <span style="color:blue"><strong>리눅스(Linux)</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-2--운영체제-기본-명령어-활용">🍀 Section 2 | 운영체제 기본 명령어 활용</h2>
<h3 id="1-운영체제-기본-명령어">1. 운영체제 기본 명령어</h3>
<ul>
<li>운영체제를 제어햐기 위한 방법에는 <code>CLI</code>와 <code>GUI</code>가 있다.</li>
</ul>
<blockquote>
<p>💡 <strong><code>CLI</code></strong></p>
</blockquote>
<ul>
<li><strong>C</strong>ommand <strong>L</strong>ine <strong>I</strong>nterface</li>
<li>사용자가 직접 명령어를 입력하여 컴퓨터에게 명령을 내리는 방식</li>
</ul>
<blockquote>
<p>💡 <strong><code>GUI</code></strong></p>
</blockquote>
<ul>
<li><p><strong>G</strong>raphic <strong>U</strong>ser <strong>I</strong>nterface</p>
</li>
<li><p>마우스로 화면을 클릭하여 컴퓨터를 제어하는 방식</p>
</li>
<li><p>초기에는 <code>CLI</code> 기반의 운영체제를 많이 사용했으나, 마우스 기반의 제어 시스템인 <code>GUI</code>가 개발되면서 <code>CLI</code>의 사용 빈도가 줄었다.</p>
</li>
<li><p>현재는 오픈소스 기반의 개발 환경이 급격히 늘어나 <strong>Github</strong> 등과 같은 플랫폼 사용이 증가하여 <code>CLI</code>의 중요성이 다시 높아지고 있다.</p>
</li>
</ul>
<blockquote>
<p>💡 <strong>Github</strong></p>
</blockquote>
<ul>
<li>분산 버전 관리 툴인 <code>Git</code>을 사용하는 <strong>웹 호스팅 서비스</strong></li>
</ul>
<h3 id="2-cli-기본-명령어">2. <code>CLI</code> 기본 명령어</h3>
<p><strong>1) Windows</strong></p>
<ul>
<li><code>Command</code> 창에 <code>CLI</code> 명령어를 입력할 수 있다.</li>
<li>프로그램 및 파일 검색에 <code>CMD</code>를 입력하거나, 명령 프롬프트를 실행하면 <code>Command</code> 창이 열린다.</li>
</ul>
<p><strong>2) Linux/Unix 계열</strong></p>
<ul>
<li><code>Shell</code>에서 <code>CLI</code> 명령어를 입력할 수 있다.</li>
<li><code>Shell</code>이란 컴퓨터 내부를 관리하는 <strong>커널</strong>과 <strong>사용자</strong> 사이를 <strong>연결하는 창</strong>이다.</li>
</ul>
<blockquote>
<p>💡 <strong>Shell의 주요 기능</strong></p>
</blockquote>
<ul>
<li>세션별 변수를 설정, 운영체제를 사용자가 원하는 상태로 설정하도록 지원</li>
<li>사용자 요청에기반한 명령열 작성</li>
<li>백그라운드 처리, 서브 쉘 설정</li>
<li>일련의 명령어를 묶어 처리하는 스크립트 기능 지원</li>
</ul>
<p>라고 책에서 말하긴 하는데, 정확한 내용은 다음과 같다.</p>
<blockquote>
<p><strong>1. Windows와 Linux/Unix 는 둘 다 Command 창을 사용한다.</strong></p>
</blockquote>
<ul>
<li><code>CLI</code> 명령어를 입력할 수 있는 창을 <strong>Command 창</strong>이라고 하고,</li>
<li>사용자가 입력한 <code>CLI</code> 명령어를 커널이 이해할 수 있게 해석해주는 <code>Shell</code>이라는 소프트웨어인 것이다.</li>
<li>다만, <code>Windows</code>와 <code>Linux/Unix</code> 이 기본적으로 제공하는 <code>Shell</code> 프로그램이 다르고, 이에 따라 <strong>Command 창(=터미널 프로그램)이 다를 수 있다.</strong></li>
<li>운영체제 별로 기본적으로 제공하는 <code>Shell</code> 프로그램과 <code>Command</code> 창은 아래와 같다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">운영체제</th>
<th><code>Shell</code> 프로그램</th>
<th>Command 창 프로그램</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>Windows</strong></td>
<td><code>cmd.exe</code>, <code>PowerShell</code></td>
<td><code>Command Prompt</code>, <code>Windows Terminal</code></td>
</tr>
<tr>
<td align="center"><strong>Linux/Unix</strong></td>
<td><code>bash</code>, <code>zsh</code>, <code>sh</code></td>
<td><code>Terminal</code></td>
</tr>
</tbody></table>
<p>위에서 <strong>다를 수 있다</strong> 라고 설명한 이유는, <strong><code>Windows</code></strong> 환경에서도 외부 프로그램 설치하면 <code>bash</code>를 사용할 수 있기 때문이다.
그리고 <strong>Shell의 주요 기능</strong>도 운영체제별로 기능의 <strong>깊이(depth)</strong>가 다른거지, <code>Linux/Unix</code> 계열만 <strong>Shell의 주요 기능</strong>을 사용할 수 있다는 뜻은 아니다.</p>
<blockquote>
<p><strong>2. 그럼 왜 책에서 이렇게 설명했을까?</strong></p>
</blockquote>
<ul>
<li>관습적으로 <code>Windows</code>는 <code>Command Prompt</code>라는 표현을 많이 사용했고, <code>Linux/Unix</code> 계열은 <code>Shell</code>이라는 표현을 많이 사용했기 때문이다.</li>
<li>교재가 <strong>시험 스타일에 맞춰 단순화</strong>된거라고 생각하고 공부하도록 하자.</li>
</ul>
<p><strong>3) 리눅스 디렉터리 구조</strong></p>
<ul>
<li><strong>윈도우의 폴더</strong>와 같은 개념</li>
<li>기본적으로 <strong>윈도우</strong>에서는 <code>₩</code> 또는 <code>\</code>를 사용하고, <strong>리눅스</strong>에서는 <code>/</code>를 사용한다.</li>
<li>최상위 디렉터리 = <code>/</code></li>
<li><strong><code>root</code></strong><ul>
<li>최상위 디렉터리 바로 아래에 위치</li>
<li><code>root</code> 계정의 홈 디렉터리</li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/32371142-e1ee-40a0-b9b3-20a0374d6561/image.png" alt=""></p>
<p><strong>4) CLI 대표 명령어</strong></p>
<table>
<thead>
<tr>
<th align="center">기능</th>
<th align="center">Windows/MS-DOS</th>
<th align="center">Linux</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>경로 변경</strong></td>
<td align="center">cd</td>
<td align="center">cd</td>
</tr>
<tr>
<td align="center"><strong>목록 출력</strong></td>
<td align="center">dir</td>
<td align="center">ls</td>
</tr>
<tr>
<td align="center"><strong>파일 복사</strong></td>
<td align="center">copy</td>
<td align="center">cp</td>
</tr>
<tr>
<td align="center"><strong>구조 복사</strong></td>
<td align="center">xcopy</td>
<td align="center">cp</td>
</tr>
<tr>
<td align="center"><strong>디렉터리 생성</strong></td>
<td align="center">mkdir</td>
<td align="center">mkdir</td>
</tr>
<tr>
<td align="center"><strong>하위 파일 삭제</strong></td>
<td align="center">del</td>
<td align="center">rm</td>
</tr>
<tr>
<td align="center"><strong>권한 설정</strong></td>
<td align="center">attrib</td>
<td align="center">chmod</td>
</tr>
<tr>
<td align="center"><strong>화면 표시</strong></td>
<td align="center">type</td>
<td align="center">cat</td>
</tr>
<tr>
<td align="center"><strong>목적지까지 경로</strong></td>
<td align="center">tracert</td>
<td align="center">traceroute</td>
</tr>
<tr>
<td align="center"><strong>프로세스 종료</strong></td>
<td align="center"></td>
<td align="center">kill</td>
</tr>
<tr>
<td align="center"><strong>실행 중 프로세스 표시</strong></td>
<td align="center"></td>
<td align="center">ps</td>
</tr>
<tr>
<td align="center"><strong>디렉터리 경로 표시</strong></td>
<td align="center"></td>
<td align="center">pwd</td>
</tr>
<tr>
<td align="center"><strong>네트워크 상태 점검</strong></td>
<td align="center"></td>
<td align="center">ping</td>
</tr>
<tr>
<td align="center"><strong>접속해 있는 사용자 표시</strong></td>
<td align="center"></td>
<td align="center">who</td>
</tr>
</tbody></table>
<h3 id="3-gui-기본-명령어">3. GUI 기본 명령어</h3>
<ul>
<li>윈도우 내에서 파일을 이동하고 프로그램을 실행하는 것 등 모든 것이 GUI 명령어에 해당한다.</li>
<li>리눅스의 GUI는 윈도우와 같이 기본 설정이 아닌 경우가 많아 버전별로 별도의 설치 방법에 따라 GUI 환경을 설치해야한다.</li>
</ul>
<blockquote>
<p>💡<strong>윈도우 단축키</strong>
<img src="https://velog.velcdn.com/images/xaexun_/post/8f9af944-72a8-4062-86f3-de2819fba2d9/image.png" alt=""></p>
</blockquote>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 윈도우 10에서 윈도우 설정을 실행하는 단축키를 작성하시오.</strong></p>
<ul>
<li>답 : <span style="color:blue"><strong>윈도우 + <code>i</code></strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-3--운영체제-핵심-기능-파악">🍀 Section 3 | 운영체제 핵심 기능 파악</h2>
<h3 id="1-운영체제-핵심-기능">1. 운영체제 핵심 기능</h3>
<ul>
<li><strong>운영체제</strong>는 <code>중앙처리장치</code>, <code>메모리</code>, <code>스토리지</code>, <code>주변 기기</code> 등을 적절히 관리한다.</li>
<li>특히 <code>주기억장치</code>와 <code>메모리</code>, <code>메모리</code>와 <code>스토리지</code> 사이의 <strong>속도차</strong>로 인해 여러 가지 관리 기법들이 개발되었다.</li>
<li>초기<ul>
<li><strong>메모리 용량 제한</strong>이 많음 → 소프트웨어 개발 시 <strong>메모리 관리</strong>가 매우 중요</li>
</ul>
</li>
<li>최근<ul>
<li><strong>운영체제</strong>에서 대부분 <strong>자동</strong>으로 관리</li>
<li>개발 및 시스템 환경이 <strong>클라우드화</strong> → <strong>자원 관리</strong>에 필요한 노력 <strong><code>↓</code></strong></li>
</ul>
</li>
</ul>
<p><strong>1) 메모리 관리</strong></p>
<ul>
<li>프로그램의 <strong>실행이 종료될 때까지 메모리를 가용한 상태</strong>로 유지 및 관리하는 것</li>
<li>메모리 안에는 다수의 프로그램들이 실행된다.</li>
<li>프로그램 실행 중 메모리가 포화상태가 되면,<ul>
<li>시스템 속도 저하</li>
<li>시스템 중단 현상</li>
</ul>
</li>
<li>메모리에 있는 프로그램은 CPU로 이동하여 처리된다.</li>
</ul>
<p><strong>2) 프로세스 관리</strong></p>
<blockquote>
<p>💡 <strong>Program</strong></p>
</blockquote>
<ul>
<li>컴퓨터에게 특정 작업(기능)을 수행하도록 지시하는 <strong>명령어들의 집합(코딩 결과물)</strong></li>
<li>파일 형태로 저장하여 관리하다가 실행시키면 동작을 하게 된다.</li>
</ul>
<blockquote>
<p>💡 <strong>Process</strong></p>
</blockquote>
<ul>
<li><strong>실행 중인 프로그램</strong></li>
<li>작업(Job) 또는 과제(Task)라고도 한다.</li>
</ul>
<blockquote>
<p>💡 <strong>Process 관리 기법</strong></p>
</blockquote>
<ul>
<li>일시 중지 및 재실행</li>
<li>동기화</li>
<li>통신</li>
<li>교착상태 처리</li>
<li>프로세스 생성 삭제 등</li>
</ul>
<p><span style="color:blue">2-1) 프로세스 상태</span></p>
<ul>
<li><strong>생성(Create) :</strong> 사용자에 의해 프로세스가 생성된 상태</li>
<li><strong>준비(Ready) :</strong> 프로세스가 준비 큐에서 실행을 준비하고 있는 상태</li>
<li><strong>실행(Running) :</strong> 준비 큐에 있는 프로세스가 CPU를 할당받아 실행</li>
<li><strong>대기(Waiting) :</strong> 프로세스 수행 중, 입/출력을 위해 대기 상태로 전이</li>
<li><strong>종료(Terminated) :</strong> 프로세스가 CPU를 할당받아 수행을 종료한 상태</li>
</ul>
<p><span style="color:blue">2-2) 프로세스 상태 전이</span></p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/866add5b-590e-4d89-9858-2431deff9ffa/image.png" alt=""></p>
<table>
<thead>
<tr>
<th>프로세스 상태</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>디스패치(Dispatch Process)</strong></td>
<td>‧ <strong>Ready → Running</strong></td>
</tr>
<tr>
<td></td>
<td>‧ 준비 상태에서 실행 상태로 바뀌는 것</td>
</tr>
<tr>
<td><strong>보류(Block Process)</strong></td>
<td>‧ <strong>Running → Blocked</strong></td>
</tr>
<tr>
<td></td>
<td>‧ 프로세스 실행 중 시간이 다 되기도 전에 입출력 동작을 해야할 경우, 프로세스가 CPU를 반납하고 보류 상태로 들어가는 것</td>
</tr>
<tr>
<td><strong>깨움(Wakeup Process)</strong></td>
<td>‧ <strong>Blocked → Ready</strong></td>
</tr>
<tr>
<td></td>
<td>‧ 보류 상태 이후 다시 준비 상태로 넘어가는 것</td>
</tr>
<tr>
<td><strong>시간 초과(Timeout Process)</strong></td>
<td>‧ <strong>running → Ready</strong></td>
</tr>
<tr>
<td></td>
<td>‧ 클락 인터럽트를 통해 프로세스가 일정 시간만 점유할 수 있게 하는 것</td>
</tr>
</tbody></table>
<p><span style="color:blue">2-3) 프로세스 스케줄링</span></p>
<ul>
<li>프로세스를 효율적으로 실행될 수 있도록 여러 자원들 사이의 <strong>우선순위를 관리하는 작업</strong></li>
</ul>
<blockquote>
<p>💡 <strong>선점형</strong></p>
</blockquote>
<ul>
<li>이미 할당되어 실행 중인 프로세스라도 강제로 빼앗아 선택하여 사용할 수 <strong>있다.</strong></li>
</ul>
<table>
<thead>
<tr>
<th>선점형 스케줄링</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>RR(Round Robin)</strong></td>
<td>‧ <strong>시간 순서 단위</strong>로 CPU를 할당하는 방식</td>
</tr>
<tr>
<td></td>
<td>‧ <strong>자원 사용에 제한된 시간</strong>이 있고 할당된 시간이 지나면 자원 반납</td>
</tr>
<tr>
<td><strong>SRT(Shortest Remaining Time)</strong></td>
<td>‧ SJF 기법의 장점을 최대화</td>
</tr>
<tr>
<td></td>
<td>‧ <strong>실행시간이 가장 짧은 시간을 우선적</strong>으로 처리</td>
</tr>
<tr>
<td><strong>다단계 큐</strong></td>
<td>‧ 프로세스를 그룹으로 분류할 수 있을 경우 <strong>그룹에 따라 각기 다른 준비 상태의 큐</strong>를 사용하는 기법</td>
</tr>
<tr>
<td><strong>다단계 피드백 큐</strong></td>
<td>‧ 다단계 큐 보완</td>
</tr>
<tr>
<td></td>
<td>‧ 프로세스 큐들 간의 이동이 허용될 수 있도록 개선한 기법</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>비선점형</strong></p>
</blockquote>
<ul>
<li>이미 실행 중인 프로세스를 강제로 빼앗아 사용할 수 <strong>없다.</strong></li>
</ul>
<table>
<thead>
<tr>
<th>비선점형 스케줄링</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>FIFO - FCFS</strong></td>
<td>‧ <strong>선입선출</strong> 방식</td>
</tr>
<tr>
<td></td>
<td>‧ 우선순위의 상관없이 <strong>먼저 도착한 프로세스</strong>부터 처리</td>
</tr>
<tr>
<td><strong>SJF(Shortest Job First)</strong></td>
<td>‧ CPU 점유 시간이 <strong>가장 짧은 프로세스</strong>를 먼저 할당 및 처리</td>
</tr>
<tr>
<td><strong>HRN</strong></td>
<td>‧ SJF 기법을 보완하여 대기시간과 실행시간을 이용하여 처리</td>
</tr>
<tr>
<td></td>
<td>‧ <strong>(대기시간 + 실행시간) / 실행시간</strong></td>
</tr>
<tr>
<td><strong>우선순위</strong></td>
<td>‧ 준비 상테의 프로세스마다 <strong>우선순위</strong>를 부여</td>
</tr>
<tr>
<td></td>
<td>‧ <strong>우선순위가 가장 높은 프로세스</strong>부터 할당하는 기법</td>
</tr>
</tbody></table>
<h3 id="2-가상화-및-클라우드">2. 가상화 및 클라우드</h3>
<p><strong>1) 가상화</strong></p>
<p><span style="color:blue">1-1) 가상화의 개념</span></p>
<ul>
<li><strong>물리적인 리소스들</strong>을 사용자에게 <strong>하나</strong>로 보이게 하거나, 반대로 <strong>하나의 물리적인 리소스</strong>를 <strong>여러 개</strong>로 보이게 하는 것</li>
<li>대부분의 서버는 용량의 20% 정도만 사용<ul>
<li><strong>가상화는 서버의 가동률을 60% ~ 70% 이상</strong>으로 올릴 수 있다.</li>
</ul>
</li>
</ul>
<p><span style="color:blue">1-2) 가상화의 종류</span></p>
<blockquote>
<p>💡 <strong>플랫폼 가상화</strong></p>
</blockquote>
<ul>
<li>하드웨어 플랫폼 위해서 실행되는 호스트 프로그램이 게스트 프로그램을 만들어 <strong>마치 독립된 환경</strong>을 만들어 낸 것처럼 보여주는 것</li>
</ul>
<blockquote>
<p>💡 <strong>리소스 가상화</strong></p>
</blockquote>
<ul>
<li>메모리, 저장 장치, 네트워크 등을 결합하거나 나누는 것</li>
<li>사용자는 가상화된 물리적 장치들이 어떤 위치에 있는지 모르는 경우가 많다.</li>
<li>사용자는 실제 물리 위치를 신경쓰지 않아도 된다.</li>
</ul>
<p><strong>2) 클라우드</strong></p>
<p><span style="color:blue">2-1) 클라우드의 개념</span></p>
<ul>
<li><strong>인터넷 기반</strong>에서 구동되는 컴퓨팅 기술</li>
<li><strong>클라우드 컴퓨팅을 이용하면</strong> <ul>
<li>응용 프로그램을 필요에 따라 불러서 사용할 수 있다.</li>
<li>데이터를 손쉽게 저장 및 추출할 수 있다.</li>
</ul>
</li>
</ul>
<p><span style="color:blue">2-2) 클라우드 서비스의 종류</span></p>
<table>
<thead>
<tr>
<th>클라우드 서비스</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong><code>IaaS</code></strong></td>
<td>‧ <strong><code>I</code></strong><code>nfrastructure</code> <strong><code>a</code></strong><code>s</code> <strong><code>a</code></strong> <strong><code>S</code></strong><code>ervice</code> 인프라형</td>
</tr>
<tr>
<td></td>
<td>‧ 사용자가 관리할 수 있는 범위가 가장 넓은 클라우드 서비스</td>
</tr>
<tr>
<td></td>
<td>‧ 웹 상에서 구글, MS, 아마존 등에서 제공하는 환경의 다양한 <strong>인프라를 임대</strong>하여 이용할 수 있는 서비스</td>
</tr>
<tr>
<td></td>
<td>‧ 네트워크, 보안, 데이터 저장소, 콘텐츠 딜리버리 서비스 등등</td>
</tr>
<tr>
<td><strong><code>PaaS</code></strong></td>
<td>‧ <strong><code>P</code></strong><code>latform</code> <strong><code>a</code></strong><code>s</code> <strong><code>a</code></strong> <strong><code>S</code></strong><code>ervice</code> 플랫폼형</td>
</tr>
<tr>
<td></td>
<td>‧ <strong>운영체제가 이미 구성되어 있는 상태</strong>에서 사용자가 데이터와 앱만 직접 관리할 수 있는 서비스</td>
</tr>
<tr>
<td></td>
<td>‧ 미리 구축된 플랫폼을 이용하여 관리상의 자유도가 낮다는 단점</td>
</tr>
<tr>
<td></td>
<td>‧ 개발 자체에 집중할 수 있다는 장점</td>
</tr>
<tr>
<td><strong><code>SaaS</code></strong></td>
<td>‧ <strong><code>S</code></strong><code>oftware</code> <strong><code>a</code></strong><code>s</code> <strong><code>a</code></strong> <strong><code>S</code></strong><code>ervice</code> 서비스형</td>
</tr>
<tr>
<td></td>
<td>‧ 인프라와 운영체제뿐만 아니라 사용할 수 있는 소프트웨어까지 갖추어져있는 서비스</td>
</tr>
<tr>
<td></td>
<td>‧ 웹상의 로그인만으로 다양한 소프트웨어를 사용한 만큼 비용을 지불해가며 사용할 수 있다</td>
</tr>
</tbody></table>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 다음 보기 중 선점형 스케줄링 방식을 모두 골라 쓰시오</strong></p>
<blockquote>
</blockquote>
<ul>
<li><p>RR(Round Robin)</p>
</li>
<li><p>FIFO</p>
</li>
<li><p>SJF</p>
</li>
<li><p>HRN</p>
</li>
<li><p>SRT</p>
</li>
<li><p>다단계 큐</p>
</li>
<li><p>우선순위</p>
</li>
<li><p>답 : <span style="color:blue"><strong>RR(Round Robin), SRT, 다단계 큐</strong></span></p>
</li>
</ul>
<p><strong>2) 프로세스의 상태 전이 중 준비 상태에서 있던 프로세스가 실행 상태로 바뀌는 것을 무엇이라고 하는지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color:blue"><strong>디스패치(Dispatch Process)</strong></span></li>
</ul>
<h2 id="출처">출처</h2>
<ul>
<li>윈도우 단축키 이미지 : <a href="https://velog.io/@fulldev_hong/%EC%A0%95%EB%B3%B4%EC%B2%98%EB%A6%AC%EA%B8%B0%EB%8A%A5%EC%82%AC-%EC%8B%A4%EA%B8%B0-Part-3-Chapter-1.-%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C">정보처리기능사 실기 Part 3 - Chapter 1. 운영체제</a></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[2. 애플리케이션 테스트 수행 : 애플리케이션 결함 조치]]></title>
            <link>https://velog.io/@xaexun_/2.-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EC%88%98%ED%96%89-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%EA%B2%B0%ED%95%A8-%EC%A1%B0%EC%B9%98</link>
            <guid>https://velog.io/@xaexun_/2.-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EC%88%98%ED%96%89-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%EA%B2%B0%ED%95%A8-%EC%A1%B0%EC%B9%98</guid>
            <pubDate>Wed, 11 Feb 2026 10:30:38 GMT</pubDate>
            <description><![CDATA[<h1 id="📍-chapter-2--애플리케이션-결함-조치">📍 Chapter 2 : 애플리케이션 결함 조치</h1>
<hr>
<h2 id="🍀-section-1--결함-관리">🍀 Section 1 | 결함 관리</h2>
<h3 id="1-결함의-정의">1. 결함의 정의</h3>
<ul>
<li>프로그램과 명세서 간의 차이, 업무 내용의 <strong>불일치</strong></li>
<li><strong>기대 결과</strong>와 <strong>실제 관찰</strong> 결과 간의 <strong>차이</strong></li>
</ul>
<h3 id="2-결함-관리-프로세스">2. 결함 관리 프로세스</h3>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/2990bf1e-3d0a-4901-8367-917bd18c6880/image.png" alt=""></p>
<table>
<thead>
<tr>
<th align="center">프로세스</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>⓵ 결함 관리 계획</strong></td>
<td align="center">전체 프로세스에서 결함 관리에 대한 일정, 인력, 업무 프로세스를 확보하여 계획을 수립한다.</td>
</tr>
<tr>
<td align="center"><strong>⓶ 결함 기록</strong></td>
<td align="center">테스터는 발견된 결함에 대한 정보를 결함 관리 DB에 기록한다.</td>
</tr>
<tr>
<td align="center"><strong>⓷ 결함 검토</strong></td>
<td align="center">등록된 결함에 있어서 주요 내용을 검토하고, 결함을 수정할 개발자에게 전달한다.</td>
</tr>
<tr>
<td align="center"><strong>⓸ 결함 수정</strong></td>
<td align="center">개발자는 할당된 결함의 프로그램을 수정한다.</td>
</tr>
<tr>
<td align="center"><strong>⓹ 결함 재확인</strong></td>
<td align="center">테스터는 개발자가 수정한 내용을 확인하고 다시 테스트를 수행한다.</td>
</tr>
<tr>
<td align="center"><strong>⓺ 결함 상태 추적 및 모니터링 활동</strong></td>
<td align="center">결함 관리 팀장은 결함 관리 DB를 이용하여 대시보드 또는 게시판 형태의 서비스를 제공한다.</td>
</tr>
<tr>
<td align="center"><strong>⓻ 최종 결함 분석 및 보고서 작성</strong></td>
<td align="center">발견된 결함에 대한 내용과 이해관계자들의 의견이 반영된 보고서를 작성하고 결함 관리를 종료한다.</td>
</tr>
</tbody></table>
<h3 id="3-결함의-상태-및-추적">3. 결함의 상태 및 추적</h3>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/ccf3bc5b-eee7-4a24-811d-79def4beb22a/image.png" alt=""></p>
<blockquote>
<p>❗️ <strong>영어도 같이 외우도록 하자잇</strong></p>
</blockquote>
<table>
<thead>
<tr>
<th>상태 및 추적</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>⓵ 결함 등록(Open)</strong></td>
<td>테스터와 품질 관리(QA) 담당자에 의해 결함이 처음 발견되어 등록되었지만, 아직 분석이 되지 않은 상태</td>
</tr>
<tr>
<td><strong>⓶ 결함 검토(Reviewed)</strong></td>
<td>등록된 결함을 담당 모듈 개발자, 테스터, 프로그램 리더, 품질 관리(QA) 담당자와 검토하는 상태</td>
</tr>
<tr>
<td><strong>⓷ 결함 할당(Assigned)</strong></td>
<td>결함의 영향 분석 및 수정을 위해 개발자와 문제 해결 담당자에게 할당된 상태</td>
</tr>
<tr>
<td><strong>⓸ 결함 수정(Resolved)</strong></td>
<td>개발자에 의해 결함이 수정 완료된 상태</td>
</tr>
<tr>
<td><strong>⓹ 결함 조치 보류(Deferred)</strong></td>
<td>수정이 필요한 결함이지만 현재 수정이 불가능해서 연기된 상태. 우선순위, 일정 등을 고려하여 재오픈을 준비하는 상태</td>
</tr>
<tr>
<td><strong>⓺ 결함 종료(Closed)</strong></td>
<td>발견된 결함이 해결되고 테스터와 품질 관리(QA) 담당자에 의해 종료 승인을 한 상태</td>
</tr>
<tr>
<td><strong>⓻ 결함 해제(Clarified)</strong></td>
<td>테스터, 프로그램 리더, 품질 관리(QA) 담당자가 결함을 검토한 결과, 결함이 아니라고 판명된 경우</td>
</tr>
</tbody></table>
<h3 id="4-결함-분류">4. 결함 분류</h3>
<ul>
<li><strong>결함을 분석하는 단계</strong>에서 아래와 같은 유형으로 나누어야 한다.</li>
<li><strong>시스템 결함</strong>, <strong>기능 결함</strong>, <strong>GUI 결함</strong>, <strong>문서 결함</strong> 등 크게 4가지의 유형으로 분류 된다.</li>
</ul>
<p><strong>1) 시스템 결함</strong></p>
<ul>
<li><strong>애플리케이션 환경과 DB 처리</strong>에서 발생하는 결함을 말한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">결함 형태</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>비정상적인 종료 및 중단</strong></td>
<td>특정 기능 실행 시 응용 프로그램의 작동 정지, 종료, 시스템 다운이 되는 경우</td>
</tr>
<tr>
<td align="center"><strong>응답 시간 지연</strong></td>
<td>응용 프로그램 작동 후 조회 또는 보고서 출력 시 <strong>지연</strong>되는 경우와 <strong>메모리 부족</strong>, 하드웨어와 소프트웨어의 <strong>비일관성</strong>으로 발생되는 경우</td>
</tr>
<tr>
<td align="center"><strong>DB 에러</strong></td>
<td>응용 프로그램 작동 후 사용자 데이터의 <strong>등록</strong>, <strong>수정</strong>, <strong>삭제</strong>, <strong>조회</strong>가 정상적으로 작동하지 않는 경우</td>
</tr>
</tbody></table>
<p><strong>2) 기능 결함</strong></p>
<ul>
<li><strong>기획, 설계, 업무 시나리오 단계</strong>에서 발생된 결함을 말한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">결함 형태</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>요구사항 미반영/불일치</strong></td>
<td>요구사항에 명시된 기능이 응용 프로그램에 구현되지 않은 경우와 <strong>다르게 구현</strong>되어 작동하는 경우</td>
</tr>
<tr>
<td align="center"><strong>부정확한 비즈니스 프로세스</strong></td>
<td>기능 자체는 수행되나 내부 프로세스 로직의 문제로 부정확한 결과를 내는 경우</td>
</tr>
<tr>
<td align="center"><strong>스크립트 에러</strong></td>
<td>특정 기능 실행 시 웹 브라우저에서 스크립트 오류가 발생하는 경우</td>
</tr>
<tr>
<td align="center"><strong>타 시스템 연동 시 오류</strong></td>
<td>기존 시스템과의 연동을 통해 데이터를 주고받는 과정에서 오류가 발생하는 경우</td>
</tr>
</tbody></table>
<p><strong>3) GUI(Graphical User Interface) 결함</strong></p>
<ul>
<li><strong>사용자 화면 설계</strong>에서 발생된 결함을 말한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">결함 형태</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>응용 프로그램의 UI 비일관성</strong></td>
<td>프로젝트에서 정의한 UI 표준과 상이하게 구현된 경우</td>
</tr>
<tr>
<td align="center"><strong>부정확한 커서/메시지</strong></td>
<td>커서의 위치가 입력 대상의 첫 번째 필드에 위치해 있지 않거나, 탭 시퀀스가 순차적으로 동작하지 않는 경우. 각 기능에서 제공하는 메시지 내용이 부정확한 내용을 보여주는 경우.</td>
</tr>
<tr>
<td align="center"><strong>데이터 타입의 표시 오류</strong></td>
<td>입력 필드에 지정된 형식과 다르게 입력해도 저장이 되는 경우와 입력 필드에 유효하지 않은 데이터(Invalid Data)를 입력했을 때 오류가 나는 경우</td>
</tr>
</tbody></table>
<p><strong>4) 문서 결함</strong></p>
<ul>
<li>기획자, 사용자, 개발자 간의 <strong>의사소통과 기록</strong>이 원활하지 않은 경우에 발생하는 결함을 말한다.</li>
<li>사용자의 온라인/오프라인 메뉴얼의 불일치, 요구사항 분석서와 기능 요구사항의 불일치로 인한 <strong>불완전한 상태의 문서</strong>로 발생한 결함을 말한다.</li>
</ul>
<h3 id="5-결함-심각도">5. 결함 심각도</h3>
<ul>
<li>겨러 개의 결함 중 전체 시스템에 결함이 미치는 영향을 레벨별로 나눈다.</li>
<li>우선 순위 : <code>High</code> ⇒ <code>Medium</code> ⇒ <code>Low</code></li>
</ul>
<table>
<thead>
<tr>
<th align="center">심각도</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong><code>High</code></strong></td>
<td>‧ 시스템이 중단(또는 다운)되어 더 이상 프로세스를 <strong>진행할 수 없게</strong> 만드는 결함</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 시스템의 핵심 요구사항 미구현, 시스템 다운, 장시간 시스템 응답 지연, 시스템 복구 후 데이터 왜곡 등</td>
</tr>
<tr>
<td align="center"><strong><code>Medium</code></strong></td>
<td>‧ 시스템의 흐름에 영향을 미치는 결함</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 부정확한 기능, 부정확한 업무 프로세스, 데이터 필드 형식의 오류, DB 에러, 보안 관련 오류 등</td>
</tr>
<tr>
<td align="center"><strong><code>Low</code></strong></td>
<td>‧ 시스템의 흐름에는 영향을 미치지 않지만, 상황에 맞지 않는 용도와 화면 구성(Configuration) 등의 결함</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 부정확한 GUI 및 메시지, 에러 시 메시지 미출력, 화면상의 문법/철자 오류 등</td>
</tr>
</tbody></table>
<hr>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 이것은 프로그램과 명세서 간의 차이 즉, 업무 내용 불일치이다. 사용자가 기대하는 기대치를 만족하지 못할 때 변경이 필요한 모든 것을 이것이라 하는데 이것을 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color: Blue"><strong>결함</strong></span></li>
</ul>
<p><strong>2) 결함의 상태 및 추적 단계 중 하나로 개발자에 의해 결함의 수정이 완료된 상태를 무엇이라 하는지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color: Blue"><strong>결함 수정(Resolved)</strong></span></li>
</ul>
<p><strong>3) 다음 중 결함 분류 유형으로 올바르지 않은 것을 골라 쓰시오.</strong></p>
<p>ㄱ. 실행 결과 결함
ㄴ. 시스템 결함
ㄷ. GUI 결함
ㄹ. 기능 결함</p>
<ul>
<li>답 : <span style="color: Blue"><strong>ㄱ</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-2--결함-조치">🍀 Section 2 | 결함 조치</h2>
<h3 id="1-소프트웨어-테스트-기법">1. 소프트웨어 테스트 기법</h3>
<blockquote>
<p>💡 <strong>키워드</strong></p>
</blockquote>
<ul>
<li>단위 테스트 : <code>컴포넌트</code>, <code>모듈</code></li>
<li>통합 테스트 : <code>상호작용</code></li>
<li>시스템 테스트 : <code>총괄</code></li>
<li>인수 테스트 : <code>최종</code></li>
</ul>
<p><strong>1) 단위 테스트 기법</strong></p>
<ul>
<li>테스트 가능한 단위인 컴포넌트나 모듈 내의 결함을 찾고 기능을 검증하기 위한 테스트</li>
<li>대표적으로 <strong>Junit</strong>과 <strong>Mock</strong> 테스트 기법이 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>xunit</strong></p>
</blockquote>
<ul>
<li>다양한 코드 중심의 <strong>테스트 프레임워크</strong></li>
<li>소프트웨어의 함수, 클래스 등 서로 다른 구성 단위를 검사한다.</li>
<li><code>Java(Junit)</code>, <code>C++(Cppunit)</code>, <code>.NET(Nunit)</code></li>
</ul>
<blockquote>
<p>💡 <strong>Mock 테스트</strong></p>
</blockquote>
<ul>
<li>특정 기능 또는 모듈에 대한 응답 결과를 미리 정의해놓고 테스트하는 기법</li>
</ul>
<table>
<thead>
<tr>
<th align="center">Mock 테스트 종류</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>Dummy</strong></td>
<td>객체의 전달에만 사용되고 실제로는 사용되지 않으며, 주로 <strong>매개 변수 목록</strong>을 채우는 데 쓰임</td>
</tr>
<tr>
<td align="center"><strong>Fake</strong></td>
<td>실제로 동작하도록 구현되지만, 보통 바른 구현을 위해 <strong>실제 환경과는 다르게 구현할 수 있음</strong></td>
</tr>
<tr>
<td align="center"><strong>Stubs</strong></td>
<td>테스트를 위해 <strong>미리 준비한 응답만을 제공</strong>하는 것. 그 외의 상황에 대해서는 정상적인 작동을 하지 못하는 것</td>
</tr>
<tr>
<td align="center"><strong>Mocks</strong></td>
<td>스펙을 통해 정의된 응답을 받고 다른 응답을 받을 경우 <strong>예외를 발생</strong>하도록 구현되어 있으며, <strong>응답에 대한 확인을 수행</strong>하는 역할</td>
</tr>
</tbody></table>
<p><strong>2) 통합 테스트 기법</strong></p>
<ul>
<li>전체 시스템이 통합 완료될 때까지 단위 시스템 간의 연계성 및 기능 요구사항들을 확인하고, 하드웨어와 소프트웨어 구성요소 간의 <strong>상호작용</strong>을 테스트하는 것이 주요 목적</li>
<li>업무 간의 연계성과 상호 운영성 중심의 테스트 수행</li>
</ul>
<p><span style="color: green"><strong>설계 기법</strong></span></p>
<table>
<thead>
<tr>
<th align="center">설계 기법</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>테스트 설계</strong></td>
<td>개발된 소프트웨어나 시스템의 요구사항, 요구사항 명세서, 업무 구조, 시스템 구조 등을 기반으로 소프트웨어의 <strong>어떤 부분을 어떻게 접근하여 테스트할지</strong>에 대한 <strong>테스트 상황과 방법을 파악</strong>하는 것</td>
</tr>
<tr>
<td align="center"><strong>테스트 구현</strong></td>
<td>테스트 설계를 구체화시켜 <strong>테스트 케이스</strong>를 도출하고 작성하는 것</td>
</tr>
<tr>
<td align="center"><strong>테스트 설계 방법</strong></td>
<td>테스트 상황과 방법을 <strong>구체화</strong> 시키기 위한 <strong>수단 및 도구</strong></td>
</tr>
</tbody></table>
<p><span style="color: green"><strong>설계 방법</strong></span></p>
<table>
<thead>
<tr>
<th align="center">설계 방법</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>보다 작은 케이스</strong></td>
<td>‧ 동등 클래스(Equivalence Class)</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 한 자리 정수를 더하는 프로그램인 경우, &quot;<code>1+1, 1+2, ..., 9+9</code>&quot;까지 81가지 케이스는 모두 동등한 경우이다.</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 위의 경우를 모두 모아서 몇 가지 케이스만 테스트하면 되는 경우</td>
</tr>
<tr>
<td align="center"><strong>보다 많은 버그 찾기</strong></td>
<td>경계 테스트(Boudary Test)</td>
</tr>
<tr>
<td align="center"></td>
<td>‧ 위의 동등 클래스 중 대표 클래스를 뽑을 때 가장자리, 즉 <strong>경계값</strong>을 뽑는 경우</td>
</tr>
</tbody></table>
<p><strong>3) 시스템 테스트 기법</strong></p>
<ul>
<li>시스템 테스트 업무의 진행 전체를 <strong>총괄</strong>할 수 있도록 절차 및 각 프로세스별 세부 업무를 알아야한다.</li>
<li>결과에 대한 분석 및 해결 방안을 제시할 수 있어야 한다.</li>
<li>부하 및 성능 테스트, 장애 복구 테스트, 보안 테스트가 있다.</li>
</ul>
<p><strong>4) 인수 테스트 기법</strong></p>
<ul>
<li><strong>최종</strong> 사용자가 요구한 기능이 제대로 반영되었는지, 인수 조건에 만족하는지를 테스트 하는 기법</li>
<li>요구 기능 만족 여부, 사용 편리성에 대하여 실제 운영 환경에서 실행되며, 고객이 주도하는 테스트</li>
</ul>
<h3 id="2-결함-관리의-이해">2. 결함 관리의 이해</h3>
<p><strong>1) 결함 관련 용어</strong></p>
<table>
<thead>
<tr>
<th>용어</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>⓵ 에러(Error)</strong></td>
<td>‧ 소프트웨어 개발 또는 유지 보수 수행 중에 발생한 <strong>부정확한 결과</strong></td>
</tr>
<tr>
<td></td>
<td>‧ <strong>개발자</strong>의 실수로 발생한 오타, 개발 명세서의 잘못된 이해, 서브루틴의 기능 오해 등</td>
</tr>
<tr>
<td><strong>⓶ 오류(Fault)</strong></td>
<td>‧ 프로그램 코드 상에 존재하는 것으로 비정상적인 프로그램과 정상적인 프로그램 <strong>버전 간의 차이</strong>로 인하여 발생</td>
</tr>
<tr>
<td></td>
<td>‧ 잘못된 연산자가 사용된 경우에 프로그램 이 서브루틴으로부터의 에러 리턴을 <strong>점검하는 코드가 누락</strong>된 것</td>
</tr>
<tr>
<td><strong>⓷ 실패(Failure)</strong></td>
<td>‧ 정상적인 프로그램과 비정상적인 프로그램의 <strong>실행 결과 차이</strong></td>
</tr>
<tr>
<td></td>
<td>‧ 프로그램 실행 중에 프로그램의 실제 실행 결과를 개발 명세서에 정의된 예상 결과와 비교함으로써 발견한다.</td>
</tr>
<tr>
<td><strong>⓸ 결함(Defect)</strong></td>
<td>‧ 버그, 에러, 오류, 실패, 프로그램실행에 대한 문제점, 프로그램 개선 사항 등의 전체를 포괄하는 용어</td>
</tr>
</tbody></table>
<p><strong>2) 결함 판단 기준</strong></p>
<blockquote>
<p>결함의 판단은 <strong>기능 명세서</strong>를 기준으로 한다.</p>
</blockquote>
<p>⓵ 기능 명세서에 <strong>가능</strong>하다고 명시된 동작을 <strong>수행하지 않는</strong> 경우
⓶ 기능 명세서에 <strong>불가능</strong>하다고 명시된 동작을 <strong>수행</strong>하는 경우
⓷ 기능 명세서에 <strong>명시되어 있지 않은</strong> 동작을 <strong>수행</strong>하는 경우
⓸ 기능 명세서에 <strong>명시되어 있지 않지만 수행해야 할 동작을 수행하지 않는</strong> 경우
⓹ <strong>테스터의 시각</strong>에서 볼 때 문제가 있다고 판단되는 경우(이해하기 어려움, 까다로운 기능, 비정상적으로 느린 기능 등)</p>
<h3 id="3-테스트-격언testing-axioms">3. 테스트 격언(Testing Axioms)</h3>
<p><strong>1) 소프트웨어를 완벽하게 테스트 하는것은 불가능하다.</strong></p>
<ul>
<li>가능한 <strong>입력과 출력</strong>의 수가 너무 많다.</li>
<li>소프트웨어 명세서와 결함이 <strong>주관적</strong>이다.</li>
</ul>
<p><strong>2) 소프트웨어 테스트는 위험을 동반하는 훈련이다.</strong></p>
<ul>
<li>가능한 모든 테스트 시나리오와 테스트 케이스를 <strong>테스트하지 않는다는 것</strong>은 <strong>위험을 감수하기로 했다는 것</strong>과 같다.</li>
<li>테스터는 중요한 것과 중요하지 않은 것을 현명하게 구분해야 한다.</li>
</ul>
<p><strong>3) 테스트 작업으로 결함이 존재하지 않는다는 사실을 입증할 수 없다.</strong></p>
<ul>
<li>테스트를 통해 소프트웨어에 <strong>결함이 없다는 것을 보장할 수 없다.</strong></li>
<li>테스트 결과에 결함이 없다는 뜻</li>
<li>테스트 결과에 없더라도 결함이 없다는 것이 아니다.</li>
</ul>
<p><strong>4) 아래와 같은 사유로 인하여 발견한 모든 결함을 수정할 수는 없다.</strong></p>
<ul>
<li><strong>타이트</strong>한 작업 일정</li>
<li><strong>외부적인 요인</strong>으로 결함이 아님에도 결함으로 판단되는 경우<ul>
<li>테스트 환경 미비, 사용자 환경 자체 장애, 법률 또는 규정 변경 등</li>
</ul>
</li>
<li>각각의 프로그램 간의 <strong>결합도</strong>가 높아 고치기 위험한 결함</li>
<li>현실에서 발생할 가능성(자연재해)이 낮아 <strong>고칠 가치가 없는</strong> 결함</li>
</ul>
<p><strong>5) 발견한 결함이 많을수록 남아 있는 결함의 수도 많아.</strong></p>
<h3 id="4-소프트웨어-테스터">4. 소프트웨어 테스터</h3>
<p><strong>1) 역할</strong></p>
<ul>
<li>결함을 가능한 빨리 발견</li>
<li>결함이 수정 및 보완되었는지 확인</li>
</ul>
<p><strong>2) 요구 능력</strong></p>
<ul>
<li>탐구심과 <strong>문제 해결력</strong></li>
<li>창의력을 발휘하여 결함을 찾기 위한 새로운 <strong>접근법</strong> 사용</li>
<li>가능한 한도 내에서 <strong>적당한</strong> 수준의 완벽성 추구</li>
<li>개발자에게 그들의 작품에 결함이 있다는 <strong>말을 조리있게</strong> 할 것</li>
</ul>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 다음 빈칸에 알맞은 용어를 작성하시오.</strong></p>
<table>
<thead>
<tr>
<th align="center">용어</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center">(  ⓵  )</td>
<td>소프트웨어 개발 또는 유지 보수 수행 중에 발생한 부정확한 결과로, 개발자의 실수로 발생한 오타, 개발 명세서의 잘못된 이해, 서브루틴의 기능 오해 등이 있다.</td>
</tr>
<tr>
<td align="center">(  ⓶  )</td>
<td>프로그램 코드 상에 존재하는 것으로 비정상적인 프로그램과 정상적인 프로그램 버전 간의 차이로 인하여 발생한다.</td>
</tr>
<tr>
<td align="center">(  ⓷  )</td>
<td>정상적인 프로그램과 비정상적인 프로그램의 실행 결과 차이를 의미하며, 프로그램 실행 중에 프로그램의 실제 실행 결과를 개발 명세서에 정의된 예상 결과와 비교함으로써 발견한다.</td>
</tr>
<tr>
<td align="center">(  ⓸  )</td>
<td>버그, 에러, 오류, 실패, 프로그램 실행에 대한 문제점, 프로그램 개선 사항 등의 전체를 포괄하는 용어이다.</td>
</tr>
</tbody></table>
<ul>
<li>답<ul>
<li><span style="color: blue"><strong>⓵ : 에러(Error)</strong></span></li>
<li><span style="color: blue"><strong>⓶ : 오류(Fault)</strong></span></li>
<li><span style="color: blue"><strong>⓷ : 실패(Failure)</strong></span></li>
<li><span style="color: blue"><strong>⓸ : 결함(Defect)</strong></span></li>
</ul>
</li>
</ul>
<p><strong>2) 다음 Mock 테스트 중 빈칸에 들어가는 유형을 작성하시오.</strong></p>
<table>
<thead>
<tr>
<th align="center">Mock 테스트 종류</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>Dummy</strong></td>
<td>객체의 전달에만 사용되고 실제로는 사용되지 않으며, 주로 <strong>메게 변수 목록</strong>을 채우는 데 쓰임</td>
</tr>
<tr>
<td align="center"><strong>( ? )</strong></td>
<td>실제로 동작하도록 구현되지만, 보통 바른 구현을 위해 <strong>실제 환경과는 다르게 구현할 수 있음</strong></td>
</tr>
<tr>
<td align="center"><strong>Stubs</strong></td>
<td>테스트를 위해 <strong>미리 준비한 응답만을 제공</strong>하는 것. 그 외의 상황에 대해서는 정상적인 작동을 하지 못하는 것</td>
</tr>
<tr>
<td align="center"><strong>Mocks</strong></td>
<td>스펙을 통해 정의된 응답을 받고 다른 응답을 받을 경우 <strong>예외를 발생</strong>하도록 구현되어 있으며, <strong>응답에 대한 확인을 수행</strong>하는 역할</td>
</tr>
</tbody></table>
<ul>
<li>답 : <span style="color: blue"><strong>Fake</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-3--결함-조치-관리">🍀 Section 3 | 결함 조치 관리</h2>
<h3 id="1-프로그램-코드-검토-기법">1. 프로그램 코드 검토 기법</h3>
<p><strong>1) 소프트웨어 인스펙션의 개요</strong></p>
<blockquote>
<p>💡 <strong>소프트웨어 인스펙션(Software Inspection)</strong></p>
</blockquote>
<ul>
<li>Code Inspection 외에도 설계 및 설계 산출물까지 포괄하는 개념이다.</li>
</ul>
<blockquote>
<p>💡 <strong>코드 인스펙션(Code Inspection)</strong></p>
</blockquote>
<ul>
<li>대체 불가능한 테스트</li>
<li>통계 왈, 인스펙션을 적절히 잘 수행하면 에러 90%를 찾을 수 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>워크스루(Walkthrough)</strong></p>
</blockquote>
<ul>
<li><p>코드의 품질을 평가하고 개선하기 위한 목적으로 수행되는 검토 기법</p>
</li>
<li><p><strong>검토 회의</strong>라고도 한다.</p>
</li>
<li><p>적절한 인스펙션은 소프트웨어 개발의 전체 수명 주기에 걸친 리소스 절감과 그에 따른 비용 감소, 산출물의 품질을 항상 시킬 수 있다.</p>
</li>
</ul>
<p><span style="color:green"><strong>인스펙션을 해야하는 비즈니스적인 이유</strong></span></p>
<ul>
<li>결함을 빨리 찾을 수록 수정(fix) 비용이 적게 든다.</li>
<li>인스펙션의 데이터를 통해 업무에 집중할 수 있다.</li>
<li>인스펙션을 함으로써 교차 교육(Cross-training)을 돕는다.</li>
<li>제품의 <code>re-engineering</code>이 가능한 영역을 식별하도록 돕는다.</li>
</ul>
<p><strong>2) 소프트웨어 인스펙션 중점 항목</strong></p>
<p><span style="color:green"><strong>품질 보증(QA)의 역할</strong></span></p>
<ul>
<li>프로젝트에서 소프트웨어 인스펙션 업무를 담당 및 실시</li>
<li>아키텍트가 각 단계에서 원활한 업무 수행을 위해 지원을 해야한다.</li>
</ul>
<p><span style="color:green"><strong>아키텍트의 역할</strong></span></p>
<ul>
<li>코드 인스펙션의 프로세스 전반과 각 단계별 수행 업무 등을 전체적으로 이해할 필요가 있다.</li>
<li>아래와 같이 검토 절차에서 <code>Overview</code>와 <code>Rework</code>가 잘 수행될 수 있도록 지원해야 한다.<ul>
<li>자동 코드 인스펙션을 위한 환경 지원, 계획 수립 지원 활동</li>
<li>체크리스트 정합성 검토 지원 활동</li>
<li>인스펙션 결과 리뷰 참석</li>
<li>발견된 결함을 수정하기 위한 개발자 리딩 지원 활동</li>
</ul>
</li>
</ul>
<p><strong>3) 코드 인스펙션 태스크별 수행 내용</strong></p>
<p><strong>⓵ 코드 인스펙션 프로세스</strong></p>
<table>
<thead>
<tr>
<th align="center">구분</th>
<th>수행 단계</th>
<th>주요 내용</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>자동 수행</strong></td>
<td>1. 범위 계획(Caplacity Plan)</td>
<td>인스펙션의 범위와 범위 선정 기준 결정</td>
</tr>
<tr>
<td align="center"></td>
<td>2. 시작(Overview)</td>
<td>자동 인스펙션 수행</td>
</tr>
<tr>
<td align="center"><strong>준비 단계</strong></td>
<td>3. 준비(Preparation)</td>
<td>계획서 작성, 체크리스트 작성, 계획 공지, 대상 산출물 준비</td>
</tr>
<tr>
<td align="center"><strong>이행 단계</strong></td>
<td>4. 인스펙션 회의(Inspection Meeting)</td>
<td>사전 검토 실시, 미팅 실시</td>
</tr>
<tr>
<td align="center"><strong>시정 조치</strong></td>
<td>5. 재작업(Rework)</td>
<td>개발 원작자가 직접 작업</td>
</tr>
<tr>
<td align="center"></td>
<td>6. 후속 처리(Follow-Up)</td>
<td>결과서 작성 및 보고</td>
</tr>
</tbody></table>
<p><strong>⓶ 코드 인스펙션 태스트별 수행 내용</strong></p>
<table>
<thead>
<tr>
<th align="center">구분</th>
<th>작업</th>
<th>수행 내용</th>
<th>산출물</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>자동 수행</strong></td>
<td>1. 자동 인스펙션 수행</td>
<td>‧ 전수 검사, Quality metric, 결함 분석</td>
<td>코드 인스펙션 결과</td>
</tr>
<tr>
<td align="center"><strong>준비 단계</strong></td>
<td>2. 계획서 작성</td>
<td>‧ 일정 및 관련자, 대상 산출물 및 준비물 정의</td>
<td>인스펙션 <strong>계획서</strong></td>
</tr>
<tr>
<td align="center"></td>
<td>3. 체크리스트 작성</td>
<td>‧ 표준 체크리스트를 테일러링하여 인스펙션 체크리스트 작성</td>
<td>인스펙션 <strong>체크리스트</strong></td>
</tr>
<tr>
<td align="center"></td>
<td>4. 계획 공지</td>
<td>‧ 메일이나 공지를 통해 관련자에게 사전 공지</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td>5. 대상 산출물 준비</td>
<td>‧ 산출물 작성자가 인스펙션 시 필요한 자료를 준비</td>
<td></td>
</tr>
<tr>
<td align="center"><strong>이행 단계</strong></td>
<td>6. 착수 회의 실시</td>
<td>‧ 진행자는참여자에게 검토 주안점, 검토 방법, 역할 등을 교육</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td></td>
<td>‧ 작업자는 대상 산출물 및 참조 자료에 대한 개요 소개</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td>7. 사전 검토 실시</td>
<td>‧ 산출물, 체크리슽, 사전 검토서 양식 배포</td>
<td>인스펙션 <strong>결과서</strong></td>
</tr>
<tr>
<td align="center"></td>
<td></td>
<td>‧ 참여자별로 자료를 개별 검토하여 발견된 부적합 사항 기록</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td>8. 미팅 실시</td>
<td>‧ 사전 검토에서 발견한 부적합 사항 검증</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td></td>
<td>‧ 미팅에서 발견된 부적합 사항 추가 기재</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td></td>
<td>‧ 부적합 사항 목록 정리 또는 조치 계획 수립</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td>9. 결과 정리</td>
<td>‧ 진행자는 최종 확정된 결함 내용을 인스펙션 결과서에 정리한 후 작성자에게 배포</td>
<td></td>
</tr>
<tr>
<td align="center"><strong>시정 조치</strong></td>
<td>10. 보완 작업 실시</td>
<td>‧ 작성자는 각 결함에 대한 보완 작업 실시</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td>11. 시정 조치 결과 확인</td>
<td>‧ 진행자는 보완 완료 여부를 확인(필요 시 재검토)</td>
<td></td>
</tr>
<tr>
<td align="center"></td>
<td>12. 결과 보고</td>
<td>‧ 진행자는 결과서를 작성하고 관련자에게 보고</td>
<td>인스펙션 <strong>결과서</strong></td>
</tr>
</tbody></table>
<blockquote>
<p>용어</p>
</blockquote>
<ul>
<li><code>테일러링(Tailering)</code><ul>
<li>방법론 맞춤화</li>
<li>프로젝트의 특성과 상황(규모, 복잡도, 기술 등)에 맞춰 표준화된 <strong>소프트웨어 개발 방법론</strong>의 절차, 기법, 산출물 등을 <strong>수정·보완</strong>하는 작업</li>
</ul>
</li>
</ul>
<p><strong>⓷ 코드 인스펙션의 프로세스와 수행 내용</strong></p>
<p><span style="color:green"><strong>자동 코드 인스펙션</strong></span></p>
<ul>
<li>전체 개발된 프로그램을 대상으로 자동 인스펙션 수행</li>
</ul>
<p><span style="color:green"><strong>수동 코드 인스펙션</strong></span></p>
<ul>
<li>자동 코드 인스펙션 코드 중 에러가 많은 경우</li>
<li>업무 중에 복잡한 처리 로직이 있는 경우</li>
<li>처음 투이되는 개발자의 산출물</li>
</ul>
<p><strong>⓸ 코드 인스펙션 수행 시 고려사항</strong></p>
<ul>
<li>기능적으로 이상이 없는 소스코드를 대상으로 검증한다.<ul>
<li>일반적으로 인스펙션의 목적은 개발 가이드에 따른 표준 준수성을 파악하기 위함에 있기 때문</li>
</ul>
</li>
<li>인스펙션의 효과는 다양하지만, 실제적으로 테스트 전 결함 발견에 따른 이익을 수행팀원들이 인식하는 것이 가장 크다고 할 수 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>인스펙션의 효과</strong></p>
</blockquote>
<ul>
<li>개발 가이드에 따른 체크 항목 파악</li>
<li>결함 유형 파악에 따른 차후 코딩 시 유념</li>
<li>다른 개발자의 기술 습득</li>
<li>etc</li>
</ul>
<p><strong>4) 인스펙션과 워크스로의 차이점</strong></p>
<table>
<thead>
<tr>
<th align="center">구분</th>
<th>인스펙션</th>
<th>워크스루</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>목적</strong></td>
<td>결함 파악 및 제거</td>
<td>산출물 평가 및 개선</td>
</tr>
<tr>
<td align="center"><strong>수행 조건</strong></td>
<td>완성도가 기준 이상일 때</td>
<td>팀이나 관리자가 필요할 때</td>
</tr>
<tr>
<td align="center"><strong>결함 수정 여부</strong></td>
<td><strong>모든 결함은 제거되어야함</strong></td>
<td><strong>저자 결정</strong></td>
</tr>
<tr>
<td align="center"><strong>변경 사항 검증</strong></td>
<td>진행자가 재작업 결과 확인</td>
<td>저자 결정</td>
</tr>
<tr>
<td align="center"><strong>검토자 인원</strong></td>
<td>3~6명</td>
<td>2~7명</td>
</tr>
<tr>
<td align="center"><strong>참여자</strong></td>
<td><strong>동료</strong></td>
<td><strong>기술 전문가 및 동료</strong></td>
</tr>
<tr>
<td align="center"><strong>검토 인도자</strong></td>
<td>교육받은 진행자(Moderator)</td>
<td>저자</td>
</tr>
<tr>
<td align="center"><strong>검토 준비 여부</strong></td>
<td>체크리스트를 이용한 검토</td>
<td>일반적으로 준비하지 않음</td>
</tr>
<tr>
<td align="center"><strong>검토 분량</strong></td>
<td>적고 상세함</td>
<td>많음</td>
</tr>
<tr>
<td align="center"><strong>검토 속도</strong></td>
<td>느림</td>
<td>빠름</td>
</tr>
<tr>
<td align="center"><strong>발표자</strong></td>
<td>검토자(Reader)</td>
<td>저자</td>
</tr>
<tr>
<td align="center"><strong>지표 수집 여부</strong></td>
<td>모든 검토자들이 기록함</td>
<td>하지 않음</td>
</tr>
<tr>
<td align="center"><strong>보고서</strong></td>
<td><strong>결함 리스트 및 측정 지표</strong></td>
<td><strong>약식 보고서 또는 회의록</strong></td>
</tr>
<tr>
<td align="center"><strong>데이터 측정 여부</strong></td>
<td>필수</td>
<td>권장 사항</td>
</tr>
<tr>
<td align="center"><strong>체크리스트 사용 여부</strong></td>
<td><strong>사용함</strong></td>
<td><strong>사용 안함</strong></td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>동료 검토(Peer Review)</strong></p>
</blockquote>
<ul>
<li>2~3명이 진행하는 리뷰 형태</li>
<li>작성자가 명세서 내용을 직접 설명하고, 이해 관계자들(동료)이 설명을 들으면서 결함을 발견하는 기법</li>
</ul>
<blockquote>
<p>💡 <strong>인스펙션(Inspection)</strong></p>
</blockquote>
<ul>
<li><strong>명세서 작성자를 제외한 다른 검토 전문가들</strong>이 확인하면서 결함을 발견하는 형태</li>
<li>저자가 아닌 훈련된 중재가 주도하는 기법</li>
</ul>
<blockquote>
<p>💡 <strong>워크스루(Walkthrough)</strong></p>
</blockquote>
<ul>
<li>검토 자료를 회의 전에 배포하여 사전 검토한 후 짧은 시간 동안 <strong>저자가 직접</strong> 회의를 주도하는 형태</li>
<li>리뷰를 통해 오류를 조기에 검출하는데 목적을 둔 검증 기법</li>
</ul>
<h3 id="2-형상-관리-및-구성요소">2. 형상 관리 및 구성요소</h3>
<p><strong>1) 소프트웨어 형상 관리의 정의</strong></p>
<ul>
<li>소프트웨어 프로세스 전반에 걸쳐 소프트웨어 형상의 변경 요인에 대해 소프트웨어 <strong>형상을 보호하는 활동</strong></li>
<li>소프트웨어 프로세스의 모든 출력물 정보, 컴퓨터 프로그램, 컴퓨터 프로그램 설명 문서, 데이터 등</li>
</ul>
<table>
<thead>
<tr>
<th>구분</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>소프트웨어 형상 관리</strong></td>
<td>소프트웨어 엔지닝어링 프로젝트 <strong>개시</strong>에서 소프트웨어 <strong>소멸</strong> 시점까지의 활동</td>
</tr>
<tr>
<td><strong>소프트웨어 지원</strong></td>
<td>소프트웨어가 <strong>고객에게 인도되고 운영되는 시점</strong>에서 발생하는 소프트웨어 엔지니어링 활동</td>
</tr>
</tbody></table>
<p><strong>2) 기준선과 소프트웨어 형상 관리 항목</strong></p>
<p><strong>⓵ 기준선(Baseline)</strong></p>
<ul>
<li>변경을 통제하게 해준다.</li>
<li>정식으로 검토 및 합의된 명세서나 제품 개발의 바탕</li>
<li><strong>정식의 변경 통제 절차</strong>를 통해서만 변경 가능하다.</li>
</ul>
<p><strong>⓶ 소프트웨어 형상 관리 항목(SCI)</strong></p>
<ul>
<li><strong>S</strong>ofeware <strong>C</strong>onfiguration <strong>I</strong>tem</li>
<li>소프트웨어 형상과 개발 도구의 합성으로 <strong>개발 단계</strong>별 <strong>기준선</strong>을 기준으로 <strong>형상 항목</strong>을 관리한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">개발 단계</th>
<th>기준선(간결)</th>
<th>소프트웨어 형상 항목(자세)</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>계획</strong></td>
<td>사용자 요구사항</td>
<td>시스템 <strong>명세서</strong>, 개발 <strong>계획서</strong>, 구성 관리 계획서, 품질 평가 계획서, 개발 표준 및 절차 메뉴얼</td>
</tr>
<tr>
<td align="center"><strong>요구 분석</strong></td>
<td>사용자 요구 기능이 하위 시스템 간에 어떻게 분배되는가 여부</td>
<td><strong>자료 흐름도</strong>, 자료 사전, 자료 흐름도 명세서</td>
</tr>
<tr>
<td align="center"><strong>설계</strong></td>
<td>개발 전 설계 명세</td>
<td>입출력 명세서, 화면 설계서, 초기 사용자 메뉴얼, 초기 시스템 메뉴얼, 자료 구조도, 시스템 구조도</td>
</tr>
<tr>
<td align="center"><strong>구현</strong></td>
<td>시험 계획서</td>
<td>원시 코드, 목적 코드, 실해 코드, 단위 시험 보고서</td>
</tr>
<tr>
<td align="center"><strong>시스템 통합 및 시험</strong></td>
<td>제품</td>
<td>통합 시험 보고서, 기능/성능/과부하 시험 보고서, 인증 시험 보고서</td>
</tr>
<tr>
<td align="center"><strong>설치 및 운영</strong></td>
<td>운영</td>
<td>목적/실행 코드, 운영자 메뉴얼, 사용자 메뉴얼</td>
</tr>
</tbody></table>
<p><strong>3) 형상 관리의 주요 활동</strong></p>
<table>
<thead>
<tr>
<th align="center">주요 기능</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>형상 식별</strong></td>
<td>형상 관리 대상을 구분하고 관리 목록 번호 부여</td>
</tr>
<tr>
<td align="center"><strong>버전 관리</strong></td>
<td>진화 그래프 등을 통해 <code>SCI</code>의 버전 부여 및 갱신</td>
</tr>
<tr>
<td align="center"><strong>변경 통제</strong></td>
<td><code>SCI</code>에 대한 접근 및 동기화 제어</td>
</tr>
<tr>
<td align="center"><strong>형상 감사</strong></td>
<td><code>SCI</code> 무결성을 평가하여 공식적으로 승인</td>
</tr>
<tr>
<td align="center"><strong>상태 보고</strong></td>
<td>개발자와 유지 보수자에게 변경 사항을 공지</td>
</tr>
</tbody></table>
<p><strong>4) 형상 관리 도구</strong></p>
<blockquote>
<p>💡 <strong>형상 관리 도구</strong></p>
</blockquote>
<ul>
<li>소프트웨어 변경 과정, 처리 상태를 기록 및 보고</li>
<li>부합하는 해당 사항에 대하여 추적, 통제, 관리</li>
<li><strong>품질 향상 및 안정성</strong>을 높이는 데에 지원하는 도구</li>
</ul>
<table>
<thead>
<tr>
<th>형상 관리 도구</th>
<th>설명</th>
</tr>
</thead>
<tbody><tr>
<td><strong>CVS(Concurrent Version System)</strong></td>
<td>‧ 가장 오래된 형상 관리 도구 중 하나</td>
</tr>
<tr>
<td></td>
<td>‧ 서버는 단순한 명령 구조를 가진다는 장점이 있고, 테스트 기반의 코드만 지원한다는 단점도 있다.</td>
</tr>
<tr>
<td><strong>SVN(Subversion)</strong></td>
<td>‧ <code>CVS</code>의 단점을 보완해 현재 가장 대중화 된 도구 중 하나</td>
</tr>
<tr>
<td></td>
<td>‧ 다양한 <code>GUI</code> 도구가 존재하고, 압축을 통해 서버의 공간을 절약할 수 있다.</td>
</tr>
<tr>
<td><strong>Git</strong></td>
<td>‧ 리눅스 커널 개발을 위해 만든 형상 관리 시스템</td>
</tr>
<tr>
<td></td>
<td>‧ <code>CVS</code>와 <code>SVN</code>의 단점을 모두 보완하는 장점이 있다.</td>
</tr>
<tr>
<td></td>
<td>‧ 중앙 집중형이 아닌 분산형 방식으로 스스로 저장 공간이 필요하다.</td>
</tr>
<tr>
<td></td>
<td>‧ 개념이 다르므로 개발자에게 학습할 시간이 필요하다.</td>
</tr>
</tbody></table>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 다음 보기에서 설명하는 용어를 작성하시오.</strong></p>
<blockquote>
</blockquote>
<ul>
<li><p>전문가가 하는 가장 공식적인 검토 방법</p>
</li>
<li><p>체크리스트를 기반으로 검토</p>
</li>
<li><p>답 :<span style="color: blue"><strong>인스펙션(Inspection)</strong></span></p>
</li>
</ul>
<p><strong>2) 산출물을 검토하고 결함을 찾아내기 위하여 요구사항 명세서를 미리 배포하여 사전 검토한 후 오류를 조기에 검출하는데 목적을 두는 검토 방법을 무엇이라고 하는지 쓰시오.</strong></p>
<ul>
<li>답 :<span style="color: blue"><strong>워크스루(Walkthrough)</strong></span></li>
</ul>
<p><strong>3) 소프트웨어 변경 과정 및 처리 상태를 기록/보고하고 소프트웨어의 안전성을 높이는 데에 지원하는 도구를 무엇ㅇ이라고 하는지 쓰시오.</strong></p>
<ul>
<li>답 :<span style="color: blue"><strong>형상 관리 도구</strong></span></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[2. 애플리케이션 테스트 수행 : 애플리케이션 테스트 수행]]></title>
            <link>https://velog.io/@xaexun_/2.-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EC%88%98%ED%96%89-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EC%88%98%ED%96%89</link>
            <guid>https://velog.io/@xaexun_/2.-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EC%88%98%ED%96%89-%EC%95%A0%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EC%88%98%ED%96%89</guid>
            <pubDate>Tue, 10 Feb 2026 14:47:24 GMT</pubDate>
            <description><![CDATA[<h1 id="📍-chapter-1--애플리케이션-테스트-수행">📍 Chapter 1 : 애플리케이션 테스트 수행</h1>
<hr>
<h2 id="🍀-section-1--테스트">🍀 Section 1 | 테스트</h2>
<h3 id="1-테스트의-개념">1. 테스트의 개념</h3>
<p>** 1) 개요**</p>
<blockquote>
<p>💡 <strong>테스트</strong></p>
</blockquote>
<ul>
<li><p>개발된 응용 애플리케이션이나 시스템의 <strong>사용자</strong>가 요구하는 기능과 성능, 사용성, 안전성 등을 확인하고 노출되지 않은 숨어있는 <strong>결함</strong>을 찾아내는 활동</p>
</li>
<li><p>테스트 과정에 필요한 역할은 <strong>소프트웨어 아키텍트</strong>와 <strong>테스트 매니저</strong>이다.</p>
<ul>
<li>아래 그림과 같이 <strong>소프트웨어 생명 주기(Life Cycle)</strong>의 <strong>V모델</strong>에서 각각 좌측과 우측의 핵심 역할을 담당하고 서로 보완 관계에 있다.</li>
</ul>
</li>
</ul>
<blockquote>
<p><span style="color: blue"><strong>소프트웨어 생명주기의 V모델</strong></span>
<img src="https://velog.velcdn.com/images/xaexun_/post/45d1076a-b749-4559-a22a-b9460ede6d21/image.png" alt=""></p>
</blockquote>
<table>
<thead>
<tr>
<th align="center">테스트 과정</th>
<th align="center">역할</th>
<th align="center">순서</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>소프트웨어 아키텍트</strong></td>
<td align="center"><strong>요</strong>구사항 (Requirements)</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>분</strong>석-시스템 설계 (Specification)</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>디</strong>자인-모듈 설계 (Design)</td>
<td align="center">3</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>구</strong>현-코딩 (Code)</td>
<td align="center">4</td>
</tr>
<tr>
<td align="center"><strong>테스트 매니저</strong></td>
<td align="center"><strong>단</strong>위 테스트 (Unit Testing)</td>
<td align="center">5</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>통</strong>합 테스트 (Integration Testing)</td>
<td align="center">6</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>시</strong>스템 테스트 (System Testing)</td>
<td align="center">7</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>인</strong>수 테스트 (Acceptance Testing)</td>
<td align="center">8</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>소프트웨어 아키텍처</strong></p>
</blockquote>
<ul>
<li>소프트웨어의 골격이 되는 기본 구조</li>
<li>구성요소(Component) 간의 <strong>관계</strong>를 표현하는 시스템 구조 또는 구조체</li>
</ul>
<p><strong>2) 테스트의 7가지 원칙</strong></p>
<table>
<thead>
<tr>
<th align="center">번호</th>
<th align="center">원칙</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>①</strong></td>
<td align="center">테스트는 <span style="color: green"><strong>계획 단계</strong></span>부터 한다.</td>
<td align="center">Life Cycle에서 가능한 초기부터 시작</td>
</tr>
<tr>
<td align="center"><strong>②</strong></td>
<td align="center">테스트는 <span style="color: green"><strong>결함</strong></span>을 밝히는 활동이다.</td>
<td align="center">결함의 제거가 아닌 <strong>결함의 발견</strong></td>
</tr>
<tr>
<td align="center"><strong>③</strong></td>
<td align="center">완전한 테스트는 <span style="color: green"><strong>불가능</strong></span>하다.</td>
<td align="center"><strong>자원의 한계</strong>가 있다</td>
</tr>
<tr>
<td align="center"><strong>④</strong></td>
<td align="center">테스트는 <span style="color: green"><strong>상황</strong></span>에 따라 다르다.</td>
<td align="center">다양한 방법으로 테스트해야한다</td>
</tr>
<tr>
<td align="center"><strong>⑤</strong></td>
<td align="center"><span style="color: green"><strong>결함 집중</strong></span>을 고려한다.</td>
<td align="center">파레토 법칙를 적용한다</td>
</tr>
<tr>
<td align="center"><strong>⑥</strong></td>
<td align="center"><span style="color: green"><strong>살충제 패러독스</strong></span>를 고려한다.</td>
<td align="center">동일한 테스트 케이스에 의한 반복적 테스트로 새로운 버그를 찾지 못하는 <strong>내성</strong> 현상</td>
</tr>
<tr>
<td align="center"><strong>⑦</strong></td>
<td align="center"><span style="color: green"><strong>오류 부재의 궤변</strong></span>을 고려한다.</td>
<td align="center">개발한 제품은 요구 사항과 일치하고 사용에 적합해야 한다</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>파레토 법칙</strong>
<span style="color: navy">&quot;<strong>20%</strong>에 해당하는 코드에서 전체 결함 <strong>80%</strong>를 발견한다.&quot;</span></p>
</blockquote>
<h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 소프트웨어의 구조 또는 소프트웨어의 설계와 구성요소들 사이에서 유기적으로 관계를 표현하는 용어를 무엇이라 하는지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong>소프트웨어 아키텍처</strong></span></li>
</ul>
<p><strong>2) 다음 보기 중 테스트의 7가지 원칙으로 올바르지 않은 것을 고르시오.</strong></p>
<p>ㄱ. 초기 테스트
ㄴ. 완전한 테스트는 불가능한다.
ㄷ. 살충제 패러독스
ㄹ. 테스트는 결함을 제거하기 위해 존재한다.</p>
<ul>
<li>답 : <span style="color: blue"><strong>ㄹ</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-2--프로젝트-수행-단계에-따른-테스트의-분류">🍀 Section 2 | 프로젝트 수행 단계에 따른 테스트의 분류</h2>
<h3 id="1-단위-테스트">1. 단위 테스트</h3>
<blockquote>
<p><strong>작은 소프트웨어 단위(컴포넌트 또는 모듈)</strong>를 테스트하는 것</p>
</blockquote>
<ul>
<li>일반적으로 개발자 자신에 의해 진행된다.</li>
<li>테스트 방법은 아래와 같다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">테스트 방법</th>
<th align="center">설명</th>
<th align="center">테스트 목적</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>구조 기반</strong></td>
<td align="center">• 업무 단위별 <strong>제어 흐름</strong>과 <strong>조건 결정</strong>에 따른 결과를 테스트하는데 목적이 있다.</td>
<td align="center"><strong>제어 흐름</strong>, <strong>조건 결정</strong></td>
</tr>
<tr>
<td align="center"></td>
<td align="center">• 프로그램 내부 구조 및 복잡도를 검증하는 <strong>화이트 박스(White Box) 테스트</strong>가 속한다.</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"><strong>명세 기반</strong></td>
<td align="center"><strong>동등 분할</strong>과 <strong>경계값 분석</strong>을 위하여 사용자의 입력,출력, 내부 이벤트 등을 확인하는데 목적이 있다.</td>
<td align="center"><strong>동등 분할</strong>, <strong>경계값 분석</strong></td>
</tr>
<tr>
<td align="center"></td>
<td align="center">목적 및 실행 코드 기반의 실행을 통한 <strong>블랙 박스(Black Box) 테스트</strong>가 속한다.</td>
<td align="center"></td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>화이트 박스 테스트 (기제조루데분)</strong></p>
</blockquote>
<ul>
<li>개발자 관점 구조와 동작 기반의 테스트</li>
<li>종류<ul>
<li><strong>기</strong>초 경로 테스트</li>
<li><strong>제</strong>어 흐름 테스트</li>
<li><strong>조</strong>건 테스트</li>
<li><strong>루</strong>프 테스트</li>
<li><strong>데</strong>이터 흐름 테스트</li>
<li><strong>분</strong>기 테스트</li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong>블랙 박스 테스트 (균한원비)</strong></p>
</blockquote>
<ul>
<li>사용자 관점, 명세(요구사항) 기반의 테스트</li>
<li>종류<ul>
<li><strong>균</strong>등 분할(동치분해)</li>
<li><strong>한</strong>계값(경계값)</li>
<li><strong>원</strong>인 효과 그래프 테스트</li>
<li><strong>비</strong>교 테스트</li>
</ul>
</li>
</ul>
<blockquote>
<p>❗️ <strong>주의점</strong></p>
</blockquote>
<ul>
<li><strong>구조 기반</strong> 안에 <strong>화이트 박스 테스트</strong>가 속해있는 것이다.<ul>
<li><span style="color: green"><strong>구조 기반 ≠ 화이트 박스 테스트</strong></span></li>
</ul>
</li>
<li><strong>명세 기반</strong> 안에 <strong>블랙 박스 테스트</strong>가 속해있는 것이다.<ul>
<li><span style="color: green"><strong>명세 기반 ≠ 블랙 박스 테스트</strong></span></li>
</ul>
</li>
</ul>
<h3 id="2-통합-테스트">2. 통합 테스트</h3>
<blockquote>
<p>모듈 사이의 인터페이스, 통합된 <strong>컴포넌트 간의 상호작용</strong>을 테스트한다.</p>
</blockquote>
<ul>
<li>빅뱅, 상향식, 하향식, 샌드위치, Central, Collaboration, 레이어 통합 등의 테스트가 있다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">구분</th>
<th align="center">수행 방법</th>
<th align="center">더미 모듈</th>
<th align="center">장점</th>
<th align="center">단점</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>빅뱅(Big Bang)</strong></td>
<td align="center">모든 모듈을 동시 통합 후 수행</td>
<td align="center">X</td>
<td align="center">• 단시간 테스트 가능</td>
<td align="center">• 장애 위치 파악이 어려움</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center">• 작은 시스템에 유리</td>
<td align="center">• 모든 모듈 개발</td>
</tr>
<tr>
<td align="center"><strong>상향식(Bottom up)</strong></td>
<td align="center"><strong>최하위 모듈</strong>부터 점진적으로 상위 모듈과 함께 수행</td>
<td align="center"><strong>드라이버</strong></td>
<td align="center">• 장애 위치 파악이 쉬움</td>
<td align="center">• 이른 프로토타입이 어려움</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center">• 모듈 개발 낭비 시간이 없음</td>
<td align="center">• 중요 모듈이 마지막으로 테스트될 가능성 높음</td>
</tr>
<tr>
<td align="center"><strong>하향식(Top down)</strong></td>
<td align="center"><strong>최상위 모듈</strong>부터 하위 모듈들을 통합하며 수행</td>
<td align="center"><strong>스텁</strong></td>
<td align="center">• 장애 위치 파악이 쉬움</td>
<td align="center">• 많은 스텁이 필요</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center">• 이른 포로트타입 가능</td>
<td align="center">• 하위 모듈들의 불충분한 테스트 수행</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center">• 중요 모듈의 선 테스트 가능</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center">• 결함 조기 발견 가능</td>
<td align="center"></td>
</tr>
</tbody></table>
<blockquote>
</blockquote>
<ul>
<li><strong>드라이버</strong> : 상위 모듈 없이 하위 모듈이 있는 경우 하위 모듈 구동<ul>
<li><strong>상위 모듈간의 인터페이스</strong> 역할</li>
</ul>
</li>
<li><strong>스텁</strong> : 상위 모듈은 있지만 하위 모듈이 없는 경우 하위 모듈 대체<ul>
<li>일시적으로 필요한 조건만 가지고 임시로 제공되는 <strong>시험용 모듈</strong></li>
<li>드라이버보다 작성이 쉽다.</li>
</ul>
</li>
</ul>
<h3 id="3-시스템-테스트">3. 시스템 테스트</h3>
<blockquote>
<p>통합된 단위 시스템의 기능이 <strong>시스템에서 정상적으로 수행되는지</strong>를 테스트하는 것</p>
</blockquote>
<ul>
<li><strong>성능 및 장애 테스트</strong>가 여기에 포함된다.</li>
</ul>
<blockquote>
</blockquote>
<p>💡 <strong>유스케이스</strong></p>
<ul>
<li><p>시스템의 동작을 사용자의 입장에서 표현한 시나리오</p>
</li>
<li><p>시스템에 관련한 요구사항을 알아내는 과정</p>
</li>
<li><p>업무 기반의 기능적 요구사항과 시스템적인 비기능적 요구사항으로 나누어진다.</p>
</li>
</ul>
<p><span style="color: green"><strong><code>기능적 요구사항</code></strong></span></p>
<ul>
<li>요구사항 명세서, 비즈니스 절차, 유스케이스 등</li>
<li><strong>명세</strong>서 기반의 <strong>블랙 박스 테스트</strong></li>
</ul>
<p><span style="color: green"><strong><code>비기능적 요구사항</code></strong></span></p>
<ul>
<li>성능 테스트, 회복 테스트, 보안 테스트, 내부 시스템의 메뉴 구조 웹 페이지의 네비게이션 등</li>
<li><strong>구조</strong>적 요소에 대한 <strong>화이트 박스 테스트</strong></li>
</ul>
<h3 id="4-인수-테스트">4. 인수 테스트</h3>
<blockquote>
</blockquote>
<ul>
<li><p>일반적으로 <strong>최종 사용자</strong>와 업무에 따른 이해관계자 등이 테스트를 수행</p>
</li>
<li><p><strong>개발된 제품에 대해 운영 여부를 결정하는 테스트</strong>하는 것</p>
</li>
<li><p><strong>실제 업무 적용 전</strong>에 수행한다.</p>
</li>
</ul>
<table>
<thead>
<tr>
<th align="center">테스트</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>사용자 인수 테스트</strong></td>
<td align="center">비즈니스 사용자가 시스템 사용의 적절성 여부 확인</td>
</tr>
<tr>
<td align="center"><strong>운영상의 인수 테스트</strong></td>
<td align="center">시스템 관리자가 시스템 인수 시 수행하는 테스트 활동으로 백업/복원 시스템, 재난 복구, 사용자 관리, 정기 점검 등을 확인</td>
</tr>
<tr>
<td align="center"><strong>계약 인수 테스트</strong></td>
<td align="center">계약상의 인수/검수 조건을 준수하는지 확인</td>
</tr>
<tr>
<td align="center"><strong>규정 인수 테스트</strong></td>
<td align="center">정부 지침, 법규, 규정 등 규정에 맞게 개발하였는지 확인</td>
</tr>
<tr>
<td align="center"><strong>알파 테스트</strong></td>
<td align="center">개발하는 <strong>조직 내</strong> 잠재 고객에 의해 테스트 수행</td>
</tr>
<tr>
<td align="center"><strong>베타 테스트</strong></td>
<td align="center"><strong>실제 환경</strong>에서 고객에 의해 테스트 수행</td>
</tr>
</tbody></table>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 모듈 사이의 인터페이스, 통합된 컴포넌트 간의 상호작용을 테스트하는 것으로, 하나의 프로세스가 완성된 경우 부분적으로 통합 테스트를 수행하는 테스트를 의미한다. 테스트 방식으로는 상향식, 하향식, 빅뱅 등이 있는 테스트 방식을 무엇이라고 하는지 쓰시오</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong>통합 테스트</strong></span></li>
</ul>
<p><strong>2) 일반적으로 최종 테스트를 수행함으로써 개발된 제품에 대해 운영 여부를 결정하는 테스트를 무엇이라고 하는지 쓰시오.</strong></p>
<ul>
<li>답 : <span style="color: blue"><strong>인수 테스트</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-3--테스트-케이스와-테스트-오라클">🍀 Section 3 | 테스트 케이스와 테스트 오라클</h2>
<h3 id="1-테스트-케이스">1. 테스트 케이스</h3>
<ul>
<li><strong>명세</strong> 기반 테스트의 설계 산출물</li>
<li>특정한 프로그램의 일부분 또는 경로에 따라 수행하거나, 특정한 요구사항을 준수하는지 확인하기 위해 설계된 입력값, 실행 조건, 기대 결과로 구성된 <strong>테스트 항목의 명세서</strong></li>
</ul>
<blockquote>
<p>💡 <strong>테스트 케이스 작성 절차(계내요테4)</strong></p>
</blockquote>
<ol>
<li><strong>계</strong>획 검토 및 참조 문서 수집</li>
<li><strong>내</strong>부 검토 및 우선순위 결정</li>
<li><strong>요</strong>구사항 정의</li>
<li><strong>테</strong>스트 설계와 방법 결정</li>
<li><strong>테</strong>스트 케이스 정의</li>
<li><strong>테</strong>스트 케이스 타당성 확인 및 유지보수</li>
<li><strong>테</strong>스트 수행</li>
</ol>
<h3 id="2-테스트-오라클">2. 테스트 오라클</h3>
<blockquote>
<p>테스트의 결과가 <strong>참인지 거짓인지</strong>를 판단하기 위해서 <strong>사전에 정의된 참 값을 입력</strong>하여 비교하는 기법 및 활동</p>
</blockquote>
<table>
<thead>
<tr>
<th align="center">테스트 오라클 유형</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>참 오라클</strong></td>
<td align="center">모든 입력값의 기대 결과를 생성해서 발생된 오류를 모두 검출</td>
</tr>
<tr>
<td align="center"><strong>샘플링 오라클</strong></td>
<td align="center">특정한 입력값들에 대해서만 기대하는 결과 제공</td>
</tr>
<tr>
<td align="center"><strong>휴리스틱(추정) 오라클</strong></td>
<td align="center"><strong>샘플링 오라클을 개선</strong>한 오라클, 특정 입력값에 대해 올바른 결과를 제공하고 나머지 값들에 대해서 휴리스틱(추정)으로 처리</td>
</tr>
<tr>
<td align="center"><strong>일관성 검사 오라클</strong></td>
<td align="center">애플리케이션 변경이 있을 때, 수행 전과 후의 결과값이 동일한지 확인</td>
</tr>
</tbody></table>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 다음 보기에서 설명하는 용어를 작성하시오.</strong></p>
<blockquote>
</blockquote>
<p>특정 프로그램 경로를 실행하거나 검증하는 것과 같이 목표를 달성하기 위한 테스트를 정의하는 항목에 대한 명세 기반 테스트의 산출물이다.</p>
<ul>
<li>답 : <span style="color: blue"><strong>테스트 케이스</strong></span></li>
</ul>
<p><strong>2) 다음 빈칸에 들어가는 테스트 케이스의 작성 절차를 작성하시오.</strong></p>
<table>
<thead>
<tr>
<th align="center"><strong>테스트 케이스 작성 절차</strong></th>
</tr>
</thead>
<tbody><tr>
<td align="center">계획 검토 및 참조 문서 수집</td>
</tr>
<tr>
<td align="center">내무 검토 및 우선순위 결정</td>
</tr>
<tr>
<td align="center">(  ?  )</td>
</tr>
<tr>
<td align="center">테스트 설계와 방법 결정</td>
</tr>
<tr>
<td align="center">테스트 케이스 설계</td>
</tr>
<tr>
<td align="center">테스트 케이스 타당성 확인 및 유지보수</td>
</tr>
<tr>
<td align="center">테스트 수행</td>
</tr>
</tbody></table>
<ul>
<li>답 : <span style="color: blue"><strong>요구사항 정의</strong></span></li>
</ul>
<p><strong>3) 다음 설명하는 테스트 오라클의 유형을 작성하시오.</strong></p>
<blockquote>
</blockquote>
<p>특정한 입력값들에 대해서만 기대하는 결과를 제공하는 샘플링 오라클을 개선한 오라클이며, 특정 입력값에 대해 올바를 결과를 제공하고 나머지는 기대값으로 처리한다.</p>
<ul>
<li>답 : <span style="color: blue"><strong>휴리스틱(추정) 오라클</strong></span></li>
</ul>
<hr>
<h2 id="🍀-section-4--테스트-자동화">🍀 Section 4 | 테스트 자동화</h2>
<h3 id="1-배경">1. 배경</h3>
<ul>
<li><strong>소프트웨어 테스트</strong>는 소프트웨어 개발에 소요되는 총 시간과 비용의 절반 이상을 차지할 정도로 많은 자원이 투입되는 프로세스이다.</li>
<li>따라서 테스트의 정확성을 유지하면서 시간과 비용을 줄일 수 있는 <strong>자동화 도구</strong>가 중요하게 되었다.</li>
</ul>
<h3 id="2-테스트-자동화">2. 테스트 자동화</h3>
<p><strong>1) 테스트 자동화의 개념</strong></p>
<blockquote>
<p>사람이 하던 반복적 테스트 절차를 자동화 도구를 활용하여 테스트하는 것</p>
</blockquote>
<ul>
<li>준비, 구현, 수행, 분석 등을 <strong>스크립트</strong> 형태로 구현함<ul>
<li><strong>테스트 시간</strong>과 <strong>입력 투입</strong>의 부담을 <strong>최소화</strong></li>
<li><strong>휴먼에러(Human Error)</strong>를 줄일 수 있다.</li>
</ul>
</li>
</ul>
<p><strong>2) 테스트 도구의 장점</strong></p>
<ul>
<li><strong>테스트 인력과 시간</strong>을 최소화<ul>
<li>테스트 데이터의 재입력과 재구성 같은 반복 작업의 자동화</li>
</ul>
</li>
<li>향상된 요구사항 정의, 성능 및스트레스 테스트, 품질 측정을 <strong>최적화</strong></li>
<li>빌드 확인, 회귀, 다중 플랫폼 호환성, 소프트웨어 구성, 기본 테스트 등의 <strong>향상된 테스트 품질</strong> 보장</li>
</ul>
<p><strong>3) 테스트 도구의 단점</strong></p>
<ul>
<li>전문가 양성 또는 고용이 필요하다.</li>
<li>초기에 프로세스 적용에 대한 시간, 비용, 노력에 대한 투자가 필요하다.</li>
</ul>
<p><strong>4) 테스트 자동화 수행 시 고려사항</strong></p>
<ul>
<li>테스트 절차를 고려하여 재사용 및 측정이 불가능한 테스트 프로그램은 제외해야 한다.</li>
<li>설계 기준을 고려하여 반복적인 빌드에서 스크립트 재사용성이 가능해야 한다.</li>
<li>도구의 한계성으로 모든 수동 테스트 과정을 자동화 할 수 있는 도구는 없으므로, 용도에 맞는 적절한 도구 사용이 필요하다.</li>
</ul>
<h3 id="3-테스트-도구의-평가-방법-및-요소">3. 테스트 도구의 평가 방법 및 요소</h3>
<table>
<thead>
<tr>
<th align="center">테스트 활동</th>
<th align="center">테스트 도구</th>
<th align="center">내용</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>테스트 계획</strong></td>
<td align="center"><strong>요구사항 관리</strong></td>
<td align="center">고객 요구사항 정의 및 변경 사항 관리</td>
</tr>
<tr>
<td align="center"><strong>테스트 분석/설계</strong></td>
<td align="center"><strong>테스트 케이스 생성</strong></td>
<td align="center">테스트 기법에 따른 테스트 데이터 및 케이스 작성</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>커버리지 분석</strong></td>
<td align="center">대상 시스템에 대한 테스트 완료 범위의 척도</td>
</tr>
<tr>
<td align="center"><strong>테스트 수행</strong></td>
<td align="center"><strong>테스트 자동화</strong></td>
<td align="center">기능 테스트 등 테스트 도구를 활용하여 자동화를 통한 테스트의 효율성 재고</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>정적 분석</strong></td>
<td align="center">코딩 표준, 런타임 오류 등을 검증</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>동적 분석</strong></td>
<td align="center">대상 시스템 시뮬레이션을 통한 오류 검출</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>성능 테스트</strong></td>
<td align="center">가상 사용자를 인위적으로 생성하여 시스템 처리 능력 측정</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>모니터링</strong></td>
<td align="center">시스템 자원(CPU, Memory 등)의 상태 확인 및 분석 지원 도구</td>
</tr>
<tr>
<td align="center"><strong>테스트 통제</strong></td>
<td align="center"><strong>형상 관리</strong></td>
<td align="center">테스트 수행에 필요한 다양한 도구 및데이터 관리</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>테스트 관리</strong></td>
<td align="center">전반적인 테스트 계획 및 활동에 대한 관리</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>결함 추적/관리</strong></td>
<td align="center">테스트에서 발생한 결함 관리 및 협업 지원</td>
</tr>
</tbody></table>
<h3 id="🚀-예상문제-3">🚀 예상문제</h3>
<p><strong>1) 다음 보기에서 나타내는 용어를 작성하시오.</strong></p>
<blockquote>
<p>인간이 일으키는 사고로 정의할 수 있으며, 테스트 자동화를 통하여 이 오류 및 테스트 시간과 인력투입의 부담감을 줄일 수 있고 보다 정밀한 테스트가 가능하다.</p>
</blockquote>
<ul>
<li>답 : <span style="color: blue"><strong>휴먼 에러(Human Error)</strong></span></li>
</ul>
<p><strong>2) 다음 중 테스트 자동화 수행 시의 고려사항으로 올바르지 않은 것을 모두 골라 쓰시오.</strong></p>
<p>ㄱ. 불완전한 테스트를 초래할 수 있기 때문에, 프로젝트 초기에 적절한 투입 시기와 계획을 수립해야 한다.
ㄴ. 도구의 한계성으로 인해 용도에 맞는 적절한 도구를 사용하여야 한다.
ㄷ. 테스트 절차를 고려하여 재사용 및 불가능한 테스트 프로그램도 포함하여야 한다.
ㄹ. 설계 기준을 고려하여 반복적인 빌드에서 스크립트 재사용성이 가능해야 한다.</p>
<ul>
<li>답 : <span style="color: blue"><strong>ㄷ</strong></span></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[1. 프로그래밍 언어 활용 : 프로그래밍 언어 활용]]></title>
            <link>https://velog.io/@xaexun_/2.-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%96%B8%EC%96%B4-%ED%99%9C%EC%9A%A9-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%96%B8%EC%96%B4-%ED%99%9C%EC%9A%A9</link>
            <guid>https://velog.io/@xaexun_/2.-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%96%B8%EC%96%B4-%ED%99%9C%EC%9A%A9-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%96%B8%EC%96%B4-%ED%99%9C%EC%9A%A9</guid>
            <pubDate>Fri, 06 Feb 2026 08:28:59 GMT</pubDate>
            <description><![CDATA[<h1 id="📍-chapter-2--프로그래밍-언어-활용">📍 Chapter 2 : 프로그래밍 언어 활용</h1>
<hr>
<h2 id="🍀-section-1--프로그래밍-언어-활용">🍀 Section 1 | 프로그래밍 언어 활용</h2>
<h3 id="1-프로그래밍-언어-활용의-개요">1. 프로그래밍 언어 활용의 개요</h3>
<blockquote>
<p>💡 <strong>프로그래밍 언어</strong></p>
</blockquote>
<ul>
<li><p>컴퓨터 시스템을 동작시키기 위한 프로그램 작성 언어</p>
</li>
<li><p>프로그램은 다소 단순해 보이는 <span style ="color: green"><strong>명령어들의 조합</strong></span>들로 구성된다.</p>
</li>
<li><p><span style ="color: green"><strong>명령어들의 조합</strong></span>들은 <span style ="color: green"><strong>비트(Bit)</strong></span>라고 불리는 <strong>0과 1의 값</strong>으로 작성되거나 변환되어 컴퓨터가 이해할 수 있게 한다.</p>
</li>
</ul>
<p><strong>1) 비트(Bit)</strong></p>
<ul>
<li><strong>컴퓨터</strong>가 이해할 수 있는 가장 기본적인 용어로, <strong>Binary Digit</strong>의 약칭이다.</li>
<li>0과 1로만 구성된 이진법을 이용한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">단위</th>
<th align="center">값</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>바이트</strong></td>
<td align="center">1 Byte(B) = 8 bit</td>
</tr>
<tr>
<td align="center"><strong>킬로바이트</strong></td>
<td align="center">1 Kilobyte(KB) = 8,192 bit</td>
</tr>
<tr>
<td align="center"><strong>메가바이트</strong></td>
<td align="center">1 Megabyte(MB) = 8,388,608 bit</td>
</tr>
<tr>
<td align="center"><strong>기가바이트</strong></td>
<td align="center">1 Gigabyte(GB) = 8.5899e+9 bit</td>
</tr>
<tr>
<td align="center"><strong>테라바이트</strong></td>
<td align="center">1 Terabyte(TB) = 8.7961e+12 bit</td>
</tr>
<tr>
<td align="center"><strong>페타바이트</strong></td>
<td align="center">1 Petabyte(PB) = 9.0072e+15 bit</td>
</tr>
<tr>
<td align="center"><strong>엑사바이트</strong></td>
<td align="center">1 Exabyte(EB) = 9.2234e+18 bit</td>
</tr>
</tbody></table>
<p><strong>2) 컴퓨터 시스템의 구조</strong></p>
<ul>
<li>컴퓨터는 전달받은 0과 1의 값들을 정해진 순서대로 실행하며 그 과정에서 <span style ="color: green"><strong>처리(Processing)</strong></span>, <span style ="color: green"><strong>저장(Store)</strong></span> 등을 수행한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">시스템</th>
<th align="center">하는 일</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>중앙처리장치(CPU)</strong></td>
<td align="center">프로그램 실행 및 데이터 처리</td>
</tr>
<tr>
<td align="center"><strong>기억장치(Memory)</strong></td>
<td align="center">저장</td>
</tr>
<tr>
<td align="center"><strong>입출력장치(I/O Device)</strong></td>
<td align="center">중앙처리장치로부터 명령을 받아 데이터를 입력 또는 출력</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>컴퓨터 구조(CPU 파이프라인)에서 명령어를 처리하는 5단계</strong></p>
</blockquote>
<table>
<thead>
<tr>
<th align="center">단계</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>IF</strong>, <strong>I</strong>nstruction <strong>F</strong>etch</td>
<td align="center"><strong>명령어 인출</strong>, 메모리에서 명령어를 가져오는 단계</td>
</tr>
<tr>
<td align="center"><strong>ID</strong>, <strong>I</strong>nstruction <strong>D</strong>ecode</td>
<td align="center"><strong>명령어 해독</strong>, 명령어를 해석하고 레지스터 파일을 읽는 단계</td>
</tr>
<tr>
<td align="center"><strong>EX</strong>, <strong>Ex</strong>cute</td>
<td align="center"><strong>실행</strong>, 산술논리장치(ALU)를 이용한 연산 및 주소 계산 단계</td>
</tr>
<tr>
<td align="center"><strong>MEM</strong>, <strong>Mem</strong>ory</td>
<td align="center"><strong>메모리 접근</strong>, 메모리에서 데이터를 읽거나 쓰는 단계</td>
</tr>
<tr>
<td align="center"><strong>WB</strong>, <strong>W</strong>rite <strong>B</strong>ack</td>
<td align="center"><strong>쓰기</strong>, 연산 결과를 레지스터에 기록하는 마지막 단계</td>
</tr>
</tbody></table>
<h3 id="2-프로그래밍-언어의-기본-문법-및-용어">2. 프로그래밍 언어의 기본 문법 및 용어</h3>
<p><strong>1) 프로그래밍 기본 용어</strong></p>
<table>
<thead>
<tr>
<th align="center">용어</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>변수</strong></td>
<td align="center">어떤 값을 주기억장치에 기억하기 위해서 사용하는 <strong>공간</strong></td>
</tr>
<tr>
<td align="center"><strong>식별자</strong></td>
<td align="center">프로그램의 <strong>구성요소</strong>를 구별하기 위한 기준. <strong>변수명</strong>이 식별자에 속한다.</td>
</tr>
<tr>
<td align="center"><strong>할당</strong></td>
<td align="center"><strong>변수</strong>에 메모리 공간을 <strong>바인딩</strong>하는 작업</td>
</tr>
<tr>
<td align="center"><strong>바인딩</strong></td>
<td align="center">변수와 변수에 관련된 속성을 <strong>연결</strong>하는 과정. 정적 바인딩과 동적 바인딩으로 구분된다.</td>
</tr>
<tr>
<td align="center"><strong>정적(Static) 바인딩</strong></td>
<td align="center"><strong>프로그램 실행 시간 전에</strong> 속성을 연결하는 방식</td>
</tr>
<tr>
<td align="center"><strong>동적(Dynamic) 바인딩</strong></td>
<td align="center"><strong>프로그램 실행 시간에</strong> 속성을 연결하는 방식</td>
</tr>
<tr>
<td align="center"><strong>데이터 타입</strong></td>
<td align="center">변수가 가질 수 있는 <strong>속성값의 길이 및 성질</strong></td>
</tr>
<tr>
<td align="center"><strong>선언</strong></td>
<td align="center">변수에 이름, 데이터 타입 등의 속성을 부여하는 작업. 명시적 선언과 묵시적 선언으로 구분된다.</td>
</tr>
<tr>
<td align="center"><strong>명시적 선언</strong></td>
<td align="center"><strong>선언문</strong>을 이용하며 변수 이름을 나열하고 속성을 부여하는 방식</td>
</tr>
<tr>
<td align="center"><strong>묵시적 선언</strong></td>
<td align="center">별도의 선언문 없이 <strong>디폴트 규칙</strong>에 의해 속성을 부여하는 방식</td>
</tr>
<tr>
<td align="center"><strong>영역</strong></td>
<td align="center">이름이 사용되는 범위. 정적 영역과 동적 영역으로 구분된다.</td>
</tr>
<tr>
<td align="center"><strong>정적 영역</strong></td>
<td align="center">변수를 찾을 때 <strong>구조에 기반</strong>하는 방식</td>
</tr>
<tr>
<td align="center"><strong>동적 영역</strong></td>
<td align="center">변수를 찾을 때 구조보다는 <strong>순서에 기반</strong>하는 방식</td>
</tr>
<tr>
<td align="center"><strong>연산자</strong></td>
<td align="center">데이터 처리를 위해 연산을 표현하는 <strong>기호</strong>. <strong><code>+</code></strong>, <strong><code>-</code></strong> 등과 같은 연산자를 포함한다.</td>
</tr>
<tr>
<td align="center"><strong>명령문</strong></td>
<td align="center">프로그램을 구성하는 <strong>문장</strong>. 지시 사항을 처리하는 단위</td>
</tr>
</tbody></table>
<p><strong>2) 변수와 데이터 타입</strong></p>
<p><span style ="color: blue"><strong>2-1) 변수</strong></span></p>
<ul>
<li>저장하고자 하는 어떠한 값이 있을 때, 그 값을 <strong>주기억장치</strong>에 기억하기 위한 공간을 의미</li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/54c676bf-0cf8-40aa-917d-8eefa75c19f8/image.png" alt=""></p>
<p><span style ="color: blue"><strong>2-2) 변수 선언 규칙</strong></span></p>
<ul>
<li>영문 대문자/소문자(대소문자 구분), 숫자, 밑줄(_) 사용이 가능하다.</li>
<li>첫 번째 자리는 숫자로 시작할 수 없다.</li>
<li>변수 이름의 중간에는 공백을 사용할 수 없다.</li>
<li>이미 사용되고 있는 예약어(키워드)는 변수로 사용할 수 없다.</li>
</ul>
<p><span style ="color: blue"><strong>2-3) 데이터 타입</strong></span></p>
<ul>
<li>변수에 들어갈 값의 특성을 구분하여 그 특성에 맞게 저장할 수 있도록 하는 데이터 속성값의 길이 및 성질을 의미한다.</li>
</ul>
<p><span style ="color: blue"><strong>2-4) 데이터 타입 유형</strong></span></p>
<ul>
<li>프로그래밍 언어에 따라 데이터 타입의 유형을 구분하는 기준에 차이가 있다.</li>
<li>일반적으로 아래와 같은 유형으로 나눈다.</li>
</ul>
<blockquote>
<p>💡 <strong>불린(Boolean) 타입</strong></p>
</blockquote>
<ul>
<li>참과 거짓을 의미하는 데이터 타입</li>
<li>True(참)과 False(거짓) 두 가지의 값을 가지고 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>문자(Character) 타입</strong></p>
</blockquote>
<ul>
<li>문자 하나를 저장할 때 사용한다.
<code>char a = &#39;A&#39;;</code></li>
</ul>
<blockquote>
<p>💡 <strong>문자열(String) 타입</strong></p>
</blockquote>
<ul>
<li>문자열을 저장할 때 사용한다.
<code>string a = &quot;Hello World&quot;;</code></li>
</ul>
<blockquote>
<p>💡 <strong>정수(Integer) 타입</strong></p>
</blockquote>
<ul>
<li>정수값을 저장하고자 할 때 사용한다.</li>
<li>Java와 C/C++의 정수 타입은 다음의 표와 같다.</li>
</ul>
<p><strong>☕️ Java</strong></p>
<table>
<thead>
<tr>
<th align="center">타입</th>
<th align="center">크기</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>byte</strong></td>
<td align="center">1 byte</td>
</tr>
<tr>
<td align="center"><strong>short</strong></td>
<td align="center">2 byte</td>
</tr>
<tr>
<td align="center"><strong>int</strong></td>
<td align="center">4 byte</td>
</tr>
<tr>
<td align="center"><strong>long</strong></td>
<td align="center">8 byte</td>
</tr>
</tbody></table>
<p><strong>🌐 C/C++</strong></p>
<table>
<thead>
<tr>
<th align="center">타입</th>
<th align="center">크기</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>short</strong></td>
<td align="center">2 byte</td>
</tr>
<tr>
<td align="center"><strong>unsigned short</strong></td>
<td align="center">2 byte</td>
</tr>
<tr>
<td align="center"><strong>int</strong></td>
<td align="center">2 byte(16-bit System), 4 byte(32-bit System)</td>
</tr>
<tr>
<td align="center"><strong>unsigned int</strong></td>
<td align="center">2 byte(16-bit System), 4 byte(32-bit System)</td>
</tr>
<tr>
<td align="center"><strong>long</strong></td>
<td align="center">4 byte</td>
</tr>
<tr>
<td align="center"><strong>unsigned long</strong></td>
<td align="center">4 byte</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>부동 소수점 타입</strong></p>
</blockquote>
<ul>
<li><strong>소수점을 포함하는 실수값</strong>을 저장하고자 할 때 사용한다.</li>
</ul>
<blockquote>
<p>💡 <strong>배열(Array) 타입</strong></p>
</blockquote>
<ul>
<li>여러 데이터를 하나로 묶어서 자정하고자 할 때 사용한다.</li>
<li><strong>C언어</strong>에서는 배열의 공간(크기)을 선언하고, <strong>Java</strong>에서는 비워둔다.<pre><code class="language-c">// C언어 정수형 배열 선언
Array [5] = {1, 2, 3, 4, 5};</code></pre>
<pre><code class="language-java">// Java 정수형 배열 선언
Array [] = {1, 2, 3, 4, 5};</code></pre>
</li>
</ul>
<blockquote>
<p>💡 <strong>예제 1</strong>
다음의 출력 결과를 작성하시오.</p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
  main(void) {
      int num = 4;
    char str = &#39;a&#39;;
    printf(&quot;%d&quot;, sizeof(num) + sizeof(str));
  }</code></pre>
<p>풀이 방식</p>
<ul>
<li>변수 <code>num</code>의 타입은 <code>int</code> 이고, <code>int</code>의 바이트 크기는 <code>4</code></li>
<li>변수 <code>str</code>의 타입은 <code>char</code> 이고, <code>char</code>의 바이트 크기는 <code>1</code></li>
<li>답은 <code>5</code></li>
</ul>
<blockquote>
<p>💡 <strong>예제 2</strong>
다음의 출력 결과를 작성하시오.</p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
  main(void) {
      int num1[4] = {1, 2, 3};
    int num2[2] = {9, 9};
    printf(&quot;크기 = %d&quot;, sizeof(num1) + sizeof(num1));
  }</code></pre>
<p>풀이 방식</p>
<ul>
<li>변수 <code>num1</code>과 <code>num2</code>의 타입은 정수형 배열이다.</li>
<li><code>num1</code>의 바이트 크기는 <code>4(int) x 4 = 16</code> 이다.</li>
<li><code>num2</code>의 바이트 크기는 <code>4(int) x 2 = 8</code> 이다.</li>
<li>답은 <code>24</code></li>
</ul>
<p><span style ="color: blue"><strong>2-5) 서식 지정자</strong></span></p>
<ul>
<li>변수 혹은 값을 출력문을 통해 출력하기 위해 사용한다.</li>
<li>데이터를 입출력할 때 형식을 맞추는 문자</li>
</ul>
<table>
<thead>
<tr>
<th align="center">형태</th>
<th align="center">문자</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>정수형</strong></td>
<td align="center"><strong>%d</strong></td>
<td align="center">부호 <strong>있는</strong> 10진수 정수</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>%u</strong></td>
<td align="center">부호 <strong>없는</strong> 10진수 정수</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>%o</strong></td>
<td align="center">부호 <strong>없는</strong> 8진수 정수</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>%x</strong></td>
<td align="center">부호 <strong>없는</strong> 16진수 정수</td>
</tr>
<tr>
<td align="center"><strong>실수형</strong></td>
<td align="center"><strong>%f</strong></td>
<td align="center">소수점 6번째까지의 실수</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>%e</strong></td>
<td align="center">0.000000e+00, 실수 지수 표현</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>%g</strong></td>
<td align="center">%f 와 %e 둘중에 짧은 길이로 표현되는 서식 지정자를 사용</td>
</tr>
<tr>
<td align="center"><strong>문자형</strong></td>
<td align="center"><strong>%c</strong></td>
<td align="center">단일 문자 출력</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>%s</strong></td>
<td align="center">문자열 출력</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>예시 코드</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  char a = &quot;A&quot;;
  int num1 = 2000;
  float num2 = 1.23;
  printf(&quot;%c %d %d %f&quot;, a, a, num1, num2);
  // 출력 : c 65 2000 1.230000
  // 문자 A는 ASCII 코드로 65
  // A를 %d로 출력할 시 65 출력
  return 0;
}</code></pre>
<h3 id="3-연산자">3. 연산자</h3>
<ul>
<li>프로그램 실행을 위해 연산을 표현하는 기호</li>
<li>산술, 시프트, 관계, 논리, 비트, 증감, 복합 대입, 삼항이 있다.</li>
</ul>
<p><strong>1) 산술 연산자</strong></p>
<table>
<thead>
<tr>
<th align="center">종류</th>
<th align="center">설명</th>
<th align="center">우선순위</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><code>+</code></td>
<td align="center">양쪽의 값을 더한다.</td>
<td align="center">3</td>
</tr>
<tr>
<td align="center"><code>-</code></td>
<td align="center">왼쪽 값에서 오른쪽 값을 뺀다.</td>
<td align="center">3</td>
</tr>
<tr>
<td align="center"><code>*</code></td>
<td align="center">양쪽의 값을 곱한다.</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center"><code>/</code></td>
<td align="center">왼쪽 값에서 오른쪽 값을 나눈다.</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center"><code>%</code></td>
<td align="center">왼쪽 값에서 오른쪽 값을 나눈 나머지를 계산한다.</td>
<td align="center">2</td>
</tr>
</tbody></table>
<ul>
<li>우선순위 <code>1등</code>은 <code>괄호()</code> 이다.</li>
<li>수학과 동일한 연산자 우선순위를 따른다.</li>
</ul>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int result1, retult2;
  result1 = 10 + 15 % 4 - 20 % 9;
  result2 = 10 * 15 % 4 - 20 % 9 + 5;
  printf(&quot;%d %d&quot;, result1, result2);
  return 0;
}</code></pre>
<p>답 : 11 5</p>
<p><strong>2) 시프트 연산자</strong></p>
<ul>
<li>10진수의 값을 2진수로 변환하여 비트의 위치를 이동시키는 연산자이다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">종류</th>
<th align="center">설명</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><code>&lt;&lt;</code></td>
<td align="center">우측 값만큼 비트의 위치를 좌측으로 이동</td>
</tr>
<tr>
<td align="center"><code>&gt;&gt;</code></td>
<td align="center">우측 값만큼 비트의 위치를 우측으로 이동</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int num1, num2, result;
  num1 = 15;
  num2 = 4&#39;
  result = num1 &gt;&gt; 3 &lt;&lt; num2
  printf(&quot;%d&quot;, result);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li><code>15</code> : <code>0000 1111</code></li>
<li><code>15 &gt;&gt; 3</code> : <code>0000 0001</code></li>
<li><code>1 &lt;&lt; 4</code>  : <code>0001 0000</code></li>
<li><code>0001 0000</code> = <code>16</code></li>
<li>답 : <code>16</code></li>
</ul>
<p><strong>3) 관계 연산자</strong></p>
<ul>
<li>두 피연산자 사이의 크기를 비교하는 연산자이다.</li>
<li><code>True</code>와 <code>False</code>를 구분한다.</li>
</ul>
<blockquote>
</blockquote>
<ul>
<li><code>&gt;</code> : 초과 ⇒ <code>printf(&quot;%d&quot;, 10 &gt; 3); // 결과 : 1(True)</code></li>
<li><code>&lt;</code> : 미만 ⇒ <code>printf(&quot;%d&quot;, 10 &lt; 3); // 결과 : 0(False)</code></li>
<li><code>&gt;=</code> : 이상 ⇒ <code>printf(&quot;%d&quot;, 5 &gt;= 5); // 결과 : 1(True)</code></li>
<li><code>&lt;=</code> : 이하 ⇒ <code>printf(&quot;%d&quot;, 5 &lt;= 5); // 결과 : 1(True)</code></li>
<li><code>==</code> : 같다 ⇒ <code>printf(&quot;%d&quot;, 5 == 5); // 결과 : 1(True)</code></li>
<li><code>!=</code> : 다르다 ⇒ <code>printf(&quot;%d&quot;, 5 != 5); // 결과 : 0(False)</code></li>
</ul>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int num1 = 10;
  int num2 = 5;
  int num3 = 15;
  int num4 = 7;
  int result1, result2;
  result1 = num1 &gt; num2;
  result2 = num3 &lt; num4;
  printf(&quot;%d&quot;, result1 &lt; result2);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li><code>result1</code> : <code>10 &gt; 5</code> ⇒ <code>1(True)</code></li>
<li><code>result2</code> : <code>15 &lt; 7</code> ⇒ <code>0(False)</code></li>
<li><code>result1 &lt; result2</code> : <code>1 &lt; 0</code>  ⇒ <code>0(False)</code></li>
<li>답 : <code>0</code></li>
</ul>
<p><strong>4) 논리 연산자</strong></p>
<ul>
<li>두 피연산자 사이의 논리적인 관계를 정의하는 연산자이다.</li>
</ul>
<ol>
<li><code>&amp;&amp;(AND)</code> : 두 가지의 논리값이 모두 참일 때 <code>True</code>, 하나라도 거짓일 때 <code>False</code>를 반환한다. <code>10 &gt; 5 &amp;&amp; 5 &lt; 10</code> ⇒ <code>1(True)</code></li>
<li><code>||(OR)</code> : 두 가지의 논리값이 하나라도 참일 때 <code>True</code>, 하나라도 참일 때 <code>True</code>를 반환한다. <code>10 &gt; 5 || 5 &gt; 10</code> ⇒ <code>1(True)</code></li>
</ol>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int num1 = 7;
  int num2 = 22;
  int num3 = 4;
  int num4 = 9;
  printf(&quot;결과1 : %d\n&quot;, num1 &lt; num2 &amp;&amp; num3 &gt; num4);
  printf(&quot;결과2 : %d\n&quot;, num1 &gt; num2 || num3 &lt; num4);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li><code>num1 &lt; num2</code> : <code>7 &lt; 22</code> ⇒ <code>1(True)</code></li>
<li><code>num3 &gt; num4</code> : <code>4 &gt; 9</code> ⇒ <code>0(False)</code><ul>
<li><code>1(True) &amp;&amp; 0(False)</code> ⇒ <strong><code>0(False)</code></strong></li>
</ul>
</li>
<li><code>num1 &gt; num2</code> : <code>7 &gt; 22</code> ⇒ <code>0(False)</code></li>
<li><code>num3 &lt; num4</code> : <code>4 &lt; 9</code> ⇒ <code>1(True)</code><ul>
<li><code>0(False) || 1(True)</code> ⇒ <strong><code>1(True)</code></strong></li>
</ul>
</li>
<li>답<ul>
<li><code>결과1 : 0</code></li>
<li><code>결과2 : 1</code></li>
</ul>
</li>
</ul>
<p><strong>5) 비트 연산자</strong></p>
<ul>
<li>0과 1의 각 자리에 대한 연산을 수행한다. 0과 1의 결과값을 가진다.</li>
<li>보통 우리가 사용하는 단위를 10진수로 표현하고, 컴퓨터의 언어는 이진수로 표현한다.</li>
</ul>
<blockquote>
<p>💡 <strong>예시</strong></p>
</blockquote>
<ul>
<li><code>1</code> ⇒ <code>0000 0001</code></li>
<li><code>2</code> ⇒ <code>0000 0010</code></li>
<li><code>16</code> ⇒ <code>0001 0000</code></li>
<li><code>27</code> ⇒ <code>0001 1011</code></li>
<li><code>182</code> ⇒ <code>1011 0110</code></li>
</ul>
<ol>
<li><code>&amp;(AND)</code> : 두 값을 비트로 연산하여 모두 <code>참(True, 1)</code>이면 <code>참</code>을 반환, 하나라도 <code>거짓(False, 0)</code>이면 <code>거짓</code>을 반환한다.</li>
<li><code>|(OR)</code> : 두 값을 비트로 연산하여 하나라도 <code>참(True, 1)</code>이면 <code>참</code>을 반환, 모두 <code>거짓(False, 0)</code>이면 <code>거짓</code>을 반환한다.</li>
<li><code>^(XOR)</code> : 두 값을 비트로 연산하여 서로 다르면 <code>참</code>을 반환, 같으면 <code>거짓</code>을 반환한다.</li>
</ol>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int num1 = 37;
  int num2 = 13;
  int result1 = num1 &amp; num2;
  int result2 = num1 | num2;
  printf(&quot;result1 : %d\n&quot;, result1);
  printf(&quot;result2 : %d&quot;, result2);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li><code>num1 &amp; num2</code> : <code>0010 0101 &amp; 0000 1101</code> ⇒ <code>0000 0101</code> </li>
<li><code>num1 | num2</code> : <code>0010 0101 | 0000 1101</code> ⇒ <code>0010 1101</code></li>
<li><code>0000 0101</code> : <code>4 + 1 =</code><strong><code>5</code></strong></li>
<li><code>0010 1101</code> : <code>32 + 8 + 4 + 1 =</code><strong><code>45</code></strong></li>
<li>답<ul>
<li><code>result1 :</code><strong><code>5</code></strong></li>
<li><code>result2 :</code><strong><code>45</code></strong></li>
</ul>
</li>
</ul>
<p><strong>6) 증감 연산자</strong></p>
<ul>
<li>피연산자를 <strong>1씩</strong> <strong>증가</strong>시키거나 <strong>감소</strong>시킬 때 사용하는 연산자이다.</li>
<li>부호의 위치에 따라 <strong>전위 연산자</strong>와 <strong>후위 연산자</strong>로 구분된다.</li>
</ul>
<blockquote>
<p>💡 <strong>전위 연산자</strong></p>
</blockquote>
<ul>
<li>피연산자를 증감한 후, 해당 라인의 연산을 수행<pre><code class="language-c">int a = 5;
int b = 10;
printf(&quot;%d %d&quot;, ++a, --b) // 6 9
printf(&quot;%d %d&quot;, a, b) // 6 9</code></pre>
</li>
</ul>
<blockquote>
<p>💡 <strong>후위 연산자</strong></p>
</blockquote>
<ul>
<li>해당 라인의 연산을 수행한 후 피연산자를 증감<pre><code class="language-c">int a = 5;
int b = 10;
printf(&quot;%d %d&quot;, a++, b--) // 5 10
printf(&quot;%d %d&quot;, a, b) // 6 9</code></pre>
</li>
</ul>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int x = 7;
  int y = 7;
  int result = ++x + y--;
  printf(&quot;결과 : %d %d %d&quot;, result, x, y);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li>전위 연산자로 먼저 더하고, 후위 연산자로 행을 먼저 실행한 뒤 나중에 뺀다.</li>
<li><code>result = ++x + y--</code> : <code>result = 8 + 7 =</code><strong><code>15</code></strong></li>
<li>답<ul>
<li><code>결과 :</code><strong><code>15 8 6</code></strong></li>
</ul>
</li>
</ul>
<p><strong>7) 복합 대입 연산자</strong></p>
<ul>
<li>산술 연산자와 대입(<code>=</code>) 연산자를 간결하게 사용하는 작업이다.</li>
</ul>
<blockquote>
</blockquote>
<ul>
<li><code>+=</code> : <code>a += 2</code> ⇒ <code>a = a + 2</code></li>
<li><code>-=</code> : <code>a -= 2</code> ⇒ <code>a = a - 2</code></li>
<li><code>*=</code> : <code>a *= 2</code> ⇒ <code>a = a * 2</code></li>
<li><code>/=</code> : <code>a /= 2</code> ⇒ <code>a = a / 2</code></li>
<li><code>%=</code> : <code>a %= 2</code> ⇒ <code>a = a % 2</code></li>
</ul>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
main(void) {
  int num = 13;
  num += 1;
  num -= 2;
  num *= 3;
  num /= 4;
  num %= 5;
  printf(&quot;결과 : %d&quot;, num);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li><code>num</code> = <code>13 + 1</code> = <strong><code>14</code></strong></li>
<li><code>num</code> = <code>14 - 2</code> = <strong><code>12</code></strong></li>
<li><code>num</code> = <code>12 * 3</code> = <strong><code>36</code></strong></li>
<li><code>num</code> = <code>36 / 4</code> = <strong><code>9</code></strong></li>
<li><code>num</code> = <code>9 % 5</code> = <strong><code>4</code></strong></li>
<li>답<ul>
<li><code>결과 :</code><strong><code>4</code></strong></li>
</ul>
</li>
</ul>
<p><strong>8) 삼항 연산자</strong></p>
<ul>
<li>조건이 부합할 경우, True와 False에 해당하는 값을 출력하는 연산자이다.</li>
</ul>
<blockquote>
<p>💡 <strong>구문</strong></p>
</blockquote>
<pre><code class="language-c">조건 ? True : False
// ? = 조건과 결과 구분
// : = 참과 거짓 구분</code></pre>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt; 
main(void) {
  int a = 10;
  int b = 3;
  char result;
  result = a &gt; b ? &#39;A&#39; : &#39;B&#39;;
  printf(&quot;result : %c&quot;, result);
  return 0;
}</code></pre>
<p>풀이방식</p>
<ul>
<li><code>a &gt; b</code>이 <strong><code>True</code></strong>인 경우 <strong><code>A</code></strong> 출력</li>
<li><code>a &gt; b</code>이 <strong><code>False</code></strong>인 경우 <strong><code>B</code></strong> 출력</li>
<li><code>a &gt; b</code> = <code>10 &gt; 3</code> = <strong><code>True</code></strong></li>
<li>답<ul>
<li><code>result :</code><strong><code>A</code></strong></li>
</ul>
</li>
</ul>
<p><strong>9) 진법 입력 및 출력 연산자</strong></p>
<ul>
<li>프로그래밍에서 기본적으로 10진법 형태의 숫자를 사용하지만, 다른 진법으로 표현하면 다음과 같다.</li>
<li>예시 값으로 10진수 134를 넣었다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">구분</th>
<th align="center">C</th>
<th align="center">Python</th>
<th align="center">Java</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>입력</strong></td>
<td align="center">2진법 = 0b10000110</td>
<td align="center">2진법 = 0b</td>
<td align="center">2진법 = Integer.valueOf(int, 2)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">8진법 = 0</td>
<td align="center">8진법 = 0o</td>
<td align="center">8진법 = Integer.valueOf(int, 8)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">16진법 = 0x</td>
<td align="center">16진법 = 0x</td>
<td align="center">16진법 = Integer.valueOf(int, 16)</td>
</tr>
<tr>
<td align="center"><strong>출력</strong></td>
<td align="center">10진법 = %d</td>
<td align="center">2진법 = bin()</td>
<td align="center">2진법 = Integer.toBinaryStrubg(int)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">8진법 = %o</td>
<td align="center">8진법 = oct()</td>
<td align="center">8진법 = Integer.toOctalString(int)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">16진법 = %x</td>
<td align="center">16진법 = hex()</td>
<td align="center">16진법 = Integer.HexString(int)</td>
</tr>
<tr>
<td align="center"><strong>결과</strong></td>
<td align="center">10진법 = 134</td>
<td align="center">2진법 = 0b10000110</td>
<td align="center">2진법 = 10000110</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">8진법 = 206</td>
<td align="center">8진법 = 0o206</td>
<td align="center">8진법 = 206</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">16진법 = 86</td>
<td align="center">16진법 = 0x86</td>
<td align="center">16진법 = 86</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>예제</strong></p>
</blockquote>
<pre><code class="language-c">// C
#include &lt;stdio.h&gt;
main(void) {
  int num = 0b11010;
  printf(&quot;10진수 : %d\n&quot;, num);
  printf(&quot;8진수 : %o\n&quot;, num);
  printf(&quot;16진수 : %x&quot;, num);
  return 0;
}</code></pre>
<p>풀이방식 및 답</p>
<ul>
<li><strong><code>10진수</code></strong> : <code>0b11010</code> = <code>16 + 8 + 2</code> = <strong><code>26</code></strong></li>
<li><strong><code>8진수</code></strong> : <code>26</code> = <code>3(8x3) + 2(2)</code> = <strong><code>32</code></strong></li>
<li><strong><code>16진수</code></strong> : <code>26</code> = <code>1(16x1) + A(10)</code> = <strong><code>1A</code></strong><pre><code class="language-python"># Python
num = 30
b = bin(num)
o = oct(num)
h = hex(num)
print(b)
print(o)
print(h)</code></pre>
풀이방식 및 답</li>
<li><strong><code>2진수</code></strong> : <code>30</code> = <code>1(16) + 1(8) + 1(4) + 1(2) + 0(1)</code> = <strong><code>0b11110</code></strong></li>
<li><strong><code>8진수</code></strong> : <code>30</code> = <code>3(8x3) + 6(6)</code> = <strong><code>0x36</code></strong></li>
<li><strong><code>16진수</code></strong> : <code>30</code> = <code>1(16x1) + E(14)</code> = <strong><code>ox1E</code></strong><pre><code class="language-java">// Java
public static void main(String[] args) {
int i = 100;
String b = Integer.toBinaryString(i)
String o = Integer.toOctalString(i)
String h = Integer.toHexString(i)
System.out.println(b)
System.out.println(o)
System.out.println(h)
}</code></pre>
풀이방식 및 답</li>
<li><strong><code>2진수</code></strong> : <code>100</code> = <code>1(64) + 1(32) + 0(16) + 0(8) + 1(4) + 0(2) + 0(1)</code> = <strong><code>1100100</code></strong></li>
<li><strong><code>8진수</code></strong> : <code>100</code> = <code>1(64x1) + 4(8x4) + 4(4)</code> = <strong><code>144</code></strong></li>
<li><strong><code>16진수</code></strong> : <code>100</code> = <code>6(16x6) + 4(4)</code> = <strong><code>64</code></strong></li>
</ul>
<h3 id="4-명령문">4. 명령문</h3>
<ul>
<li>프로그램으리 구성하는 문자. 지시 사항을 처리하는 단위이다.</li>
<li>기본적은 문법들의 종류가 많은 것은 아니며, 각 언어마다 유사한 문법 체계를 사용한다.</li>
</ul>
<p><strong>1) 조건문</strong></p>
<ul>
<li>조건의 참, 거짓 여부에 따라 실행 경로를 달리하는 <strong><code>if</code></strong>문과 여러 경로 중에 하나를 선택하는 <strong><code>switch case</code></strong>문으로 구분한다.</li>
</ul>
<p><span style ="color: blue"><strong>1-1) <code>if, if-else</code> 문</strong></span></p>
<ul>
<li><code>FORTRAN</code> 에서 처음 사용하였으며, 현재 대다수의 프로그래밍 언어에서 기본 명령문으로 사용한다.</li>
<li>단순 <strong><code>if</code></strong> 문, 선택 <strong><code>if</code></strong> 문, 중첩<strong><code>if</code></strong> 문의 유형으로 구분된다. <pre><code class="language-java">// C &amp; Java
if ( 조건 ) {
실행문;
} else if ( 조건 ) {
실행문;
} else {
실행문;
}</code></pre>
<pre><code class="language-python"># Python
if 조건:
명령;
elif 조건:
명령;
else:
명령;</code></pre>
</li>
</ul>
<blockquote>
<p>💡 <strong>예제 (if, if-else)</strong></p>
</blockquote>
<pre><code class="language-c">void main() {
  int num = 3;
  if ( num &gt;= 5 ) {
    printf(&quot;Hello&quot;);
  } else if ( num &gt;= 3 ) {
    printf(&quot;World&quot;);
  } else {
    printf(&quot;JaeJae&quot;);
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li><code>num &gt;= 5</code> = <code>3 &gt;= 5</code>, <strong>False</strong> ⇒ 실행문 PASS</li>
<li><code>num &gt;= 3</code> = <code>3 &gt;= 3</code>, <strong>True</strong> ⇒ <strong>실행문 실행</strong><ul>
<li>참이 나온 이후 모든 조건 <strong>PASS</strong></li>
</ul>
</li>
<li>답<ul>
<li><strong><code>World</code></strong></li>
</ul>
</li>
</ul>
<p><span style ="color: blue"><strong>1-2) <code>switch case</code> 문</strong></span></p>
<ul>
<li>처음에만 조건이 동일한 <code>case</code> 문으로 간다.</li>
<li>따라서, <code>break</code> 가 없다면 처음에만 조건을 따지고, 이후에 나머지 <code>case</code>를 실행한다.<pre><code class="language-java">// C &amp; Java
switch(변수) {
case 값:
}
실행문;
}</code></pre>
<pre><code class="language-python"># Python
파이썬은 switch case문이 없지롱</code></pre>
</li>
</ul>
<blockquote>
<p>💡 <strong>예제 1 (switch case)</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
int main() {
  int num = 1;
  switch(num) {
    case 1:
      printf(&quot;%d\n&quot;, num + 2);
      break;
    case 2:
      printf(&quot;%d\n&quot;, num + 1);
      break;
    case 3:
      printf(&quot;%d\n&quot;, num + 3);
      break;
    default:
      printf(&quot;%d\n&quot;, num);
      break;
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li><strong><code>num = 1</code></strong> ⇒ <strong><code>case 1</code></strong></li>
<li><code>num + 2 = 1 + 2 =</code><strong><code>3</code></strong></li>
<li><strong><code>break</code></strong> 로 조건문 탈출</li>
<li>답<ul>
<li><strong><code>3</code></strong></li>
</ul>
</li>
</ul>
<blockquote>
<p>💡 <strong>예제 2 (switch case)</strong></p>
</blockquote>
<pre><code class="language-c">#include &lt;stdio.h&gt;
int main() {
  int num = 1;
  switch(num) {
    case 1:
      printf(&quot;%d\n&quot;, num + 2);
    case 2:
      printf(&quot;%d\n&quot;, num + 1);
    case 3:
      printf(&quot;%d\n&quot;, num + 3);
    default:
      printf(&quot;%d\n&quot;, num);
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li><strong><code>break</code></strong> 가 없어서 <strong>모든 <code>case</code> 실행</strong></li>
<li><strong><code>num = 1</code></strong> ⇒ <strong><code>case 1</code></strong></li>
<li><code>num + 2 = 1 + 2 =</code><strong><code>3</code></strong></li>
<li><code>num + 1 = 1 + 1 =</code><strong><code>2</code></strong></li>
<li><code>num + 3 = 1 + 3 =</code><strong><code>4</code></strong></li>
<li><code>default =</code><strong><code>1</code></strong></li>
<li>답<ul>
<li><strong><code>3</code></strong></li>
<li><strong><code>2</code></strong></li>
<li><strong><code>4</code></strong></li>
<li><strong><code>1</code></strong></li>
</ul>
</li>
</ul>
<p><strong>2) 반복문</strong></p>
<ul>
<li>조건이 만족될 때까지 실행문을 반복적으로 실행하는 명령문</li>
<li><strong><code>while</code></strong>, <strong><code>for</code></strong>, <strong><code>do-while</code></strong> 문이 있다.</li>
</ul>
<blockquote>
<p>💡 <strong>반복문</strong></p>
</blockquote>
<pre><code class="language-java">for( 초기값; 조건문; 증감문) {
  실행문;
}
// 초기값을 증감하여 조건문을 만족할 때까지 실행문을 반복적으로 실행한다.</code></pre>
<pre><code class="language-java">while(조건문) {
  실행문;
}
// 조건문이 만족될 때까지 또는 break로 탈출할 때까지 실행문을 반복적으로 실행한다.</code></pre>
<pre><code class="language-java">do {
  실행문;
} while(조건문);
// 조건과 맞지 않더라도 일단 한 번은 실행하고 조건문을 따진다.
// 해당 조건문을 만족할 때까지 do 구문을 반복한다.</code></pre>
<p><strong>3) 제어문</strong></p>
<p><span style ="color: blue"><strong>3-1) <code>break, continue</code></strong></span></p>
<ul>
<li>일반적으로 특정 조건을 빠져나가기 위해 조건문 구문과 같이 사용하거나, 반복문 내에서 반복된 흐름을 벗어나기 위해 사용된다.</li>
</ul>
<p><strong><code>break</code></strong> : 해당 반복문을 멈추고, 탈출하는데 사용한다.
<strong><code>continue</code></strong> : 반복문을 유지하면서, 다음 반복으로 건너뛴다.</p>
<blockquote>
<p>💡 <strong>예문</strong></p>
</blockquote>
<pre><code class="language-java">for(int i = 5; i &gt;= 0; i--) {
  if( i % 2 == 0 ) {
    1) break; 
    2) continue;
  }
  printf(&quot;%d&quot;, i);
}</code></pre>
<ul>
<li>1)의 결과는 <strong><code>5</code></strong><ul>
<li><code>i = 5</code>일 때 <code>i % 2 == 0</code>의 조건을 만족하지 않으므로 <code>printf</code> 문 출력</li>
<li><code>i = 4</code>일 때 <code>i % 2 == 0</code>의 조건을 만족하므로 <code>break</code>, 반복문 탈출</li>
<li>실행 종료</li>
</ul>
</li>
<li>2)의 결과는 <strong><code>531</code></strong><ul>
<li><code>i = 4</code>일 때와 <code>i = 2</code>일 때 반복문은 유지하되 <code>printf</code> 문 뛰어넘음</li>
<li>따라서, <code>i</code> 가 <code>5</code>, <code>3</code>, <code>1</code> 일 때 <code>printf</code> 문  출력</li>
</ul>
</li>
</ul>
<p><span style ="color: blue"><strong>3-2) 함수(Java)</strong></span></p>
<ul>
<li>중복된 코드의 사용을 방지하기 위하여, 메서드를 만들어서 필요할 때마다 호출하여 반환하는 역할을 한다.</li>
</ul>
<blockquote>
<p>💡 <strong>구문</strong></p>
</blockquote>
<pre><code class="language-java">자료형 함수명(타입 변수1, 타입 변수2, ...) {
  실행문;
  return 반환할 값;
}</code></pre>
<p>여기서 <code>return</code> 에는 반환할 값을 넣기 때문에, <code>return</code> 값에 조건없이 <code>함수명</code>을 넣으면 <strong>무한 재귀</strong>가 될 수 있으니 조심하도록 하자.</p>
<blockquote>
<p>💡 <strong>예문</strong></p>
</blockquote>
<pre><code class="language-java">int addFunction(int num1, int num2) {
  int sum = 0;
  sum = num1 + num2;
  return sum;
}
int main() {
  int result = addFunction(1,2);
  printf(&quot;%d&quot;, result);
}</code></pre>
<ul>
<li><code>addFunction</code> 으로 <code>1</code>과 <code>2</code> 값을 인가함.</li>
<li>인가된 값으로 합연산을 한 뒤에 <code>return</code>의 반환값으로 넣는다.</li>
<li>해당 반환값을 <code>result</code>라는 정수형 변수에 대입하고 출력한다.</li>
<li><strong><code>3</code></strong></li>
</ul>
<h3 id="5-사용자-정의-자료형">5. 사용자 정의 자료형</h3>
<ul>
<li><strong><code>C/C</code>++</strong>,<strong><code>Java</code></strong> 와 같은 프로그래밍 언어에서는 사용자가 <strong>직접 자료형을 만드는 것</strong>이 가능하다.</li>
</ul>
<p><strong>1) 열거체</strong></p>
<ul>
<li>괄호 안에 연속적인 값이 들어가는 자료형이다.</li>
<li>변수에 초기값을 지정하지 않으면 0이 된다.</li>
<li>이후 변수가 추가될 때마다 1씩 증가한다.</li>
</ul>
<pre><code class="language-c">enum color {
  red,          // red = 0
  orange,       // orange = 1
  yellow=10,    // yellow = 10
  green,        // green = 11
}</code></pre>
<p><strong>2) 구조체</strong></p>
<ul>
<li>괄호 안에 <strong>멤버 변수</strong>를 사용하는 자료형이다.</li>
<li>구조체 내부에 멤버 변수의 자료형을 선언할 수 있고, 접근할 때는 <code>.</code>을 사용한다.</li>
</ul>
<pre><code class="language-c">#include &lt;stdio.h&gt;
struct Language {
  int kor;
  int eng;
  int mat;
};
int main() {
  struct Language lag;
  lag.kor = 100;
  lag.eng = 90;
  lag.mat = 80;
  printf(&quot;%d %d %d&quot;, lag.kor, lag.eng, lag.mat);
}</code></pre>
<p><strong>3) 공용체</strong></p>
<ul>
<li>구조체와 거의 유사하나 조금 더 범주가 크다고 볼 수 있다.</li>
<li>메모리 공간을 공유하며 크기를 작게 사용하므로 임베디드나 통신 분야에서 많이 사용된다.</li>
</ul>
<pre><code class="language-c">#include &lt;stdio.h&gt;
union School {
    int score;   // 점수용
    char grade;  // 등급용
};
int main() {
    union School sc;
    sc.score = 95;
    printf(&quot;점수: %d\n&quot;, ex.score);       // 1️⃣ 점수로 사용
    sc.grade = &#39;A&#39;;
    printf(&quot;등급: %c\n&quot;, ex.grade);       // 2️⃣ 같은 공간을 등급으로 해석
    printf(&quot;다시 점수: %d\n&quot;, lag.score);  // 3️⃣ 다시 점수로 보면?
    return 0;
}</code></pre>
<p>출력</p>
<pre><code>점수: 95
등급: A
다시 점수: 65</code></pre><h3 id="🚀-예상문제">🚀 예상문제</h3>
<p><strong>1) 다음 C언어로 구현된 프로그램의 출력 결과를 쓰시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;

void main() {
  int a;
  int x = 5;
  int y = 5;

  a = --x + y++;

  printf(&#39;%d %d %d&quot;, a, x, y);
}</code></pre>
<p>풀이과정 및 답</p>
<ul>
<li><code>a = 4 + 5 =</code><strong><code>9</code></strong></li>
<li><code>y++ =</code><strong><code>6</code></strong></li>
<li>답 : <span style ="color: blue"><strong><code>9 4 6</code></strong></span></li>
</ul>
<p><strong>2) 다음 C언어로 구현된 프로그램의 출력 결과를 쓰시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;

void main() {
  int a, b, result1, result2;
  a = 12;
  b = 4;
  result1 = a&amp;b;
  result2 = a|b;

  printf(&#39;%d\n&quot;, result1);
  printf(&#39;%d&quot;, result2);
}</code></pre>
<p>풀이과정 및 답</p>
<ul>
<li><code>result1 = a&amp;b = 1100 &amp; 0100 =</code><strong><code>0100</code></strong></li>
<li><code>result2 = a|b = 1100 | 0100 =</code><strong><code>1100</code></strong></li>
<li>답<ul>
<li><span style ="color: blue"><strong><code>4</code></strong></span></li>
<li><span style ="color: blue"><strong><code>12</code></strong></span></li>
</ul>
</li>
</ul>
<p><strong>3) 다음 JAVA로 구현된 프로그램의 출력 결과를 쓰시오.</strong></p>
<pre><code class="language-java">class function{
  public static void main (String[] args) {
    int n = 5;
    System.out.println(fact(n));
  }

  public static int fact(int n) {
    if (n == 1) return 1;
    return n * fact(n-1);
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li>일단 이거 재귀함수임</li>
<li><code>n = 5</code>일 때,<ul>
<li><code>return 5 * fact(4)</code></li>
<li><code>n = 4</code>일 때,<ul>
<li><code>return 4 * fact(3)</code></li>
<li><code>n = 3</code>일 때,<ul>
<li><code>return 3 * fact(2)</code></li>
<li><code>n = 2</code>일 때,<ul>
<li><code>return 2 * fact(1)</code></li>
<li><code>n = 1</code>일 때,<ul>
<li><code>return 1</code></li>
</ul>
</li>
<li><code>2 * 1 = 2</code></li>
</ul>
</li>
<li><code>3 * 2 = 6</code></li>
</ul>
</li>
<li><code>4 * 6 = 24</code></li>
</ul>
</li>
<li><code>5 * 24 =</code><strong><code>120</code></strong></li>
</ul>
</li>
<li>답 : <span style ="color: blue"><strong><code>120</code></strong></span></li>
</ul>
<p><strong>4) 다음 C언어로 구현된 프로그램의 출력 결과를 쓰시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;

int main() {
  int a, sum;
  a = sum = 0;

  while( a &lt;= 10 ) {
    a += 1;
    if(a % 2 == 1) continue;
    sum += a;
  }

  printf(&#39;sum = %d&quot;, sum);

  return 0;
}</code></pre>
<p>풀이과정 및 답</p>
<ul>
<li><code>a = 0</code> 일 때  ⇒ <code>1 % 2 == 1</code>  ⇒ <strong><code>continue</code></strong></li>
<li><code>a = 1</code> 일 때 <code>sum = 0 + 2</code></li>
<li><code>a = 2</code> 일 때  ⇒ <code>3 % 2 == 1</code>  ⇒ <strong><code>continue</code></strong></li>
<li><code>a = 3</code> 일 때 <code>sum = 2 + 4</code></li>
<li>(중략)</li>
<li><code>a = 9</code> 일 때 <code>sum = 20 + 10</code></li>
<li><code>a = 10</code> 일 때  ⇒ <code>11 % 2 == 1</code>  ⇒ <strong><code>continue</code></strong><ul>
<li><code>while</code> 문 종료</li>
<li><code>sum =</code><strong><code>30</code></strong></li>
</ul>
</li>
<li>답<ul>
<li><span style ="color: blue"><strong><code>sum = 30</code></strong></span></li>
</ul>
</li>
</ul>
<p><strong>5) 다음 C언어로 구현된 프로그램의 출력 결과를 쓰시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;

int main() {
  enum subject {kuk, mat=5, eng};
  int a, b;
  a = sum = 0;

  a = kuk;
  b = eng;

  printf(&#39;a = %d\n&quot;, a);
  printf(&#39;b = %d&quot;, b);;

  return 0;
}</code></pre>
<p>풀이과정 및 답</p>
<ul>
<li><code>enum</code>에서 <code>kuk</code>은 초기값이 없으므로 값은 <strong><code>0</code></strong></li>
<li><code>enum</code>에서 <code>eng</code>는 초기값이 <code>5</code>인 <code>mat</code> 다음이므로  값은 <strong><code>6</code></strong></li>
<li>답<ul>
<li><span style ="color: blue"><strong><code>a = 0</code></strong></span></li>
<li><span style ="color: blue"><strong><code>b = 6</code></strong></span></li>
</ul>
</li>
</ul>
<p><strong>6) 다음의 출력 결과를 작성하시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;

void main() {
  int ary[5] = {47, 95, 64, 21, 66};
  int temp;

  for(int i = 0; i &lt; 5; i++) {
    for(int j = 0; j &lt; i; j++) {
      if(ary[i] &lt; ary[j]) {
        temp = ary[i];
        ary[i] = ary[j];
        ary[j] = temp;
      }
    }

    for(int k = 0; k &lt; 5; k++) {
      printf(&quot;%d&quot;, ary[k]);
    }
    printf(&quot;\n&quot;);
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li><code>i = 0</code> 일 때<ul>
<li>조건이 맞지 않아 두 번째 반복문은 <code>PASS</code></li>
<li>세 번째 반복문은 배열 출력하는 반복문</li>
<li><strong><code>47, 95, 64, 21, 66</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 1</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[1] &lt; ary[0] = 95 &lt; 47</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><strong><code>47, 95, 64, 21, 66</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 2</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[2] &lt; ary[0] = 64 &lt; 47</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 1</code> 일 때<ul>
<li><code>ary[2] &lt; ary[1] = 64 &lt; 95</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
</ul>
</li>
<li><strong><code>47, 64, 95, 21, 66</code></strong></li>
<li><strong><code>\n</code></strong>  </li>
</ul>
</li>
<li><code>i = 3</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[3] &lt; ary[0] = 21 &lt; 47</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
<li><code>21, 64, 95, 47, 66</code></li>
</ul>
</li>
<li><code>j = 1</code> 일 때<ul>
<li><code>ary[3] &lt; ary[1] = 47 &lt; 64</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
<li><code>21, 47, 95, 64, 66</code></li>
</ul>
</li>
<li><code>j = 2</code> 일 때<ul>
<li><code>ary[3] &lt; ary[2] = 64 &lt; 95</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
</ul>
</li>
<li><strong><code>21, 47, 64, 95, 66</code></strong></li>
<li><strong><code>\n</code></strong>  </li>
</ul>
</li>
<li><code>i = 4</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[4] &lt; ary[0] = 66 &lt; 21</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 1</code> 일 때<ul>
<li><code>ary[4] &lt; ary[1] = 66 &lt; 47</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 2</code> 일 때<ul>
<li><code>ary[4] &lt; ary[2] = 66 &lt; 64</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 3</code> 일 때<ul>
<li><code>ary[4] &lt; ary[3] = 66 &lt; 95</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
</ul>
</li>
<li><strong><code>21, 47, 64, 66, 95</code></strong></li>
<li><strong><code>\n</code></strong>  </li>
</ul>
</li>
<li>답<ul>
<li><span style ="color: blue"><strong><code>47, 95, 64, 21, 66</code></strong></span></li>
<li><span style ="color: blue"><strong><code>47, 95, 64, 21, 66</code></strong></span></li>
<li><span style ="color: blue"><strong><code>47, 64, 95, 21, 66</code></strong></span></li>
<li><span style ="color: blue"><strong><code>21, 47, 64, 95, 66</code></strong></span></li>
<li><span style ="color: blue"><strong><code>21, 47, 64, 66, 95</code></strong></span></li>
</ul>
</li>
</ul>
<p><strong>7) 다음의 출력 결과를 작성하시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;

void main() {
  int ary[5] = {47, 95, 64, 21, 66};
  int temp;

  for(int i = 0; i &lt; 5; i++) {
    for(int j = 0; j &lt; 5-i-1; j++) {
      if(ary[j] &lt; ary[j+1]) {
        temp = ary[j];
        ary[j] = ary[j+1];
        ary[j+1] = temp;
      }
    }

    for(int k = 0; k &lt; 5; k++) {
      printf(&quot;%d&quot;, ary[k]);
    }
    printf(&quot;\n&quot;);
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li><code>i = 0</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[0] &lt; ary[1] = 47 &lt; 95</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
<li><code>95, 47, 64, 21, 66</code></li>
</ul>
</li>
<li><code>j = 1</code> 일 때<ul>
<li><code>ary[1] &lt; ary[2] = 47 &lt; 64</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
<li><code>95, 64, 47, 21, 66</code>    </li>
</ul>
</li>
<li><code>j = 2</code> 일 때<ul>
<li><code>ary[2] &lt; ary[3] = 47 &lt; 21</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 3</code> 일 때<ul>
<li><code>ary[3] &lt; ary[4] = 21 &lt; 66</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
</ul>
</li>
<li><strong><code>95, 64, 47, 66, 21</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 1</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[0] &lt; ary[1] = 95 &lt; 64</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 1</code> 일 때<ul>
<li><code>ary[1] &lt; ary[2] = 64 &lt; 47</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 2</code> 일 때<ul>
<li><code>ary[2] &lt; ary[3] = 47 &lt; 66</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
</ul>
</li>
<li><strong><code>95, 64, 66, 47, 21</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 2</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[0] &lt; ary[1] = 94 &lt; 64</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><code>j = 1</code> 일 때<ul>
<li><code>ary[1] &lt; ary[2] = 64 &lt; 66</code> ✅ ⇒ <strong>순서 바꾸기!</strong></li>
</ul>
</li>
<li><strong><code>95, 66, 64, 47, 21</code></strong></li>
<li><strong><code>\n</code></strong>  </li>
</ul>
</li>
<li><code>i = 3</code> 일 때<ul>
<li><code>j = 0</code> 일 때<ul>
<li><code>ary[0] &lt; ary[1] = 95 &lt; 66</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
<li><strong><code>95, 66, 64, 47, 21</code></strong></li>
<li><strong><code>\n</code></strong>  </li>
</ul>
</li>
<li><code>i = 4</code> 일 때<ul>
<li>조건이 맞지 않아 두 번재 반복문은 <code>PASS</code></li>
<li><strong><code>95, 66, 64, 47, 21</code></strong></li>
<li><strong><code>\n</code></strong>  </li>
</ul>
</li>
<li>답<ul>
<li><span style ="color: blue"><strong><code>95, 64, 47, 66, 21</code></strong></span></li>
<li><span style ="color: blue"><strong><code>95, 64, 66, 47, 21</code></strong></span></li>
<li><span style ="color: blue"><strong><code>95, 66, 64, 47, 21</code></strong></span></li>
<li><span style ="color: blue"><strong><code>95, 66, 64, 47, 21</code></strong></span></li>
<li><span style ="color: blue"><strong><code>95, 66, 64, 47, 21</code></strong></span></li>
</ul>
</li>
</ul>
<p><strong>8) 다음의 출력 결과를 작성하시오.</strong></p>
<pre><code class="language-java">public class Path {
  public static void main(String[] args) {
    int[] arr = {4, 6, 9, 1, 2};
    insertionSort(arr);
  }

  public static void insertionSort(int[] arr) {
    int n = arr.length;

    for (int i = 1; i &lt; n; i++) {
      int key = arr[i];
      int j = i - 1;

      while (j &gt;= 0 &amp;&amp; arr[j] &gt; key) {
        arr[j + 1] = arr[j];
        j--;
      }

      arr[j + 1] = key;

      for (int element : arr) {
        System.out.print(element + &quot; &quot;);
      }

      System.out.println();
    }
  }
}</code></pre>
<p>풀이과정</p>
<ul>
<li><code>n = 5</code></li>
<li><code>i = 1</code> 일 때<ul>
<li><code>key = arr[1] = 6</code></li>
<li><code>j = 1 - 1 = 0</code></li>
<li><code>while(0 &gt;= 0 &amp;&amp; 4 &gt; 6)</code> ❌ ⇒ <code>PASS</code></li>
<li><code>arr[1] = 6 = key</code></li>
<li><strong><code>4, 6, 9, 1, 2</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 2</code>일 때<ul>
<li><code>key = arr[2] = 9</code></li>
<li><code>j = 2 - 1 = 1</code></li>
<li><code>while(1 &gt;= 0 &amp;&amp; 6 &gt; 9)</code> ❌ ⇒ <code>PASS</code></li>
<li><code>arr[2] = key = 9</code></li>
<li><strong><code>4, 6, 9, 1, 2</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 3</code>일 때<ul>
<li><code>key = arr[3] = 1</code></li>
<li><code>j = 3 - 1 = 2</code></li>
<li><code>while(2 &gt;= 0 &amp;&amp; 9 &gt; 1)</code> ✅<ul>
<li><code>arr[3] = 9</code> ⇒ <code>4, 6, 9, 9, 2</code></li>
<li><code>j--</code><ul>
<li><code>while(1 &gt;= 0 &amp;&amp; 6 &gt; 1)</code> ✅</li>
<li><code>arr[2] = 6</code> ⇒ <code>4, 6, 6, 9, 2</code></li>
<li><code>j--</code><ul>
<li><code>while(0 &gt;= 0 &amp;&amp; 4 &gt; 1)</code> ✅</li>
<li><code>arr[1] = 4</code> ⇒ <code>4, 4, 6, 9, 2</code></li>
<li><code>j--</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><code>arr[0] = key = 1</code></li>
<li><strong><code>1, 4, 6, 9, 2</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li><code>i = 4</code>일 때<ul>
<li><code>key = arr[4] = 2</code></li>
<li><code>j = 4 - 1 = 3</code><ul>
<li><code>while(3 &gt;= 0 &amp;&amp; 9 &gt; 2)</code> ✅<ul>
<li><code>arr[4] = 9</code> ⇒ <code>1, 4, 6, 9, 9</code></li>
<li><code>j--</code></li>
<li><code>while(2 &gt;= 0 &amp;&amp; 6 &gt; 2)</code> ✅</li>
<li><code>arr[3] = 6</code> ⇒ <code>1, 4, 6, 6, 9</code></li>
<li><code>j--</code><ul>
<li><code>while(1 &gt;= 0 &amp;&amp; 4 &gt; 2)</code> ✅</li>
<li><code>arr[2] = 4</code> ⇒ <code>1, 4, 4, 6, 9</code></li>
<li><code>j--</code></li>
<li><code>while(0 &gt;= 0 &amp;&amp; 1 &gt; 2)</code> ❌ ⇒ <code>PASS</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><code>arr[1] = key = 2</code></li>
<li><strong><code>1, 2, 4, 6, 9</code></strong></li>
<li><strong><code>\n</code></strong></li>
</ul>
</li>
<li>답<ul>
<li><span style ="color: blue"><strong><code>4, 6, 9, 1, 2</code></strong></span></li>
<li><span style ="color: blue"><strong><code>4, 6, 9, 1, 2</code></strong></span></li>
<li><span style ="color: blue"><strong><code>1, 4, 6, 9, 2</code></strong></span></li>
<li><span style ="color: blue"><strong><code>1, 2, 4, 6, 9</code></strong></span></li>
</ul>
</li>
</ul>
<hr>
<h2 id="🍀-section-2--프로그래밍-언어-특성">🍀 Section 2 | 프로그래밍 언어 특성</h2>
<h3 id="1-프로그래밍-언어의-발전-과정-및-언어별-특성">1. 프로그래밍 언어의 발전 과정 및 언어별 특성</h3>
<table>
<thead>
<tr>
<th align="center">년도</th>
<th align="center">언어</th>
<th align="center">특징</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>1960년대 이전</strong></td>
<td align="center">Assembly(1950년대)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>Fortran(1954년)</strong></td>
<td align="center">시스템 의존적</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>LISP(1959년)</strong></td>
<td align="center"></td>
</tr>
<tr>
<td align="center"><strong>1960년대</strong></td>
<td align="center"><strong>Cobol(1960년대)</strong></td>
<td align="center">순차적 방식, 대문자로만 작성</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">PL/I(1964년)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center">Basic(1964년)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"><strong>1970년대</strong></td>
<td align="center"><strong>Pascal(1971년)</strong></td>
<td align="center">사용자 정의 추상화 기능 O, 정보 은닉 기능 X</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>C(1972년)</strong></td>
<td align="center">UNIX 운영체제, 포인터 타입</td>
</tr>
<tr>
<td align="center"></td>
<td align="center">Smalltalk(1972년)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center">Prolog(1973년)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"><strong>1980년대</strong></td>
<td align="center">ADA(1983년)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>C++(1983년)</strong></td>
<td align="center">C언어를 발전 킨 언. 객체 지향 언어(클래스, 상속 등)</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>Python(1986년)</strong></td>
<td align="center">인터프리터 언어, 객체 지향 언어, 스크립트 언어</td>
</tr>
<tr>
<td align="center"><strong>1990년대 이후</strong></td>
<td align="center">Ruby(1993년)</td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>Java(1995년)</strong></td>
<td align="center">분산 환경 및 보안성 지원. 가상 머신이 필요함</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>JavaScript(1995년)</strong></td>
<td align="center">객체 지향 스크립터 언어. 웹 페이지 동작. 쉽지만 보안&amp;성능이 상대적으로 부족</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>C#(2000년)</strong></td>
<td align="center">.NET 환경에 맞춰 설계된 언어. C# 컴파일러를 필요로함.</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>Golang#(2009년)</strong></td>
<td align="center">내장 라이브러리. 낮은 하드웨어 사양에도 빠른 컴파일 가능.</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>Dart</strong></td>
<td align="center">JS와 Java의 영향을 받아 개발된 객체 지향 언어</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><strong>Ceylon</strong></td>
<td align="center">Java 기반 언어. Ceylon herd 라는 저장소에서 모듈을 발행</td>
</tr>
</tbody></table>
<h3 id="2-프로그래밍-언어의-유형-분류">2. 프로그래밍 언어의 유형 분류</h3>
<p><strong>1) 개발 편의성에 따른 분류</strong></p>
<ul>
<li><strong>저급 언어</strong><ul>
<li>기계가 이해할 수 있도록 만들어진 언어</li>
<li>추상화 수준이 낮고, 프로그램 작성이 어렵다.</li>
<li>기계어, 어셈블리어 등</li>
</ul>
</li>
<li><strong>고급 언어</strong><ul>
<li>개발자가 소스코드를 작성할 때 쉽게 이해할 수 있도록 만들어진 언어</li>
<li>C, C++ Java 등</li>
</ul>
</li>
</ul>
<p><strong>2) 실행 방식에 따른 분류 (<span style = "color: green">명함논객</span>)</strong></p>
<ul>
<li><strong><span style = "color: green">명</span>령형 언어</strong><ul>
<li>컴퓨터에 저장된 명령어들이 순차적으로 실행되는 프로그래밍 방식</li>
<li>절차형 언어</li>
<li>Fortran, Cobol, Pascal, C 등</li>
</ul>
</li>
<li><strong><span style = "color: green">함</span>수형 언어</strong><ul>
<li>수학적 수식과 같은 함수들로 프로그램을 구성하여 호출하는 방식</li>
<li>LISP 등</li>
</ul>
</li>
<li><strong><span style = "color: green">논</span>리형 언어</strong><ul>
<li>규칙에 대한 활성화 조건이 만족되면 연관된 규칙이 실행되는 구조</li>
<li>추론과 관계 규칙에 원하는 결과를 얻어내는 방식</li>
<li>Prolog 등</li>
</ul>
</li>
<li><strong><span style = "color: green">객</span>체 지향 언어</strong><ul>
<li>객체 간의 메시지 통신을 이용하여 프로그래밍 하는 방식</li>
<li>Java, C++ 등</li>
</ul>
</li>
</ul>
<p><strong>3) 구현 기법에 따른 분류 (<span style = "color: green">컴인혼</span>)</strong></p>
<ul>
<li><strong><span style = "color: green">컴</span>파일 방식의 언어</strong><ul>
<li>고급 언어를 기계어로 번역하는 방식의 언어</li>
<li>절차형 언어</li>
<li>Fortran, Pascal, C, C++ 등</li>
</ul>
</li>
<li><strong><span style = "color: green">인</span>터프리터 방식의 언어</strong><ul>
<li>고급 언어 명령문을 하나씩 번역하고 실행하는 방식의 언어</li>
<li>Basic, Prolog, LISP, Snobol 등</li>
</ul>
</li>
<li><strong><span style = "color: green">혼</span>합형 방식의 언어</strong><ul>
<li>고급 언어를 컴파일하여 중간 언어로 변환한 후 인터프리터에 의해 번역을 실행하는 방식의 언어</li>
<li>Java 등</li>
</ul>
</li>
</ul>
<h3 id="🚀-예상문제-1">🚀 예상문제</h3>
<p><strong>1) 다음 중 1990년대 이후로 개발된 프로그래밍 언어가 아닌 것을 골라 쓰시오.</strong></p>
<ul>
<li><code>PYTHON</code></li>
<li><code>JAVA</code></li>
<li><code>C#</code></li>
<li><code>RUBY</code></li>
</ul>
<p>답 : <span style="color: blue"><strong><code>Python</code></strong></span></p>
<p><strong>2) 프로그래밍 언어 중 .NET환경에서 실행되기 때문에 .NET 환경의 설치가 요구되는 언어는 무엇인지 쓰시오.</strong></p>
<p>답 : <span style="color: blue"><strong><code>C#</code></strong></span></p>
<p><strong>3) 프로그램 언어 중 수학적 수식과 같은 함수로 이루어진 대표적인 함수형 언어는 무엇인지 쓰시오.</strong></p>
<p>답 : <span style="color: blue"><strong><code>LISP</code></strong></span></p>
<hr>
<h2 id="🍀-section-3--라이브러리">🍀 Section 3 | 라이브러리</h2>
<h3 id="1-라이브러리의-개념">1. 라이브러리의 개념</h3>
<p><strong>1) 라이브러리 정의</strong></p>
<ul>
<li>효율적인 프로그램 개발을 위해 필요한 프로그램을 모아놓은 집합체</li>
<li>필요할 때 찾아서 사용할 수 있도록 모듈화 되어 제공되는 프로그램</li>
<li>프로그래밍 언어에 일반적으로 다음과 같은 기능을 제공한다.</li>
</ul>
<blockquote>
</blockquote>
<ul>
<li><strong>도움말</strong> : 라이브러리 어떻게 쓰는건지 알려주는 문서</li>
<li><strong>설치 파일</strong> : 라이브러리를 적용하기 위해 제공되는 설치 파일</li>
<li><strong>샘플 코드</strong> : 라이브러리를 이해하고 쉽게 적용하기 위해 제공되는 예시 코드</li>
</ul>
<p><strong>2) 라이브러리 종류</strong></p>
<ul>
<li><strong>표준 라이브러리</strong><ul>
<li>프로그래밍 언어가 기본적으로 가지고 있는 라이브러리</li>
<li>별도의 파일 설치 없이 날짜와 시간 등의 기능을 사용할 수 있다.</li>
</ul>
</li>
<li><strong>외부 라이브러리</strong><ul>
<li>별도의 파일을 설치해야한다.</li>
<li>보통 표준 라이브러리 범위를 벗어나는 기능을 구현할 때 외부에서 불러오는 것이다.</li>
</ul>
</li>
</ul>
<p><strong>3) 모듈과 패키지</strong></p>
<ul>
<li>라이브러리는 <strong>모듈</strong>과 <strong>패키지</strong>를 총칭한다.</li>
<li><strong>모듈</strong> : 개별 <strong>파일</strong></li>
<li><strong>패키지</strong> : 개별 파일들을 모아놓은 <strong>폴더</strong></li>
</ul>
<pre><code class="language-bash">Home  (패키지)
 ㄴ Board.js  (모듈)
 ㄴ Menu.js   (모듈)
 ㄴ Writhe.js (모듈)</code></pre>
<h3 id="2-라이브러리의-활용표준-c언어-라이브러리">2. 라이브러리의 활용(표준 C언어 라이브러리)</h3>
<table>
<thead>
<tr>
<th align="left">함수</th>
<th align="left">헤더파일</th>
<th align="left">설명</th>
<th align="left">예</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>log</strong></td>
<td align="left">math.h</td>
<td align="left">로그 계산</td>
<td align="left"><code>double log(double a);</code></td>
</tr>
<tr>
<td align="left"><strong>log10</strong></td>
<td align="left">math.h</td>
<td align="left">밑이 10인 로그 계산</td>
<td align="left"><code>double log10(double a);</code></td>
</tr>
<tr>
<td align="left"><strong>pow</strong></td>
<td align="left">math.h</td>
<td align="left">값 <code>a</code>의 <code>b</code>제곱 계산</td>
<td align="left"><code>double pow(double a, double b);</code></td>
</tr>
<tr>
<td align="left"><strong>sqrt</strong></td>
<td align="left">math.h</td>
<td align="left">제곱근 계산</td>
<td align="left"><code>double sqrt(double a);</code></td>
</tr>
<tr>
<td align="left"><strong>tan</strong></td>
<td align="left">math.h</td>
<td align="left">탄젠트 계산</td>
<td align="left"><code>double tan(double a);</code></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"></td>
<td align="left"></td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><strong>abs</strong></td>
<td align="left">stdlib.h</td>
<td align="left">정수 인수 <code>n</code>의 절대값 계산</td>
<td align="left"><code>int abs(int n);</code></td>
</tr>
<tr>
<td align="left"><strong>atoi</strong></td>
<td align="left">stdlib.h</td>
<td align="left">문자열을 정수로 변환</td>
<td align="left"><code>int atoi(char str);</code></td>
</tr>
<tr>
<td align="left"><strong>malloc</strong></td>
<td align="left">stdlib.h</td>
<td align="left">동적 메모리 할당</td>
<td align="left"><code>void *malloc(size_t size);</code></td>
</tr>
<tr>
<td align="left"><strong>rand</strong></td>
<td align="left">stdlib.h</td>
<td align="left">임의의 난수 생성</td>
<td align="left"><code>int rand(void);</code></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"></td>
<td align="left"></td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><strong>strcat</strong></td>
<td align="left">string.h</td>
<td align="left"><code>str2</code>를 <code>str1</code>에 연결</td>
<td align="left"><code>char *strcat(char *str1, const char *str2);</code></td>
</tr>
<tr>
<td align="left"><strong>strcpy</strong></td>
<td align="left">string.h</td>
<td align="left"><code>str2</code>를 <code>str1</code>에 복사</td>
<td align="left"><code>char *strcpy(char *str1, const char *str2);</code></td>
</tr>
<tr>
<td align="left"><strong>strlen</strong></td>
<td align="left">string.h</td>
<td align="left"><code>str</code> 문자열 길이 계산</td>
<td align="left"><code>size_t strlen(const char *str);</code></td>
</tr>
</tbody></table>
<h3 id="3-라이브러리의-활용표준-java-라이브러리">3. 라이브러리의 활용(표준 Java 라이브러리)</h3>
<table>
<thead>
<tr>
<th align="left">함수</th>
<th align="left">설명</th>
<th align="left">예</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>random()</strong></td>
<td align="left">0.0 이상 1.0 미만의 임이의 값 생성 및 반환</td>
<td align="left"><code>Math.random()</code> //</td>
</tr>
<tr>
<td align="left"><strong>abs</strong></td>
<td align="left">절댓값 반환</td>
<td align="left"><code>Math.abs(10)</code> // 10</td>
</tr>
<tr>
<td align="left"></td>
<td align="left"></td>
<td align="left"><code>Math.abs(-10)</code> // 10</td>
</tr>
<tr>
<td align="left"><strong>ceil</strong></td>
<td align="left">소수 부분 올리고 반환</td>
<td align="left"><code>Math.ceil(10.1)</code>   // 11.0</td>
</tr>
<tr>
<td align="left"><strong>floor</strong></td>
<td align="left">소수 부분 버리고 반환</td>
<td align="left"><code>Math.floor(10.1)</code> // 10.0</td>
</tr>
<tr>
<td align="left"><strong>round</strong></td>
<td align="left">소수점 첫째 자리에서 반올림한 정수 반환</td>
<td align="left"><code>Math.round(10.4)</code> // 10</td>
</tr>
<tr>
<td align="left"></td>
<td align="left"></td>
<td align="left"><code>Math.round(10.9)</code> // 11</td>
</tr>
<tr>
<td align="left"><strong>rint</strong></td>
<td align="left">값과 가장 가까운 정수값 반환</td>
<td align="left"><code>Math.rint(100.67)</code> // 101</td>
</tr>
<tr>
<td align="left"></td>
<td align="left"></td>
<td align="left"><code>Math.rint(10.34)</code> // 10</td>
</tr>
<tr>
<td align="left"><strong>max</strong></td>
<td align="left">두 값 중 큰 값 반환</td>
<td align="left"><code>Math.max(14, 11)</code> // 14</td>
</tr>
<tr>
<td align="left"><strong>min</strong></td>
<td align="left">두 값 중 작은 값 반환</td>
<td align="left"><code>Math.min(14, 11)</code> // 11</td>
</tr>
<tr>
<td align="left"><strong>pow</strong></td>
<td align="left">첫 번째 인자값를 두 번째 인자값으로 제곱 연산하여 반환</td>
<td align="left"><code>Math.pow(5, 3)</code> // 125</td>
</tr>
<tr>
<td align="left"><strong>sqrt</strong></td>
<td align="left">값의 제곱근 반환</td>
<td align="left"><code>Math.sqrt(25)</code> // 5</td>
</tr>
</tbody></table>
<h3 id="🚀-예상문제-2">🚀 예상문제</h3>
<p><strong>1) 다음은 C언어로 구현된 1~10까지의 난수를 구하는 프로그램이다. 빈칸에 알맞은 라이브러리 함수를 입력하시오.</strong></p>
<pre><code class="language-c">#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main() {
  printf(&quot;%d\n&quot;, (1 + (    )  % 10));
}</code></pre>
<p>답 : <span style="color: blue"><strong><code>rand</code></strong></span> 또는 <span style="color: blue"><strong><code>rand()</code></strong></span></p>
<p><strong>2) 다음은 JAVA언어로 구현된 프로그램을 분석하여 그 실행 결과를 작성하시오.</strong></p>
<pre><code class="language-java">class path {
  public static void main(String[] args) {
    System.out.printf(&quot;%d&quot;, (int)Maht.sqrt(25) + (int)Math.log(10));
  }
}</code></pre>
<p>답 : <span style="color: blue"><strong><code>7</code></strong></span></p>
<p><strong>3) 다음의 출력 결과를 작성하시오.</strong></p>
<pre><code class="language-java">public class test {
  public static void main(String[] args) {
    double a = 6.454;
    double b = 8.111;

    System.out.println(Math.ceil(a+b));
    System.out.println(Math.floor(a+b));
  }
}</code></pre>
<p>답</p>
<ul>
<li><span style="color: blue"><strong><code>15.0</code></strong></span></li>
<li><span style="color: blue"><strong><code>14.0</code></strong></span></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[1. 프로그래밍 언어 활용 : 알고리즘 구현]]></title>
            <link>https://velog.io/@xaexun_/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%96%B8%EC%96%B4-%ED%99%9C%EC%9A%A9-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EA%B5%AC%ED%98%84</link>
            <guid>https://velog.io/@xaexun_/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%96%B8%EC%96%B4-%ED%99%9C%EC%9A%A9-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EA%B5%AC%ED%98%84</guid>
            <pubDate>Tue, 03 Feb 2026 15:30:47 GMT</pubDate>
            <description><![CDATA[<h1 id="📍-chapter-1--알고리즘-구현">📍 Chapter 1 : 알고리즘 구현</h1>
<hr>
<h2 id="🍀-section-1--알고리즘">🍀 Section 1 | 알고리즘</h2>
<h3 id="1-알고리즘의-개념">1. 알고리즘의 개념</h3>
<ul>
<li><strong>넓은 의미</strong> : 자료구조와 함께 프로그램을 구성하는 요소</li>
<li><strong>좁은 의미</strong> : 어떤 문제에 대한 답을 찾는 해법</li>
<li>프로그램 작성 과정 중 <strong>설계/계획 단계</strong>에 포함</li>
</ul>
<blockquote>
<p>💡 <strong>설계/계획 단계</strong></p>
</blockquote>
<ul>
<li>문제 해결을 위한 일련의 절차나 방법을 공식화한 형태 또는 계산을 실행하기 위한 단계적 절차</li>
</ul>
<h3 id="2-알고리즘의-5가지-특성">2. 알고리즘의 5가지 특성</h3>
<ul>
<li>알고리즘은 기본적인 명령어를 통해서도 작성 가능하다.</li>
<li>아래와 같은 5가지 특성을 만족하여야한다.</li>
</ul>
<table>
<thead>
<tr>
<th align="center">특성</th>
<th align="center">내용</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><strong>입력</strong></td>
<td align="center">외부로부터 입력되는 자료가 <strong>0개</strong> 이상이어야 한다.</td>
</tr>
<tr>
<td align="center"><strong>출력</strong></td>
<td align="center">출력되는 결과가 <strong>1개</strong> 이상이어야 한다.</td>
</tr>
<tr>
<td align="center"><strong>명확성</strong></td>
<td align="center">각 명령어의 의미가 명확하여야 한다.</td>
</tr>
<tr>
<td align="center"><strong>유한성</strong></td>
<td align="center">정해진 단계를 거친 후 문제를 해결하고 종료되어야 한다.</td>
</tr>
<tr>
<td align="center"><strong>유효성</strong></td>
<td align="center">모든 명령은 실행이 가능한 연산들이어야 한다.</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>TIP</strong></p>
</blockquote>
<ul>
<li>알고리즘의 표현 종류<ul>
<li>자연어, 순서도, 의사 코드, 프로그래밍 언어 등</li>
</ul>
</li>
<li>프로그래밍 언어가 아니더라도 알고리즘의 표현이 가능하다.</li>
</ul>
<h3 id="🚀-예상-문제">🚀 예상 문제</h3>
<p>1) 어떠한 문제를 해결하기 위해 정해진 일련의 절차나 방법을 공식화한 형태를 무엇이라고 하는지 쓰시오. </p>
<p><span style="color: blue">알고리즘</span></p>
<p>2) 다음 보기에서 알고리즘의 5가지 특성으로 올바르지 않은 것을 고르시오.</p>
<table>
<thead>
<tr>
<th align="center">보기</th>
</tr>
</thead>
<tbody><tr>
<td align="center">유효성</td>
</tr>
<tr>
<td align="center">명확성</td>
</tr>
<tr>
<td align="center">유한성</td>
</tr>
<tr>
<td align="center">무결성</td>
</tr>
</tbody></table>
<p><span style="color: blue">무결성</span></p>
<hr>
<h2 id="🍀-section-2--순서도">🍀 Section 2 | 순서도</h2>
<h3 id="1-순서도">1. 순서도</h3>
<ul>
<li><strong>알고리즘을 표현</strong>하는 여러 방식 중 하나이다.</li>
<li>미리 약속된 <strong>기호와 그림</strong>을 통해 <strong>논리적 절차, 흐름, 연산 등</strong>을 <strong>시각적</strong>으로 표현한 것을 말한다.</li>
</ul>
<h3 id="2-순서도-도형">2. 순서도 도형</h3>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/755c1046-b149-4e58-b062-3986ca9f06b9/image.png" alt=""></p>
<h3 id="3-순서도-연산">3. 순서도 연산</h3>
<p>** 1) 순서도 산술 연산**</p>
<table>
<thead>
<tr>
<th align="center">연산자</th>
<th align="center">뜻</th>
<th align="center">예시</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><code>+</code></td>
<td align="center">더하기</td>
<td align="center">8 <code>+</code> 4</td>
</tr>
<tr>
<td align="center"><code>-</code></td>
<td align="center">빼기</td>
<td align="center">8 <code>-</code> 4</td>
</tr>
<tr>
<td align="center"><code>*</code></td>
<td align="center">곱하기</td>
<td align="center">8 <code>*</code> 4</td>
</tr>
<tr>
<td align="center"><code>/</code></td>
<td align="center">나누기</td>
<td align="center">8 <code>/</code> 4</td>
</tr>
<tr>
<td align="center"><code>%</code>, <code>mod</code></td>
<td align="center">나머지</td>
<td align="center">8 <code>%</code> or <code>mod</code> 4</td>
</tr>
<tr>
<td align="center"><code>^</code></td>
<td align="center">거듭제곱</td>
<td align="center">8<code>^</code>4</td>
</tr>
</tbody></table>
<blockquote>
<p>💡 <strong>TIP</strong></p>
</blockquote>
<ul>
<li>순서도 : <code>%</code>와 <code>mod</code> 모두 사용 가능</li>
<li>프로그래밍 : <code>%</code>만 사용 가능</li>
</ul>
<p>** 2) 순서도 관계 연산**</p>
<table>
<thead>
<tr>
<th align="center">연산자</th>
<th align="center">뜻</th>
<th align="center">예시</th>
</tr>
</thead>
<tbody><tr>
<td align="center"><code>&gt;</code></td>
<td align="center">크다(초과)</td>
<td align="center">8 <code>&gt;</code> 4</td>
</tr>
<tr>
<td align="center"><code>&gt;=</code></td>
<td align="center">크거나 같다(이상)</td>
<td align="center">8 <code>&gt;=</code> 4</td>
</tr>
<tr>
<td align="center"><code>&lt;</code></td>
<td align="center">작다(미만)</td>
<td align="center">4 <code>&lt;</code> 8</td>
</tr>
<tr>
<td align="center"><code>&lt;=</code></td>
<td align="center">작거나 같다(이하)</td>
<td align="center">4 <code>&lt;=</code> 8</td>
</tr>
<tr>
<td align="center"><code>=</code></td>
<td align="center">같다</td>
<td align="center">8 <code>=</code> 8</td>
</tr>
<tr>
<td align="center"><code>&lt;&gt;</code>, <code>≠</code>, <code>!=</code></td>
<td align="center">같지 않다(다르다)</td>
<td align="center">8 <code>&lt;&gt;</code>, <code>≠</code>, <code>!=</code> 4</td>
</tr>
</tbody></table>
<h3 id="4-순서도의-기초-공식">4. 순서도의 기초 공식</h3>
<p><strong>1) 변수와 상수</strong></p>
<ul>
<li><strong>변수</strong> : <span style="color: green">고정되어 있지 않은 값</span> 또는 어떤 값을 주기억장치에 기억하기 위해서 사용하는 공간이다.</li>
<li><strong>상수</strong> : <span style="color: green">고정되어 있는 값</span> 또는 이미 지정되어 있는 변하지 않는 값이다.</li>
</ul>
<blockquote>
</blockquote>
<p>💡 <strong>TIP</strong></p>
<ul>
<li>순서도 안에서 데이터들은 특정한 규칙을 가지고 연산을 하게 된다.</li>
</ul>
<hr>
<p>💡 <strong>예시 <code>a = 10</code></strong></p>
<ul>
<li>변수 <code>a</code>에 정수 <code>10</code>을 <span style="color: green">대입</span>하라.</li>
<li>여기서 <code>=</code>는 같다는 뜻이 아닌 대입하라는 뜻.</li>
</ul>
<p><strong>2) 수의 증감</strong></p>
<blockquote>
<p><strong>2-1)</strong> 수(<code>i</code>)의 초기값이 설정되어 있는 경우</p>
</blockquote>
<ul>
<li><code>i = i + 1</code></li>
<li><code>i = i - 1</code></li>
</ul>
<hr>
<p>💡 <strong>예시</strong></p>
<ul>
<li><code>i = 0</code> → <code>i = i + 1</code> ... ✅</li>
<li><code>i</code> → <code>i = i + 1</code> ........... ❌</li>
</ul>
<blockquote>
<p><strong>2-2)</strong> 수(<code>k</code>)의 초기값이 설정되어 있지 않은 경우</p>
</blockquote>
<ul>
<li><code>i = 고정값 - 변수</code></li>
<li><code>i</code>의 초기값이 없는 것은 <code>0</code> 값이 아닌 <code>NULL Value(값없음)</code>을 의미한다.</li>
</ul>
<hr>
<p>💡 <strong>예시</strong></p>
<ul>
<li><code>i = 0, k</code> → <code>i = i + 1</code> → <code>k = 10 - i</code><ul>
<li><code>i = 1</code></li>
<li><code>k = 9</code></li>
</ul>
</li>
</ul>
<p><strong>3) 합의 공식</strong></p>
<blockquote>
</blockquote>
<ul>
<li><code>합계 = 합계 + 수</code></li>
<li>합계의 초기값은 기본적으로 0으로 초기화하며 합계변수에 증감변수를 이용하여 누적한다.</li>
</ul>
<hr>
<p>💡 <strong>예시</strong></p>
<ul>
<li><code>sum = 0</code> → <code>sum = sum + i</code><ul>
<li><code>i = 1</code></li>
<li><code>k = 9</code></li>
</ul>
</li>
</ul>
<p><strong>4) 평균 공식</strong></p>
<blockquote>
</blockquote>
<ul>
<li><code>평균(avg) = 합계(sum) / 개수(cnt)</code></li>
</ul>
<hr>
<p>💡 <strong>예제) 다음은 1부터 10까지의 합과 평균을 구하는 알고리즘이다. 빈칸에 들어갈 알맞은 말을 쓰시오.</strong>
<img src="https://velog.velcdn.com/images/xaexun_/post/c291af30-5225-4861-a358-4c7fb2ef062a/image.png" alt="">
⓵ <span style="color: blue"><code>0</code></span>
⓶ <span style="color: blue"><code>i = i + 1</code></span>
⓷ <span style="color: blue"><code>sum = sum + i</code></span>
⓸ <span style="color: blue"><code>10</code></span>
⓹ <span style="color: blue"><code>i</code> or <code>10</code></span></p>
<p><strong>5) 부호 변경</strong></p>
<blockquote>
</blockquote>
<ul>
<li>부호의 변경은 판단 기호를 이용하여 계산하거나<code>부호 = 부호 * (-1)</code>을 이용하여 연산한다.</li>
</ul>
<hr>
<p>💡 <strong>예제) <code>1 - 2 + 3 - 4 + 5 - 6 + 7 - 8 + 9</code>을 연산하는 알고리즘의 두가지 방법이다. 빈칸에 알맞은 말을 쓰시오.</strong>
<img src="https://velog.velcdn.com/images/xaexun_/post/14ee1e0a-ade6-4fd5-9581-47c91691b0f8/image.png" alt="">
⓵ <span style="color: blue"><code>s * i</code></span>
⓶ <span style="color: blue"><code>s * (-1)</code></span></p>
<p><strong>6) 몫과 나머지</strong></p>
<blockquote>
</blockquote>
<ul>
<li>몫<ul>
<li><code>값 / 수</code> 로 표현한다.</li>
<li>결과값을 정수형으로 표현한다. → <code>int</code></li>
<li><code>4 / 2 = 2</code>, <code>5 / 2 = 2</code></li>
</ul>
</li>
<li>나머지<ul>
<li><code>값 % 수</code> 또는 <code>값 mod 수</code> 로 표현한다.</li>
<li><code>7 % 3 = 1</code>, <code>5 mod 2 = 1</code></li>
</ul>
</li>
</ul>
<hr>
<p>💡 <strong>예제) 입력된 수 <code>N</code>의 짝수와 홀수를 출력하는 알고리즘이다. 빈칸에 들어갈 알맞은 말을 쓰시오.</strong>
<img src="https://velog.velcdn.com/images/xaexun_/post/8ce5999a-d8c7-4394-af5c-5afbb796a929/image.png" alt="">
⓵ <span style="color: blue"><code>N % 2 = 0</code> or <code>N mod 2 = 0</code></span></p>
<p><strong>7) 배열</strong></p>
<blockquote>
</blockquote>
<ul>
<li>번호에 대응하는 데이터들로 이루어진 자료 구조를 말한다.</li>
<li>변수를 연속적으로 저장하기 위해 확보한 메모리 공간을 의미한다.</li>
<li><code>a[5] = a[0], a[1], a[2], a[3], a[4]</code> 의 주소로 이루어진다.</li>
<li>프로그래밍의 배열에서의 주소값은 <code>0</code>부터 시작이 고정이다.</li>
<li>순서도에서는 <code>0</code> 또는 <code>1</code> 로 시작이 가능하다.</li>
</ul>
<hr>
<p>💡 <strong>예제) 저장되어 있는 배열 A의 7개 정수 중, 최대값과 최소값을 구하는 알고리즘이다. 빈칸에 들어갈 알맞은 말을 쓰시오. (배열의 시작 주소값 = <code>1</code>)</strong></p>
<ul>
<li><code>A[7] = { 55, 66, 77, 11, 22, 44, 99 }</code></li>
<li><code>최대값 = MAX</code></li>
<li><code>최소값 = MIN</code></li>
<li><code>수열 = I</code>
<img src="https://velog.velcdn.com/images/xaexun_/post/43cdfe51-d794-43f7-99bb-8b99aa83180d/image.png" alt="">
⓵ <span style="color: blue"><code>I = I + 1</code></span>
⓶ <span style="color: blue"><code>A[I]</code></span>
⓷ <span style="color: blue"><code>MIN ＞ A[I]</code></span>
⓸ <span style="color: blue"><code>7</code></span></li>
</ul>
<hr>
<h3 id="🚀-예상-문제-1">🚀 예상 문제</h3>
<p>1) 정수 N을 입력 받아 3의 배수이면서 5의 배수인 수를 출력하는 알고리즘을 완성하시오.</p>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/d303ec53-a5f3-4818-b105-8e33ab86647d/image.png" alt=""></p>
<p>⓵ <span style="color: blue"><code>N % 3</code></span>
⓶ <span style="color: blue"><code>A + B</code></span></p>
<p>2) 배열 A에 있는 모든 정수의 합과 평균을 구하는 알고리즘을 완성하시오.</p>
<ul>
<li><strong><code>A[6] = {7, 22, 4, 19, 11, 12}</code></strong></li>
<li><strong><code>합 : SUM</code></strong></li>
<li><strong><code>평균 : AVG</code></strong></li>
<li><strong><code>수열 : I</code></strong></li>
</ul>
<p><img src="https://velog.velcdn.com/images/xaexun_/post/0383fa14-2c66-4bbe-82f1-1c197cf558dd/image.png" alt=""></p>
<p>⓵ <span style="color: blue"><code>6</code></span>
⓶ <span style="color: blue"><code>SUM / I</code> or <code>SUM / 6</code></span></p>
]]></description>
        </item>
    </channel>
</rss>