Unity gMetrix Module 8

Unity gMetrix Module 8

12th Grade

5 Qs

quiz-placeholder

Similar activities

Unity_Prototype_1_Quiz

Unity_Prototype_1_Quiz

9th - 12th Grade

10 Qs

Python variables and Data types

Python variables and Data types

10th - 12th Grade

10 Qs

Python Functions

Python Functions

9th - 12th Grade

8 Qs

AP CSA Unit 9 Inheritance - Polymorphism

AP CSA Unit 9 Inheritance - Polymorphism

10th - 12th Grade

8 Qs

Unit 9 AP CSA Inheritance

Unit 9 AP CSA Inheritance

10th - 12th Grade

8 Qs

APCSA Inheritance, Superclass, Subclass

APCSA Inheritance, Superclass, Subclass

10th - 12th Grade

8 Qs

Unity C# Beginner's Variables Quiz

Unity C# Beginner's Variables Quiz

12th Grade

8 Qs

Conocimientos en Videojuegos y Unity

Conocimientos en Videojuegos y Unity

12th Grade - University

10 Qs

Unity gMetrix Module 8

Unity gMetrix Module 8

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Raymundo Martinez

Used 1+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

Which of the following methods is a loop automatically called by Unity and is great for performing physics operations because the time between each call is consistent?

FixedUpdate

UpdatePhysics

UpdateFixed

Update

Answer explanation

FixedUpdate works great with physics because the time between calls is always the same.


2.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

Media Image

A programmer is trying to create some simple code to print the player's name. However, the following error is being printed to the Console: "UnassignedReferenceException: The variable player of PrintPlayerName has not been assigned." Why is this happening?

The player GameObject was not assigned in the Inspector.

The GameObject does not have a name field inside.

The wrong GameObject was assigned in the Inspector.

The player variable should be public to be able to assign it in the Inspector.

Answer explanation

The error is occurring because the player GameObject was not assigned in the Inspector. Trying to access a serialized field will cause an UnassignedReferenceException

when not assigned in the Inspector.


3.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

Media Image

Consider the following two classes:

Why is the Console window showing the error "'car.speed' is inaccessible due to its protection level"?

The car variable in GameController should be public.

The speed variable in the Car class is not serialized.

The GameController class should inherit from the Car class.

The speed variable in the Car class needs a public access modifier.

Answer explanation

To access a field in a different class, there needs to be a public access modifier.


4.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

Media Image

Consider the following code:

The Console is showing the following error: "Cannot implicitly convert type 'float' to 'int'. An explicit conversion exists (are you missing a cast)?" What is causing this error?

The playerSpeed variable can only store integer values.

It is impossible to cast a float value into an integer value.

Float values do not require an "f" suffix when using integer type.

The speed of the player is a float value, but Unity only accepts integers values for speed.

Answer explanation

The playerSpeed variable can only store integer values. To store a number with decimals, we need to use the proper variable type, such as a float.


5.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

You are trying to get a reference to a Text element on the UI using the Inspector window with the following code:

[SerializeField] Text myUIText;

However, the following error is appearing: "The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference)?" What is causing this error?

To get a reference using the Inspector, variables should be public.

The namespace UnityEngine.UI is not imported into the script.

The Text class does not exist.

The type Text should be all lowercase.

Answer explanation

The class Text can only be used when namespace UnityEngine.Ul is added to the top of the script.