NEW
Font size
Worksheets03 Text Adventure Worksheet
Total questions: 30
Worksheet time: 8hrs 30mins
Which kind of variable can be seen by any function within the class and will live as long as the parent object?
local
class-level
universal
global
What term is used to describe a variable that exists and is visible to a particular section of code?
public
private
in-scope
underwater
Given the code below, which of the two functions are able to use the "mystery" variable?
Start() only
Update() only
both Start() and Update()
No functions can use the mystery variable
Given the code below, which of the two functions are able to use the "mystery" variable?
Start() only
Update() only
both Start() and Update()
No functions can use the mystery variable
Not in-scope in any function
What keyword do you add to a variable declaration so it will be visible outside the class and managed in the Unity Script component Inspector?
public or [SerializeField]
visible
global
private
When you add a Canvas to a Unity project, where does it appear?
In the Hierarchy panel
In the Inspector panel
In the Assets area
In the MonoDevelop IDE
When you create a text object, it will become a child of which object in the Hierarchy?
Canvas
Camera
Sprite
Animator
What do you call something that provides some sort of functionality to a GameObject?
An object
An image
A widget
A component
Which component will allow you to position and rotate your sprite on the screen?
The Location component
The Rotation component
The Property component
The Transform component
Which of the following are properties of the Transform component?
Position
Rotation
Scale
All of these
What is a script considered when you add it to a GameObject?
An object
An image
A widget
A component
What new line of C# code should you add to the top of your script to enable access to the Text object?
using UnityEngine.UI;
using Text;
using Canvas;
access UI.Text;
Which of the following variables uses the proper name conventions?
playerscore
playerScore
PlayerScore
PLAYERSCORE
Using [SerializeField] in front of declaring a variable allows us to do what?
Serialize all the fields on the Game Object.
Declare a variable from a different namespace.
Assign/update the value of the variable from within the Inspector window.
Make the variable public to all scripts.
Which of the following statements about a Text object in the Hierarchy and a Text variable in a script are true?
They are linked by dragging the Text object onto the script variable in the Inspector panel
The object and variable names must always be the same
You will often see multiple script Text variables linked to the same Text object
All of these are true
Given a Text variable named "playerHealth", which of the following lines of code will successfully set the variable's string contents to "Critical"?
playerHealth = "Critical";
Text.playerHealth("Critical");
playerHealth.text = ("Critical");
playerHealth.setText("Critical");
____________ is a class that lets us store data in stand alone assets
GameObject
Scriptable Object
Monobehaviour
using.UnityEngine
What keyword do you use in front of a function name to show the function returns no data?
null
void
empty
All functions must return some data
What keyword do you add to a function declaration so it will be visible outside the class?
public
visible
private
void
Select the correct answer that declares a function that returns a value.
public String GetStateStory()
public string GetStateStory()
public void string GetStateStory()
public void GetStateStory()
Each of the ____ in an array has the same data type.
subscripts
elements
objects
structures
Initial values provided when initializing an array are separated by ____.
;
.
,
/
Which of the following lines correctly declares an array variable named "grades" that is of type "float"?
float[ ] grades;
grades[ ] float;
float(grades);
float grades;
Knowing that the 1st element in an array has index value 0, write an expression that shows how to access the 3rd element in an array called “friends”.
friends[0]
friends[1]
friends[2]
friends[3]
How would you make an array variable visible in the Unity Inspector panel for the script component?
Right-click on the array variable and select "Publish"
Write the array variable name in all capital letters
Select "Edit" and then "Array" from the Unity IDE menu
Make the array variable public using [SerializeField]
Which statement is most accurate in describing when it is possible to use the var keyword to declare a variable?
When the variable is at the top of our class.
When we are declaring but not initializing the variable
When we are both declaring and initializing a variable in such a way that it is clear what type of variable we have created
When we need to return a variable but it doesn't matter what type of variable is returned.
How do you assign a custom font to a Text control in Unity?
Double-click on the font in the asset folder
Drag the font from the asset folder onto the "Font Source" property in the Font Creator panel
Type in the full font filename, including extension, in the Inspector panel
Drag the font to the Hierarchy as a child object of the parent Text object
What is a loop?
A circular graphic on the screen
A single line of code in a script file
A function or set of statements that will run until a condition is met
The circular motion of some sprites on the screen
Which of the following statements is NOT placed inside the parentheses when defining a for() loop?
A return statement
An initialization statement
A conditional statement
An iteration statement
Which of the following for() loops defines an index variable that would safely access every element in the "friends" array, no matter how many elements it held?
for (int i=0; i < 5; i++)
for (int i=0; i < friends.Length; i++)
for (int i=0; i <= friends.Size(); i++)
for (int i=1; i <= friends.Length; i++)
