Unity Test Questions Part 2 51-100

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is wrong with the following code: GetComponent<Animator>.SetTrigger("die");? Nothing Animator is spelled incorrectly Its missing some parentheses The quotation marks are not needed because we are calling a method

Its missing some parentheses

How do you create a method in C#? MyMethod{} {MyMethod} MyMethod. myMethod[}

MyMethod{}

Select the most appropiate matching of the items from the method declaration to descriptions string MyMethod(int myint){ } 1. string 2. MyMethod 3 int 4 myint A. The arguement name B. The arguement type C. The method name D. The return page 1A, 2B, 3C, 4D 1C, 2D, 3B, 4A 1C, 2A, 3B, 4D 1D, 2C, 3B, 4A 1A, 2C, 3B, 4D 1B, 2A, 3C, 4D

1D, 2C, 3B, 4A

What is the value of the following expression: "23" + 3 ? 23 323 26 233

233

Which of the following expressions is not vaild? "hello" + 1 1+1.0f 1 + 2

"hello" + 1

Which operator can be used to compare two values = <> == ><

==

What is the difference between a while and a for-loop? A for-loop include syntax for declaring, incrementing and testing a variable A while-loop includes syntax for declaring, incrementing and testing variable A While-loop has a terminating condition A for-loop executes a fixed (at compile time) number of loops

A for-loop include syntax for declaring, incrementing and testing a variable

What is an object?

An object is an instance of a class that is created by using "new" keyword. After we create an object from a class we can access all public variables and functions by using objectName.FunctionNsme or VariableName

What is the type of return value from GetComponent<FooBar>()? Foo Bar Component GameObject FooBar

FooBar

What is inheritance?

Inheritance is when we create a class and use another class to inherit from the first class. This way the second class or the one that has inherited the first class will have access to all public functions and variables of the first class. the inherited class is called a parent class the classes that inheriting is called a child class.

What is the code to detect input from the Left and Right arrow key? Input.GetAxis{"Horizontal"); Input.GetAxis{"Vertical"); Input.GetKey{"Horizontal"); Input.GetKey{"Vertical");

Input.GetAxis{"Horizontal");

Another name for a functions is: Comment Method Statement Command

Method

What is the meaning of this line of code: if (Distance > 15) checks if distance is equal to 15 checks if distance is less than 15 checks if distance is greater than 15

checks if distance is greater than 15

What is the correct way to switch an object off using code? gameObject.SetActive = false gameObject.SetActive(false) gameObject.SwitchOff();

gameObject.SetActive(false)

How do you start writing if statement in C# if x > y then: if x > y: if (x > y)

if (x > y)

Which function returns a boolean if the space key is down this frame? input.GetKey(KeyCode.Space) input.GetKeyUp(KeyCode.Space) input.GetKeyDown(KeyCode.Space) input.anyKeyDown

input.GetKeyDown(KeyCode.Space)

How do you increment an existing variable x by 2 int x = x + 2 x=x+2 x+2 x+1

int x = x + 2

How do you call a method in C#? myMethod [ ] myMethod(); MyMethod; (MyMethod);

myMethod();

Why would you want to avoid loading a scence by a string name? it would create a constant in code it is much slower it would break if the build order is changed the scene could be renamed

the scene could be renamed

What does Time.deltaTime respresent? a fixed interval (delta) time the time since a fixed date and time the time since the last Update()

the time since the last Update()

Why might we prefer a for loop instead of foreach loop? to exit the loop early to loop over child transforms to loop over all items in an array to access the current value and next value in the loop body

to access the current value and next value in the loop body

Which type of bug should always result in us drooping everything and fix them immediately? all bugs any bugs which will annoy the player any bugs which annoy us (the developer) Any bug which breaks the game or doesn't allow us to compile the game

Any bug which breaks the game or doesn't allow us to compile the game

Which of the following functions is used to transition to another level? onTriggerEnter() Application.LoadLevel() Tranform.RotateTo() Mathf.Max()

Application.LoadLevel()

Programming code to Exit a Game is Application.quit Application.Quit Application.Quit(); Application,Exit;

Application.Quit();

Which method triggers a sound effect? AudtioListener.Play() AudioSource.Play() AudioSource.Beginplay() AudioSource.PlayOnAwake()

AudioSource.Play()

Which of the following always happens first? Awake() Coroutine continues after LoadSceneAsync() start () Update ()

Awake()

A function that returns nothing is a ______ function null empty blank void

void

How do you start writing a while loop in C#? while x > y { while (x>y) x > Y while { while x . y:

while (x>y)

How do you compose two rotations together? Addition Subtractions Addition or Subtraction Multiplication Divison

Multiplication

Which method on the Transform component is used to move the GameObject? Translate Destroy Stop None

Translate

How many times does foreach loop repeat? until a condition is false as many as there are items to iterate over until 1 is then tha a give number forever

as many as there are items to iterate over

How do you create a variable with the floating number 2.8? double x = 2.8D; int x = 2.8; byte x = 2.8 int x = 2.8D;

double x = 2.8D;

Adding a public front of a variable does what to it? makes a variable into a field makes a variable accessible to the unity editor makes a field accessible to the unity editor

makes a variable accessible to the unity editor

How do you "instantiate" a new Vector2 object? new Vector(2.0f, 2.0f, 1.0f) Vector2(2.0f, 2.0f, 1.0f) new Vector2(2.0f, 2.0f, 1.0f)

new Vector2(2.0f, 2.0f, 1.0f)

What is a "string" variable? text values made of sequences of characters singular letter text singular non-number characters

no answer was given on the study quide

Which of the following code snippets will correctly print to the console? print("Hello World") print("Hello World); print("Hello World"); print("Hello World";

print("Hello World");

What keyword do we need to make a method callable in other scripts? void static public private

public

Which keyword is used to return a value inside a method? break return get void

return

If I write "Destroy(gameObject,5);" what is the "5" referring to? seconds milliseconds frames

seconds

A________ variable contains text such as a person's name integer float string banana

string

Which data type is used to create a variable that should store text? str string text mystring

string

What is the purpose of the script in computer programming? To store data to move objects around to teach the computer to act to tell the computer what actions to perform

to tell the computer what actions to perform

What is the most efficient way to find the player? by tag by component by GameObject name by iteration through the whole scene file

by tag

Which variable do we use to store characters? an int or integer variable a double variable a float variable a string variable

a string variable

What is a function? a variable that stores whole numbers a way to group a block of code that we want to reuse a blueprint for creating objects

a way to group a block of code that we want to reuse

What is the purpose of using Mathf.Clamp(0 ,1)

allows us to constrain our value between 0 and 1

Which statement is used to stop a loop? break exit stop return

break

Vector3.up is another way of writing what? Vector3(0, 0, 1) Vector3(1, 0, 0) Vector3(0, 1, 0) Vector3(0,1,1)

Vector3(0, 1, 0)

What is the purpose of this code: GetComponent<Animator>{}; to add an animation to the character to create a new animaotr component to talk to the Animator component on the attached game object

to talk to the Animator component on the attached game object

In order to move from one scene to another scene we have to first add which namesspace? using UnityEngine using Unity Engine, UI using UnityEngine.SceneManagment

using UnityEngine.SceneManagment

Which is the correct method signature for detecting a collison in code? int OnCollsionEnter(Collison collison) void OnCollisionEnter(collider collider) void OnCollsionEnter(Collsion Collsion)

void OnCollsionEnter(Collsion Collsion)

How might you DECLARE a function that finds the square root of a whole number (integer)? void SquareRoot (int number) { } SquareRoot (int number) { } void SquareRoot (int number); void SquareRoot {} {}

void SquareRoot (int number);

To make the Ball Jump Upward we have to change the value of which Axis x y z

y

If a and b are vectors and c = a - b. Which of the following does not describe c? The vector going forwards along a then backwards along b. The vector going forward along b then backwards along a The distance between a and b The vector going backwards along b and forwards along a

The vector going forward along b then backwards along a

Debug the following line of code (ie. identify the problem) : const string weaponName = Weapon; We are missing an equals sign, should be - const string weaponName==weapon We need to make this variable public should be public const string weaponName - Weapon; We are missing quotation marks should be const string weaponName = "Weapon;

We are missing quotation marks should be const string weaponName = "Weapon;

What is a conditional statement? a way for us to have multiple parameters in a function a way to test if something is true or not and based on the results we can execute appropriate blocks of code is another term for programming

a way to test if something is true or not and based on the results we can execute appropriate blocks of code

How do you create a variable with the numeric value 5? x = 5; int x = 5; double x = 5; num x = 5

int x = 5;

Where should we put code that should rune every frame? The Update method the Start method the Tick method the top of the class

The Update method


Ensembles d'études connexes

Exponential Growth Functions: Assignment

View Set

APC EEC 4.4-4.6 (ATMOSPHERE, WIND, WATERSHEDS)

View Set

PassPoint - Psychosocial Integrity

View Set

Cognitive Psychology Chapter 12 Book Questions

View Set

Biotechnology (Ch. 10, 11 and 12)

View Set