퀴즈: 코드로 창작하기 2

Quiz

Beginner

+180 XP

30m

Unity Technologies

퀴즈: 코드로 창작하기 2 thumbnail

이 퀴즈에서는 코드로 창작하기 2 미션에서 다룬 개념에 대한 이해도를 평가합니다.

Languages available:

Question 1

Random.Range가 값 8을 반환한 경우 어떤 디버그 메시지가 콘솔에 기록되나요?

int randomInt = Random.Range(0,10);
if(randomInt <= 3)
{
   Debug.Log("Low");
}
else if(randomInt > 8)
{
   Debug.Log("High");
}
else
{
   Debug.Log("Medium");
}

Select only one

Question 2

다음 중 "Success"를 성공적으로 출력하는 조건은 무엇인가요?

  1. if (true && !false) { print("Success"); }
  2. if (true || false) { print("Success"); }
  3. if (true && !true) { print("Success"); }
  4. if (false || !true) { print("Success"); }

Select only one

Question 3

콘솔에서 "First String" "Second string" "Third string"을 출력하려면 아래 공백에 어떤 코드가 들어가야 하나요?

string[] strings = new string[3];
 
strings[0] = "First string";
strings[1] = "Second string";
strings[2] = "Third string";
 
foreach (__________)
{
    print (item);
}

Select only one

Question 4

다음 코드를 실행하는 경우 콘솔에 어떤 내용이 표시될까요?

void Start()
{
    StartCoroutine(MyCoroutine());
}

private IEnumerator MyCoroutine()
{
 yield return new WaitForSeconds(5);
    Debug.Log("Test");
   StartCoroutine(MyCoroutine());
}

Select only one

Question 5

"Incorrect dialogue value"를 콘솔에 출력하려면 공백에 어떤 코드를 사용해야 하나요?

int dialogue = 3;

void Start()
{
   _______________
   {
      case 2:
         print("Goodbye, old friend");
         break;
      case 1:
         print("Hello there");
         break;
      default:
         print("Incorrect dialogue value");
         break;
   }
}

Select only one

Question 6

플레이어 오브젝트가 동전 오브젝트와 충돌하면 동전 오브젝트가 플레이어 오브젝트의 물리에 영향을 주지 않고 즉시 사라져야 합니다. 동전을 파괴하기 위해 두 오브젝트 간의 충돌을 검사하려면 어떤 이벤트 함수를 사용해야 하나요?

Select only one

Question 7

Unity의 스크립팅 API에 따르면 Component.GetComponent 메서드에 유효한 옵션은 다음과 같습니다.

public Component GetComponent(Type type);
public Component GetComponent(string type);

다음 중 이 메서드를 올바르게 구현한 것은 무엇인가요?

Select only one

Question 8

Unity 스크립팅 API에 따르면 Transform.Translate 메서드에 유효한 옵션은 다음과 같습니다.

public void Translate(Vector3 translation);
public void Translate(Vector3 translation, Transform relativeTo);
public void Translate(float x, float y, float z);
public void Translate(float x, float y, float z, Transform relativeTo);

다음 중 오류를 일으키는 메서드 호출은 무엇인가요?

Select only one

Question 9

아래 애니메이션 전환의 경우, 캐릭터를 "Idle" 상태에서 "Walk" 상태로 전환하는 코드는 무엇인가요?

Select only one

Question 10

Unity의 스크립팅 API에 따르면 Input.GetButtonDown 메서드에 유효한 옵션은 다음과 같습니다.

public static bool GetButtonDown(string buttonName);

사용자가 "Fire1" 버튼을 누를 때 발사체가 발사되도록 구현하려면 아래 공백에 어떤 내용이 들어가야 할까요?

public GameObject projectile;
void Update()
{
  if (__________) 
    Instantiate(projectile, transform.position, transform.rotation);
}

Select only one

Question 11

아래 스크립트는 씬에서 플레이어 게임 오브젝트에 연결됩니다. 아래 코드의 결과로 콘솔에 어떤 내용이 표시되나요?

public class PlayerManager : MonoBehaviour
{
 string playerName = "Frank";
 void Start()
  {
    Debug.Log("Hello: " + gameObject.name + playerName);
  }
}

Select only one

Question 12

다음 중 데이터 유형에 대한 설명으로 올바르지 않은 것은 무엇인가요?

Select only one

Question 13

다음 중 올바르게 초기화되지 않은 변수는 무엇인가요?

  1. List<GameObject> objectList = new List<GameObject>();
  2. GameObject[] objectArray = new GameObject[];
  3. Dictionary<string, GameObject> objectDict = new Dictionary<string, GameObject>();
  4. bool isTrue = true;

Select only one

Question 14

다음 중 변수 한정자에 대한 설명으로 올바르지 않은 것은 무엇인가요?

Select only one

Question 15

다음 코드는 어떤 결과를 출력할까요?

public class ExampleClass : MonoBehaviour
{
 void Start()
  {       
   SceneManager.LoadScene(Random.Range(0, SceneManager.sceneCount));
  }
}

Select only one

Question 16

숫자를 가져온 후 해당 숫자를 가장 가까운 정수로 반올림하여 반환하는 메서드를 구성하려면, 다음 공백에 코드를 어떤 순서로 입력해야 할까요?

_____ DuplicateNumber(float _____)
{
  number *= 2;
 int newNumber = Mathf.RoundToInt(number);
  _____ newNumber;
}

Select only one

Question 17

두 개의 대체된 플로트 값 중에서 더 높은 값을 반환하도록 하려면 다음 중 어느 메서드 선언을 공백에 채워 넣어야 하나요?

_____________________
{
 float result;
 if (num1 > num2)
    result = num1;
 else
    result = num2;
 return result;
}

Select only one

Question 18

다음과 같이 작동하는 로딩 씬 시퀀스를 구현하려고 합니다. 레벨 선택 화면에는 각각 서로 다른 레벨에 해당하는 다양한 버튼이 있습니다. 사용자가 레벨을 클릭했을 때 선택한 레벨 숫자를 표시하고 5초 후에 그 레벨에 해당하는 씬을 로드하는 새로운 로딩 화면을 띄우려고 합니다. 개괄적으로 어떻게 구현해야 할까요?

Select only one

Question 19

다음 중 변수 및 메서드의 사용에 대해 올바르지 않은 가이드라인은 무엇인가요?

  1. 메서드 이름에는 일반적으로 동사 또는 해당 동작이 포함되어야 합니다(예: "void GenerateRandomObject"가 "RandomObject"보다 나음).
  2. 메서드는 일반적으로 2~3가지 역할을 수행해야 하며, 각각 하나의 역할만 수행하는 여러 메서드가 있는 경우 이 메서드를 합치는 것이 좋습니다.
  3. 부울의 이름을 지정하는 경우 "is", "has", "can"과 같은 일반적인 단어를 사용(예: "isRaining", "hasStarted", "canMove")하여 부울임을 나타냅니다.

Select only one

Question 20

다음 문장은 참인가요, 거짓인가요?

아래 코드 스니핏은 보다 표준적인 객체 지향 프레임워크와 상반되는 Unity의 ECS(엔티티 컴포넌트 시스템)를 사용하고 있습니다.

using System;
using Unity.Entities;

namespace Shooter.ECS
{
    [Serializable]
    public struct MoveSpeed : IComponentData
    {
        public float Value;
    }

    public class MoveSpeedComponent : ComponentDataWrapper<MoveSpeed> { }
}

Select only one

Submit answers

To calculate your score, submit your answers to the quiz. A passing score will mark this quiz complete.

Correct answers needed to pass

19/20

Retake allowed after

0 Mins