









































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










































































Question 1. Which keyword is used to define a method that can be accessed from other scripts? A) private B) public C) protected D) internal Answer: B Explanation: The public keyword makes a method accessible from other scripts and classes. Question 2. What is the default value of an uninitialized int field in a C# class? A) null B) 0 C) 1 D) Undefined Answer: B Explanation: In C#, uninitialized integer fields are automatically set to 0. Question 3. Which MonoBehaviour method is called before any Start methods? A) Update B) Awake C) FixedUpdate D) OnDestroy Answer: B Explanation: Awake is called before Start and is used for early initialization. Question 4. What type of data structure would you use to store a collection of key-value pairs in C#?
A) Array B) List C) Dictionary D) Queue Answer: C Explanation: A Dictionary stores key-value pairs, making retrieval by key efficient. Question 5. Which Unity method is best for updating physics calculations? A) Update B) FixedUpdate C) LateUpdate D) OnDestroy Answer: B Explanation: FixedUpdate runs at fixed intervals and is ideal for physics operations. Question 6. What is the correct syntax to declare a boolean variable in C#? A) bool isActive = true; B) boolean isActive = true; C) var isActive = true; D) int isActive = true; Answer: A Explanation: The bool keyword is used to declare boolean variables in C#. Question 7. How do you access a component attached to a GameObject in Unity? A) GetComponent
C) Serializes a class D) Allows runtime editing Answer: A Explanation: [SerializeField] exposes private fields in the Unity Inspector for editing. Question 11. Which type of loop is best for iterating over all elements in a collection? A) while B) for C) foreach D) do-while Answer: C Explanation: foreach is designed for iterating over each element in a collection. Question 12. What is the main difference between a class and a struct in C#? A) Classes are value types B) Structs support inheritance C) Classes are reference types D) Structs can have constructors Answer: C Explanation: Classes are reference types, while structs are value types. Question 13. Which MonoBehaviour method should be used to clean up resources before a GameObject is destroyed? A) Start B) Awake
C) OnDestroy D) Update Answer: C Explanation: OnDestroy is called before the object is destroyed, suitable for cleanup. Question 14. How do you declare an array of integers with 10 elements in C#? A) int[] numbers = new int[10]; B) int numbers[10]; C) int[] numbers = int[10]; D) arrayGameObject.Instantiate(prefab) correctly instantiates a prefab in Unity. Question 16. Which Unity method is commonly used for smooth camera following after all physics updates? A) Update B) FixedUpdate
D) Improves lighting Answer: B Explanation: Prefabs enable developers to create reusable and scalable objects. Question 20. Which function loads a new scene in Unity synchronously? A) SceneManager.LoadScene("SceneName"); B) LoadSceneAsync("SceneName"); C) Application.LoadLevel("SceneName"); D) Scene.Load("SceneName"); Answer: A Explanation: SceneManager.LoadScene loads a scene synchronously. Question 21. Which component is essential for simulating physics on a GameObject? A) Rigidbody B) Collider C) Transform D) MeshRenderer Answer: A Explanation: The Rigidbody component enables physics simulation. Question 22. What is the result of using the isTrigger property on a Collider? A) Collider ignores physics B) Collider detects triggers but not physical collisions C) Collider becomes invisible D) Collider increases size
Answer: B Explanation: Setting isTrigger to true detects trigger events, not physical collisions. Question 23. What method is used to apply a force to a Rigidbody? A) AddForce() B) ApplyForce() C) Move() D) SetVelocity() Answer: A Explanation: AddForce() applies a force to the Rigidbody for movement or impact. Question 24. How do you access the Transform component of a GameObject in a script? A) gameObject.Transform B) gameObject.GetTransform() C) transform D) gameObject.GetComponenttransform property is a shortcut to the GameObject’s Transform. Question 25. What is the default access modifier for class members in C#? A) public B) private C) protected D) internal Answer: B
Question 29. What is the primary use of the OnTriggerEnter method in Unity? A) Detecting when a collider enters a trigger B) Applying force C) Setting transform D) Updating animations Answer: A Explanation: OnTriggerEnter is called when a Collider enters a trigger zone. Question 30. What Unity class allows you to manipulate an object's position, rotation, and scale? A) Transform B) Rigidbody C) MeshRenderer D) Animator Answer: A Explanation: The Transform class controls position, rotation, and scale. Question 31. Which of the following methods is used to execute logic when a collision occurs? A) OnCollisionEnter B) OnTriggerExit C) OnDestroy D) Update Answer: A Explanation: OnCollisionEnter is called when a collision occurs.
Question 32. What does the public keyword do when applied to a field in a MonoBehaviour script? A) Makes it visible in Inspector and accessible from other scripts B) Makes it visible only to child classes C) Makes it hidden from Inspector D) Makes it read-only Answer: A Explanation: public fields are visible in the Inspector and accessible from other scripts. Question 33. Which Unity system allows for pathfinding and navigation for AI? A) NavMesh B) MeshRenderer C) Canvas D) Animator Answer: A Explanation: NavMesh provides baked navigation data for AI pathfinding. Question 34. How do you assign a value to a variable in C#? A) int x = 5; B) x := 5; C) x <- 5; D) int x == 5; Answer: A Explanation: The assignment operator = is used to assign values. Question 35. What is the correct way to iterate through a List in C#?
B) OnEnable C) OnDestroy D) Update Answer: B Explanation: OnEnable is called when the GameObject is enabled. Question 39. How do you access the main camera in a Unity scene via script? A) Camera.main B) GameObject.Find("MainCamera") C) FindCamera() D) MainCamera.Get() Answer: A Explanation: Camera.main provides easy access to the scene’s main camera. Question 40. What is the recommended method for handling user input in newer Unity projects? A) Input Manager B) Input System package C) Event System D) InputField Answer: B Explanation: The Input System package offers advanced input handling features. Question 41. Which function is used to destroy a GameObject in Unity? A) Destroy(gameObject) B) Remove(gameObject)
C) Delete(gameObject) D) Dispose(gameObject) Answer: A Explanation: Destroy(gameObject) removes the GameObject from the scene. Question 42. What is a benefit of using C# properties over public fields? A) Allows encapsulation and validation B) Increases performance C) Reduces code size D) Makes fields visible in Inspector Answer: A Explanation: Properties allow for encapsulation and additional logic on access. Question 43. How do you load an asset from the Resources folder at runtime? A) Resources.LoadResources.Load<T>() loads assets from the Resources folder. Question 44. What is the function of the LateUpdate method in Unity? A) Runs after Update for final adjustments B) Handles physics updates C) Runs before Awake
Answer: A Explanation: SetActive(true/false) controls the GameObject’s active state. Question 48. What does the keyword static mean when used with a method? A) The method belongs to the class, not an instance B) The method cannot be accessed C) The method is private D) The method is virtual Answer: A Explanation: Static methods are called on the class itself, not on object instances. Question 49. Which class is used for handling lists of objects in C#? A) ListList<T> is a generic collection for storing lists of typed objects. Question 50. What is the purpose of the [Serializable] attribute in Unity? A) Allows objects to be serialized for saving/loading B) Makes fields visible in Inspector C) Makes a class public D) Enables inheritance Answer: A
Explanation: [Serializable] allows the class to be serialized for data persistence. Question 51. Which method is called when a MonoBehaviour script is disabled? A) OnDisable B) OnDestroy C) Update D) Awake Answer: A Explanation: OnDisable is called when the script or GameObject is disabled. Question 52. How do you change the position of a GameObject via script? A) transform.position = new Vector3(x, y, z); B) gameObject.SetPosition(x, y, z); C) position = (x, y, z); D) gameObject.MoveTo(x, y, z); Answer: A Explanation: Assigning to transform.position updates the GameObject’s position. Question 53. What is the main advantage of using delegates in C#? A) Enables event-driven programming B) Reduces memory usage C) Increases execution speed D) Makes code public Answer: A Explanation: Delegates allow methods to be invoked in response to events.
Question 57. Which MonoBehaviour method is called when the script is first initialized? A) Awake B) Start C) OnEnable D) FixedUpdate Answer: A Explanation: Awake is called when the script instance is loaded. Question 58. How do you create a new List of integers in C#? A) ListSetBool, SetFloat, SetInteger, and SetTrigger set Animator parameters. Question 60. What Unity method is used to detect when a Collider exits a trigger?
A) OnTriggerExit B) OnTriggerEnter C) OnCollisionExit D) OnDestroy Answer: A Explanation: OnTriggerExit is called when a Collider exits a trigger zone. Question 61. How do you retrieve the number of elements in a List? A) list.Count B) list.Length C) list.Size D) list.Total Answer: A Explanation: The Count property returns the number of elements in a List. Question 62. What is the primary function of the Update method in Unity? A) Runs game logic every frame B) Handles physics updates C) Cleans up resources D) Initializes components Answer: A Explanation: Update is used for per-frame game logic. Question 63. What is the effect of making a field public in a MonoBehaviour? A) Field is visible in Inspector and accessible from other scripts