




























































































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 C# keyword is used to create a type‑safe collection that can store any data type without boxing? A) object B) dynamic C) var D) generic Answer: D Explanation: Generics allow the compiler to enforce type safety while avoiding boxing for value types, unlike using object or dynamic. Question 2. In Unity, which event function is called exactly once for each script instance before any Awake functions are called? A) OnEnable B) Awake C) Reset D) Initialize Answer: C Explanation: Reset is invoked in the editor when the component is first added or when the Reset command is used, occurring before Awake. Question 3. Which design pattern ensures that a class has only one instance and provides a global point of access to it?
A) Factory B) Observer C) Singleton D) Command Answer: C Explanation: The Singleton pattern restricts instantiation to a single object and offers a static reference. Question 4. When using LINQ, which method returns a collection that is evaluated lazily, i.e., elements are computed only when iterated? A) ToList() B) AsEnumerable() C) Where() D) Select() Answer: C Explanation: Where returns an IEnumerable that yields elements on demand; ToList forces immediate evaluation. Question 5. Which Unity attribute marks a field so that it can be edited in the Inspector even if the field is private? A) [HideInInspector] B) [SerializeField]
Answer: C Explanation: OverlapSphere returns all colliders intersecting a sphere, performing no physics simulation. Question 8. What is the primary benefit of using a ScriptableObject for game data? A) Faster runtime execution than MonoBehaviour B) Automatic network synchronization C) Allows data to be shared across scenes without duplication D) Enables direct rendering of data as UI Answer: C Explanation: ScriptableObjects are assets that can hold data shared by multiple objects, reducing duplication and memory usage. Question 9. Which Unity lifecycle method is called after all Update functions have been processed for the frame? A) FixedUpdate B) LateUpdate C) OnRenderObject D) OnPostRender Answer: B
Explanation: LateUpdate runs after Update, useful for following objects that may have moved during Update. Question 10. When implementing object pooling, which of the following is the most important to prevent memory leaks? A) Using Destroy() on pooled objects when they are returned B) Keeping references to all pooled objects in a static list C) Deactivating objects instead of destroying them D) Instantiating new objects each time they are needed Answer: C Explanation: Deactivating (SetActive(false)) allows reuse without creating new allocations, avoiding leaks. Question 11. Which C# feature allows a method to be paused and resumed without blocking the main thread? A) Thread.Sleep B) async/await C) IEnumerator without yield D) lock statement Answer: B Explanation: async/await enables asynchronous execution, letting the method yield control while awaiting a task.
Question 14. What is the effect of marking a method with the [Obsolete] attribute in Unity C# scripts? A) The method is removed at compile time. B) The method becomes private. C) A warning or error is generated when the method is used. D) The method is executed only in the editor. Answer: C Explanation: [Obsolete] causes the compiler to emit a warning (or error if configured) when the method is called. Question 15. Which Unity API call should be avoided inside a frequently called Update loop due to performance concerns? A) transform.position = … B) GetComponent
A) Merges dynamic meshes at runtime. B) Combines static meshes into a single draw call at build time. C) Instantiates multiple copies of a mesh on the GPU. D) Groups textures into an atlas. Answer: B Explanation: Static batching combines meshes marked as static into one mesh, reducing draw calls. Question 17. Which of the following is a correct way to declare an event using a delegate in C#? A) public event Action OnJump; B) public delegate void OnJump(); C) public void event OnJump; D) public Action OnJump; Answer: A Explanation: “event” keyword is used with a delegate type (Action) to expose an event. Question 18. When using Unity’s Addressables system, what is the primary purpose of a “label”? A) To store runtime data. B) To group assets for bulk loading/unloading.
Answer: D Explanation: The Button component implements IPointerClickHandler to respond to click events. Question 21. Which C# keyword is used to create a method that can be overridden in derived classes? A) sealed B) virtual C) abstract D) override Answer: B Explanation: virtual marks a base class method as overridable; derived classes use override. Question 22. What does the term “draw call” refer to in Unity rendering? A) The number of times a script calls Debug.DrawLine. B) The number of times the GPU is instructed to render a batch of geometry. C) The number of texture loads per frame. D) The number of times Physics.Raycast is executed. Answer: B Explanation: A draw call is a command sent to the GPU to render a set of vertices; minimizing them improves performance.
Question 23. Which Unity feature allows you to serialize a custom struct without writing explicit serialization code? A) [Serializable] attribute B) ISerializationCallbackReceiver C) JsonUtility D) BinaryFormatter Answer: A Explanation: Adding [Serializable] to a struct enables Unity’s built‑in serializer to handle it. Question 24. When implementing a finite state machine (FSM) using the State pattern, what is the primary responsibility of the Context class? A) To store all possible states in a list. B) To manage transitions and delegate behavior to the current state. C) To render UI elements for each state. D) To serialize state data to disk. Answer: B Explanation: The Context holds a reference to the current State and forwards calls, handling transitions.
A) MonoBehaviour B) ScriptableObject C) Prefab D) AssetBundle Answer: B Explanation: ScriptableObjects act as data containers that appear as assets in the Project view. Question 28. In a 2D Unity game, which collider type should be used for a platform that the player can jump through from below but stand on from above? A) BoxCollider2D with “Is Trigger” unchecked B) PolygonCollider2D with “Used By Composite” enabled C) EdgeCollider2D with “Is Trigger” checked D) PlatformEffector2D combined with a Collider2D Answer: D Explanation: PlatformEffector2D provides one‑way collision behavior when paired with a Collider2D. Question 29. Which of the following is NOT a valid Unity coroutine yield instruction? A) new WaitForSeconds(1f) B) new WaitForFixedUpdate()
C) new WaitUntil(() => condition) D) new WaitForEndOfFrame(2) Answer: D Explanation: WaitForEndOfFrame has no constructor parameters; the others are valid yield instructions. Question 30. When using Unity’s Profiler, which tab provides information about memory allocations caused by managed objects? A) CPU B) GPU C) Memory D) Rendering Answer: C Explanation: The Memory tab shows managed heap usage, allocation counts, and garbage collection details. Question 31. Which C# feature allows you to create a method that can accept any number of arguments of the same type? A) params keyword B) out keyword C) ref keyword D) generic constraint
Question 34. What is the main advantage of using Unity’s “Burst Compiler” with the Jobs System? A) Automatic network synchronization. B) Faster execution of CPU‑intensive code via SIMD vectorization. C) Real‑time shader compilation. D) Simplified UI layout generation. Answer: B Explanation: Burst compiles jobs to highly optimized native code, leveraging SIMD for speed. Question 35. Which Unity attribute forces a field to be displayed as a read‑only property in the Inspector? A) [ReadOnly] B) [DisableInInspector] C) [ShowOnly] D) Unity does not provide a built‑in attribute for this. Answer: D Explanation: Unity’s core API lacks a built‑in ReadOnly attribute; custom PropertyDrawers are needed. Question 36. In the Observer pattern, what role does the “Subject” play?
A) It holds the state and notifies all registered observers of changes. B) It receives updates from observers. C) It creates concrete observers. D) It stores a list of commands to execute. Answer: A Explanation: The Subject maintains a list of observers and broadcasts state changes. Question 37. Which of the following statements about Unity’s “FixedUpdate” is true? A) It runs once per rendered frame. B) It runs at a variable time step based on CPU load. C) It is called at a fixed interval, ideal for physics calculations. D) It only runs when the game is paused. Answer: C Explanation: FixedUpdate is invoked on a fixed timestep (default 0.02 s) and is used for physics updates. Question 38. What does the “[ExecuteInEditMode]” attribute do when placed on a MonoBehaviour? A) Allows the script to run its Update methods while the editor is not playing. B) Forces the script to be compiled only for the editor.
Answer: D Explanation: All shown forms are valid lambda expressions that return the square of x. Question 41. When using Unity’s NavMesh system, which component is responsible for moving an agent along the calculated path? A) NavMeshAgent B) NavMeshObstacle C) NavMeshSurface D) NavMeshLink Answer: A Explanation: NavMeshAgent handles pathfinding and movement on the NavMesh. Question 42. Which of the following is a recommended practice to reduce garbage collection spikes in Unity? A) Frequently use string concatenation with “+”. B) Allocate new List
Question 43. In Unity’s UI system, which component determines the order in which UI elements receive raycast events? A) Canvas B) GraphicRaycaster C) CanvasGroup D) EventSystem Answer: B Explanation: GraphicRaycaster performs the raycast against UI graphics and respects sorting order. Question 44. Which C# access modifier makes a member visible only within its own assembly but not to other assemblies? A) public B) internal C) protected D) private Answer: B Explanation: internal restricts visibility to the same compiled assembly. Question 45. What is the purpose of the “OnValidate” method in a Unity MonoBehaviour?