Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
Match the following animation methods with its set of parameters
a. | 1A, 2B, 3C | c. | 1B, 2A, 3C | b. | 1A, 2C, 3B | d. | 1C, 2A, 3B |
|
|
2.
|
When you run a project with the code below, you get the following error:
“NullReferenceException: Object reference not set to an instance of an object.” What
is most likely the problem?
a. | There is no object named “Player” in the scene | c. | . The Enemy object
does not have a Rigidbody component | b. | The Player object does not have a
collider | d. | The
“Start” method should actually be “Update” |
|
|
3.
|
You’re trying to write some code that creates a random age between 1 and
100 and prints that age, but there is an error. What would fix the error?
a. | Add a new line after line 8 that says “return age;” | c. | Change line 1 to
“private float age” | b. | Add the word “int” to line 8,
so it says “int age = …” | d. | On line 7, change the word
“private” to “void” |
|
|
4.
|
Which of the following follows Unity’s naming conventions (especially as
it relates to capitalization)?
a. | Line D | c. | Line A | b. | Line C | d. | Line B |
|
|
5.
|
The code below produces “error CS0029: Cannot implicitly convert type
'float' to 'UnityEngine.Vector3'”. Which of the following would remove the
error?
a. | On line 3, change “=” to “+” | c. | None of the
options | b. | Either On line 1, change “Vector3” to “float” OR On line 3,
change “=” to “+” | d. | On line 1, change “Vector3” to
“float” |
|
|
6.
|
You are trying to create a new method that takes a number and multiplies it by
two. Which method would do that?
a. | Method A | c. | Method D | b. | Method C | d. | Method B |
|
|
7.
|
Given the animation controller / state machine below, which code will make the
character transition from the “Idle” state to the “Walk” state?
a. | setFloat(“Speed_f”, 0.3f); | c. | setTrigger(“Speed_f”); | b. | setInt(“Speed_f”,
1); | d. | setFloat(“Speed_f”, 0.1f); |
|
|
8.
|
The following message was displayed in the console: “Monica has 20
dollars”. Which of the line options in the PrintNames function produced it?
a. | Option B | c. | Option A | b. | Option D | d. | Option C |
|
|
9.
|
By default, what will be the first state used by this Animation
Controller?
a. | “NotCrouched” | c. | “Crouch_Up” | b. | “Any State” | d. | “Death” |
|
|
10.
|
The code below produces the error, “error CS0029: Cannot implicitly
convert type 'UnityEngine.GameObject' to 'UnityEngine.Rigidbody'”. What
could be done to fix this issue?
a. | . On line 3, add “.GetComponent<Rigidbody>()” before the
semicolon | c. | On line 3, delete “.gameObject” | b. | On line 2, change
“gameObject” to “Rigidbody” | d. | On line 1, change “collision” to
“Rigidbody” |
|
|
11.
|
Which of the following do you think makes the most sense for a simple movement
state machine?
a. | Image B | c. | Image A | b. | Image C |
|
|
12.
|
Which of the following conditions properly tests that the game is NOT over and
the player IS on the ground
a. | Line A | c. | Line C | b. | Line B | d. | Line D |
|
|
13.
|
Which comment best describes the code below?
a. | // If the enemy collides with a spike, destroy the spike | c. | // If the player
collides with an enemy, destroy the enemy | b. | // If the enemy collides with a spike, destroy
the enemy | d. | // If the player
collides with a spike, destroy the spike |
|
|
14.
|
Which of these is the correct way to get a reference to an AudioSource component
on a GameObject?
a. | Line C | c. | Line B | b. | Line D | d. | Line A |
|
|
15.
|
Your game has just started and you see the error,
“UnassignedReferenceException: The variable playerIndicator of PlayerController has not been
assigned.” What is likely the solution to the problem?
a. | The PlayerController script must be assigned to the player object | c. | The playerIndicator
variable needs to be made private | b. | An object needs to be dragged onto the
playerIndicator variable in the inspector | d. | PlayerController variable in the playerIndicator script needs to be
declared |
|
|
16.
|
Which of the following variable declarations observes Unity’s standard
naming conventions (especially as it relates to capitalization)?
a. | 3 and 6 | c. | 1 and 5 | b. | 2 and 4 | d. | 4 and 5 |
|
|
17.
|
Which of the following statements about functions/methods are correct:
a. | Only B is correct | d. | None are correct | b. | A and B are correct | e. | B and C are correct | c. | Only D is
correct |
|
|
18.
|
Which of the following is most likely the condition for the transition between
“Run” and “Walk” shown below?
a. | Speed_f is Greater than 0.5 | c. | Animation_int is Less than
10 | b. | Speed_f is Less than 0.5 | d. | Jump_b is true |
|
|
19.
|
You are trying to assign the powerup variable in the inspector, but it is not
showing up in the Player Controller component. What is the problem?
a. | You cannot assign GameObject type variables in the inspector | c. | The powerup
variable should be public instead of private | b. | You cannot declare a powerup variable in the
Player Controller Script | d. | The PlayerController class should be private instead of
public |
|
|
20.
|
You are trying to STOP spawning enemies when the player has died and have
created the two scripts below to do that. However, there is an error on the underlined code,
“isAlive” in the EnemySpawner script. What is causing that error?
a. | “isAlive” must start with a capital “I”
(“IsAlive”) | c. | The “p” should be capitalized in
“playerController.isAlive” | b. | The “bool” in the PlayerController
class needs a “public” access modifier | d. | The if-statement cannot be in the Update
method |
|