Quiz: Create with Code 1

Quiz

Beginner

+180 XP

20m

Unity Technologies

Quiz: Create with Code 1 thumbnail

This quiz will assess your understanding of the concepts covered in the Create with Code 1 Mission.

Question 1

What will be the result of the code below?

public class Enemy : MonoBehaviour
{
    public Transform ground;

    void Update()
    {
        if (transform.position.y < ground.position.y)
        {
            Destroy(gameObject);
        }
    }
}

Select only one

Question 2

What would be the appropriate line of code to replace the comment below?

public float[] values = values[5];

void Start()
{
 // assign the first element in the array the value of 5.0
}

Select only one

Question 3

Which comment best describes the code below?

public class Player : MonoBehaviour
{
  // Comment
  private void OnTriggerEnter(Collider other) {
    if(other.CompareTag("Spike")) {
      Destroy(other.gameObject);
    }
  }
}

Select only one

Question 4

The image below shows the preferences window that allows you to change which script editing tool (or IDE) you want to use. Where would you click to choose an alternative code editing tool?

Select only one

Question 5

In Visual Studio, “5.0f;” would be underlined with a red squiggly line. When you hover the mouse over the error, what do you think the message would say?

int health = 5.0f;

Select only one

Question 6

Using the information shown in the autocomplete pop-up window below, which of the following would be a valid call of the Instantiate method?

Select only one

Question 7

What would be the code required to produce the debug message shown below?

Hello world.

Select only one

Question 8

Which of the following is true about either the Start() or Update() functions in a Unity Monobehavior class?

Select only one

Question 9

In what order do the parts of this script appear?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
 public float speed;
 public string playerName;

 void Start()
    {
        playerName = "Test";
    }

 void Update()
    {
        speed++;
    }

}

Select only one

Question 10

Which of the following lines of code is using standard Unity naming conventions?

  1. Public Float Speed = 40.0f;
  2. Public float Speed = 40.0f;
  3. public float Speed = 40.0f;
  4. public float speed = 40.0f;

Select only one

Question 11

Given the inspector shown below, showing variables for “Speed” and “Player Name,” which of the following lines of code would you expect to see in PlayerController.cs?

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

9/11

Retake allowed after

0 Mins