
Unity Modul 2 Quiz
Quiz
•
Information Technology (IT)
•
9th - 12th Grade
•
Practice Problem
•
Medium
Drazen Drinic
Used 7+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
If it says, “Hello there!” in the console, what was the code used to create that message?
Debug(“Hello there!”);
Debug.Log("Hello there!");
Debug.Console(“Hello there!”);
Debug.Log(Hello there!);
Answer explanation
Debug.Log() prints messages to the console and can accept String parameters between quotation marks, such as “Hello there!”
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
If you want to destroy an object when its health reaches 0, what code would be best in the blank below?
health > 0
health.0
health < 1
health < 0
Answer explanation
Since the “health” variable is an int, anything less than 1 would be “0”. The sign for “less than” is “<”.
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
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?
On line 1, change “GameObject[]” to “GameObject”
On line 1, change “enemyPrefabs” to “enemyPrefabs[0]
On line 3, change “Start()” to “Update()”
On line 5, change “enemyPrefabs” to “enemyPrefabs[0]”
Either:
On line 1, change “GameObject[]” to “GameObject”
or
On line 5, change “enemyPrefabs” to “enemyPrefabs[0]”
Answer explanation
“GameObject[]” is a GameObject array. You cannot instantiate an array, but you can instantiate an object inside an array. So you could either remove the array and have Instantiate use an individual object or you could use an GameObject index of that Array but both would not work.
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which comment best describes the following code?
// If player collides with another object, destroy player
// If enemy collides with another object, destroy the object
// If player collides with a trigger, destroy trigger
// If player collides with another object, destroy the object
Answer explanation
Since it’s inside the PlayerController class, and it is destroying other.gameObject, it is destroying something that the player collides with.
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
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:
GetKey(KeyCode.UpArrow)
GetKeyDown(UpArrow)
GetKeyUp(KeyCode.Up)
GetKeyHeld(Vector3.Up)
Answer explanation
“Input.GetKey” tests for the user holding down a key (as opposed to KeyKeyDown, which test for a single press down of a Key).
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
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?
float randomFloat = Random.Range(0, 100);
int randomInt = Random.Range(0, 100);
randomFloat = 100.0f;
randomInt = 0;
randomFloat = 100.0f;
randomInt = 100;
randomFloat = 50.5f;
randomInt = 100;
randomFloat = 0.0f;
randomInt = 50.5;
Answer explanation
As it says in the documentation, Random.Range does not include the maximum value for integers, but does include the maximum value for floats. This means that randomInt cannot be 100, but randomFloat can be.
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
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?
Line 1
Line 3
Line 4
Line 5
Answer explanation
Line 4, which generates the objectIndex, must be generating an index value that is too high for the number of objects in the array. The best thing to do would be to change it to “Random.Range(0, randomObjects.Length);
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
10 questions
1NF Database Normalisation
Quiz
•
12th Grade
10 questions
EmpoTech Quiz Bee
Quiz
•
11th Grade
12 questions
File Compression and Digital Audio/Video Formats
Quiz
•
9th - 12th Grade
12 questions
4. Polecenia związane z użytkownikami i grupami
Quiz
•
11th Grade - University
15 questions
G4-Microprocessors and Their Uses
Quiz
•
4th Grade - University
13 questions
Mobile Computing Quiz
Quiz
•
12th Grade
10 questions
Posttest for UKIN
Quiz
•
10th Grade - University
15 questions
Computer basics
Quiz
•
7th Grade - University
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
10 questions
Understanding Meiosis
Interactive video
•
6th - 10th Grade
15 questions
Meiosis vs mitosis
Quiz
•
9th Grade
10 questions
Exploring the Origins of Veterans Day
Interactive video
•
6th - 10th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
16 questions
Ethos, Pathos, Logos Practice
Quiz
•
9th Grade
15 questions
Two Step Equations
Quiz
•
9th Grade
