Docsity

GPP 256 Unity Certified Expert Programmer Practice Exam, Exams of Technology

Toggle sidebar
bg1
GPP 256 Unity Certified Expert Programmer
Practice Exam
**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?
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download GPP 256 Unity Certified Expert Programmer Practice Exam and more Exams Technology in PDF only on Docsity!

Practice Exam

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?

Practice Exam

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]

Practice Exam

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

Practice Exam

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.

Practice Exam

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() C) Mathf.Lerp D) Time.deltaTime Answer: B Explanation: GetComponent performs a lookup; caching the component reference is more performant. Question 16. In the context of Unity’s rendering pipeline, what does “static batching” do?

Practice Exam

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.

Practice Exam

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.

Practice Exam

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.

Practice Exam

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()

Practice Exam

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

Practice Exam

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?

Practice Exam

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.

Practice Exam

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 each frame. C) Cache component references and reuse collections. D) Call Resources.UnloadUnusedAssets every frame. Answer: C Explanation: Caching and reusing objects prevents frequent allocations that trigger the GC.

Practice Exam

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?