> For the complete documentation index, see [llms.txt](https://nmdkims-organization.gitbook.io/python-hand-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nmdkims-organization.gitbook.io/python-hand-book/day2./3.-quiz-quiz-mission3.md).

# 3. Quiz quiz\~(Mission3)

{% hint style="info" %}
오늘 풀어본 문제들은 총 6가지이고 이전 내용에서 알기 힘들었던 부분이나 헷갈렸던 부분을 위주로 생각해 봤습니다.&#x20;
{% endhint %}

<details>

<summary>1. Q : 함수와 메소드의 차이점은 무엇인가요?</summary>

**A : 함수는 일반적으로 모듈 수준에서 정의되고 호출되는 코드 블록입니다. 메소드는 클래스 내에서 정의되고 해당 클래스의 인스턴스에서 호출되는 함수입니다.**

</details>

<details>

<summary>2. Q : 객체 지향 프로그래밍에서 객체는 무엇인가요? 파이썬에서 객체는 어떻게 만들어지나요?</summary>

**A :  객체는 데이터와 해당 데이터를 조작하는 메소드를 포함하는 소프트웨어 개체입니다. 파이썬에서 객체는 클래스를 정의하고 이를 인스턴스화하여 생성됩니다.**

</details>

<details>

<summary>3. Q : 파이썬에서 함수의 매개변수에 디폴트 값을 설정하는 방법은 무엇인가요?</summary>

**A : 파이썬에서 함수의 매개변수에 디폴트 값을 설정하려면 매개변수 이름 뒤에 등호와 함께 값을 할당하면 됩니다. 예를 들어, `def my_func(a, b=2, c=3)`와 같이 함수를 정의하면, b와 c 매개변수에는 각각 기본값 2와 3이 설정됩니다.**

</details>

<details>

<summary>4. Q : 밑의 코드에서 예상되는 출력은 무엇인가요?</summary>

**A : 코드는 `25`를 출력합니다. `apply` 함수는 함수와 값을 인수로 받으며, 함수를 해당 값에 적용하여 결과를 반환합니다. 여기서 `square` 함수와 인수 `5`를 `apply` 함수에 전달하면 `square(5)가 실행됩니다`**

</details>

```python
def square(x):
    return x * x

def apply(func, x):
    return func(x)

print(apply(square, 5))

```

<details>

<summary>5 . Q : 밑의 클래스를 정의했다고 가정하고 이 클래스를 통하여 객체를 생성하고, 너비와 높이를 5와 10으로 설정, 넓이와 둘레를 출력하는 코드를 작성해보세요</summary>

**A : 클래스를 이용하여 인스턴스를 형성하고 이의 메서드를 이용하면 됩니다.**

```python
// Some code
rect = Rectangle(5, 10)
print(rect.area())
print(rect.around())
```

</details>

```python
class Rectangle:
    def __init__(self, width, height):
        self.width = width
        self.height = height

    def area(self):
        return self.width * self.height

    def around(self):
        return 2 * (self.width + self.height)

```

<details>

<summary>6 . Q : 밑의 코드의 결과값은 무엇일까요?</summary>

**A : 코드는 `1 2 3`을 출력합니다. `my_list`는 `[1, 2, 3]`이고, `my_func(*my_list)`는 `my_func(1, 2, 3)`과 동일합니다. 함수 `my_func`는 인수를 세 개 받으므로, `1`, `2`, `3`이 차례대로 출력됩니다.**

</details>

```python
def my_func(a, b, c):
    print(a, b, c)


my_list = [1, 2, 3]

my_func(*my_list)

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nmdkims-organization.gitbook.io/python-hand-book/day2./3.-quiz-quiz-mission3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
