Quiz 2

Quiz

Beginner

+60 XP

15m

Unity Technologies

Quiz 2 thumbnail

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

Languages available:

Question 1

If it says, “Hello there!” in the console, what was the code used to create that message?

Select only one

Question 2

If you want to destroy an object when its health reaches 0, what code would be best in the blank below?

Select only one

Question 3

The code below creates an error that says, “error CS1503: Argument 1: cannot convert from 'UnityEngine.GameObject[]' to 'UnityEngine.Object'”. What could you do to remove the errors?

Select only one

Question 4

Which comment best describes the following code?

Select only one

Question 5

If you want to move the character up continuously as the player presses the up arrow, what code would be best in the two blanks below:

Select only one

Question 6

Read the documentation from the Unity Scripting API and the code below. Which of the following are possible values for the randomFloat and randomInt variables?

-----

-----

Select only one

Question 7

You are trying to randomly spawn objects from an array. However, when your game is running, you see in the console that there was an “error at Assets/Scripts/SpawnManager.cs:5. IndexOutOfRangeException: Index was outside the bounds of the array.” Which line of code should you edit in order to resolve this problem and still retain the random object functionality?

Select only one

Question 8

If you have made changes to a prefab in the scene and you want to apply those changes to all prefabs, what should you click?

Select only one

Question 9

Read the documentation from the Unity Scripting API below. Which of the following is a correct use of the InvokeRepeating method?

Select only one

Question 10

You’re trying to create some logic that will tell the user to speed up if they’re going too slow or to slow down if they’re going too fast. How should you arrange the lines of code below to accomplish that?

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

1/10

Retake allowed after

0 Mins