---
title: "Quiz 5"
content_type: quiz
url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface/quiz/quiz-5-5o?language=en"
language: en
container_type: course
container_title: "Create with Code"
container_url: "https://learn.unity.com/course/create-with-code.md?language=en&version=6.0"
unit_title: "Unit 5 - User Interface"
unit_url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface?language=en&version=6.0"
standalone_markdown_url: "https://learn.unity.com/quiz/quiz-5-5o.md?language=en&version=6.0"
previous_title: "Lab 5 - Swap out your Assets"
previous_url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface/tutorial/lab-5-swap-out-your-assets?language=en&version=6.0"
previous_markdown_url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface/tutorial/lab-5-swap-out-your-assets.md?language=en&version=6.0"
next_title: "Next Steps - Introduction"
next_url: "https://learn.unity.com/course/create-with-code/unit/next-steps/tutorial/next-steps-introduction?language=en&version=6.0"
next_markdown_url: "https://learn.unity.com/course/create-with-code/unit/next-steps/tutorial/next-steps-introduction.md?language=en&version=6.0"
difficulty: beginner
duration_minutes: 15
question_count: 10
correct_answers_to_pass: 1
unity_version:
  - "6.0"
  - "6.3"
supported_unity_versions:
  - name: "6.0"
    url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface/quiz/quiz-5-5o.md?language=en&version=6.0"
  - name: "6.3"
    url: "https://learn.unity.com/quiz/quiz-5-5o.md?language=en&version=6.3"
  - name: "2022.3"
    url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface/quiz/quiz-5-5o.md?language=en&version=2022.3"
  - name: "2021.3"
    url: "https://learn.unity.com/course/create-with-code/unit/unit-5-user-interface/quiz/quiz-5-5o.md?language=en&version=2021.3"
last_updated: "2026-08-04T14:25:15.000Z"
---

# Quiz 5

Use this quiz to check your understanding of the skills and concepts from Unit 5.

This quiz will assess your knowledge of the skills and concepts learned in Unit 5.

## Question 1

Which of the following follows Unity naming conventions (especially as they relate to capitalization)?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/6d48cd5d-83df-409b-9bd0-d561713c4d5c_Quiz_5.1.png)

_Select only one_

- Line 1
- Line 2
- Line 3
- Line 4

## Question 2

If there is a boolean in script A that you want to access in script B, which of the following are true:

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/9fef3032-e74f-4877-9197-be9fab062a18_Quiz_5.2.png)

_Select only one_

- 1 only
- 1 and 2 only
- 2 and 3 only
- 3 and 4 only
- 1, 2, and 3 only
- All are true

## Question 3

Which code to fill in the blank will result in the object being destroyed?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/ae7e40e0-ca8e-49df-bc4b-9d9477ba8ff7_Quiz_5.4B.png)

_Select only one_

- name = “player” &&  isDead && health \< 5
- name != “player”  && isDead != true && health > 5
- name == “player” && !isDead && health \< 5
- name == “player” &&  isDead != true && health > 5

## Question 4

You run your game and get the following error message in the console, “NullReferenceException: Object reference not set to an instance of an object”. Given the image and code below, what would resolve the problem?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/86c858bd-63c7-4891-b87a-11555a872547_Quiz_5.4B.png)

![](https://connect-mediagw.unity.com/h1/20221110/learn/images/2b8e0a20-2e6a-4590-9480-ce5a76502888_Screenshot_2022_11_10_at_09.14.40.png)

_Select only one_

- In the hierarchy, rename “Game Manager” to “gameManager”
- In the hierarchy, rename “Game Manager” as “GameManager”
- On Line 1, rename “GameManager” as “Game Manager”
- On Line 3, remove the GetComponent code

## Question 5

Read the Unity documentation below about the OnMouseDrag event and the code beneath it. What will the value of the “counter” variable be if the user clicked and held down the mouse over an object with a collider for 10 seconds?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/c55ff810-290e-4e24-abd3-2f11eb78f316_Quiz_5.5A.png)

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/baf95c34-c2bc-451d-a24a-7caf0735f048_Quiz_5.5B.png)

_Select only one_

- 0
- 1
- 99
- 100
- A value over 100

## Question 6

Based on the code below, what will be displayed in the console when the button is clicked?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/745cfad2-ea60-478f-938f-aa108c8e1b32_Quiz_5.6.png)

_Select only one_

- “Welcome, Robert Smith”
- “Welcome, firstName Smith”
- “Button is ready”
- “Welcome + Robert + Smith”

## Question 7

You have declared a new Button variable as “private Button start;”, but there’s an error under the word “Button” that says “error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)” What is likely causing that error?

_Select only one_

- You can’t name a button “start” because that’s the name of a Unity Event Function
- “Button” should be lowercase “button”
- You are missing “using UnityEngine.UI;” from the top of your class
- New Button variables must be made public

## Question 8

Look at the documentation and code below. Which of the following lines would NOT produce an error?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/d8dd9111-26cf-4c7e-a54a-ee0eb7a09d11_Quiz_5.8A.png)

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/d10135e6-86fa-4615-8114-0ae7c719a97d_Quiz_5.8B.png)

_Select only one_

- Line 5
- Line 6
- Line 7
- Line 8

## Question 9

If you wanted a button to display the message, “Hello!” when a button was clicked, what code would you use to fill in the blank?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/71567478-4035-4798-9753-aada85009422_Quiz_5.9.png)

_Select only one_

- (SendMessage);
- (SendMessage(“Hello”));
- (SendMessage(string Hello));
- (SendMessage(Hello));

## Question 10

Which of the following is the correct way to declare a new List of game objects named “enemies”?

![](https://connect-mediagw.unity.com/h1/20190812/learn/images/96a294f6-70bf-4da7-abb6-cb9d31eb7a75_Quiz_5.10.png)

_Select only one_

- Line 1
- Line 2
- Line 3
- Line 4
