Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
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. | The “p” should be capitalized in
“playerController.isAlive” | c. | The if-statement cannot be in the Update method | b. | The
“bool” in the PlayerController class needs a “public” access
modifier | d. | “isAlive” must start with a capital “I”
(“IsAlive”) |
|
|
2.
|
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 |
|
|
3.
|
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); |
|
|
4.
|
Which of these is the correct way to get a reference to an AudioSource component
on a GameObject?
a. | Line A | c. | Line C | b. | Line B | d. | Line D |
|
|
5.
|
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. | The Player object does not have a collider | c. | The “Start” method
should actually be “Update” | b. | . The Enemy object does not have a Rigidbody
component | d. | There is no
object named “Player” in the scene |
|
|
6.
|
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 |
|
|
7.
|
By default, what will be the first state used by this Animation
Controller?
a. | “Any State” | c. | “Death” | b. | “NotCrouched” | d. | “Crouch_Up” |
|
|
8.
|
Which of the following variable declarations observes Unity’s standard
naming conventions (especially as it relates to capitalization)?
a. | 2 and 4 | c. | 4 and 5 | b. | 3 and 6 | d. | 1 and 5 |
|
|
9.
|
Which of the following is most likely the condition for the transition between
“Run” and “Walk” shown below?
a. | Jump_b is true | c. | Speed_f is Greater than 0.5 | b. | Speed_f is Less than
0.5 | d. | Animation_int is Less
than 10 |
|
|
10.
|
Which of the following do you think makes the most sense for a simple movement
state machine?
a. | Image A | c. | Image C | b. | Image B |
|
|
11.
|
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. | Change line 1 to “private float age” | c. | On line 7, change the word
“private” to “void” | b. | Add the word “int” to line 8,
so it says “int age = …” | d. | Add a new line after line 8 that says
“return age;” |
|
|
12.
|
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 A | c. | Option C | b. | Option B | d. | Option D |
|
|
13.
|
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 1, change “Vector3” to “float” | c. | Either On line 1,
change “Vector3” to “float” OR On line 3, change “=” to
“+” | b. | On line 3, change “=” to “+” | d. | None of the
options |
|
|
14.
|
Which of the following follows Unity’s naming conventions (especially as
it relates to capitalization)?
a. | Line A | c. | Line C | b. | Line B | d. | Line D |
|
|
15.
|
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 declare a powerup variable in the Player Controller Script | c. | The powerup
variable should be public instead of private | b. | You cannot assign GameObject type variables in
the inspector | d. | The
PlayerController class should be private instead of public |
|
|
16.
|
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. | PlayerController variable in the playerIndicator script needs to be
declared | c. | The PlayerController script must be assigned to the player object | b. | The playerIndicator
variable needs to be made private | d. | An object needs to be dragged onto the playerIndicator variable in the
inspector |
|
|
17.
|
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 C | b. | Method B | d. | Method D |
|
|
18.
|
Which comment best describes the code below?
a. | // If the player collides with an enemy, destroy the enemy | c. | // If the enemy
collides with a spike, destroy the enemy | b. | // If the enemy collides with a spike, destroy
the spike | d. | // If the player
collides with a spike, destroy the spike |
|
|
19.
|
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 1, change “collision” to “Rigidbody” | c. | On line 3, delete
“.gameObject” | b. | On line 2, change “gameObject” to
“Rigidbody” | d. | .
On line 3, add “.GetComponent<Rigidbody>()” before the
semicolon |
|
|
20.
|
Which of the following statements about functions/methods are correct:
a. | A and B are correct | d. | Only D is correct | b. | Only B is correct | e. | None are correct | c. | B and C are
correct |
|