1What is a scripting language mainly used for in game development?
Scripting Language
Easy
A.Compressing video files
B.Designing circuit boards
C.Manufacturing controllers
D.Defining game behavior
Correct Answer: Defining game behavior
Explanation:
A scripting language is commonly used to define gameplay rules, interactions, and object behavior.
Incorrect! Try again.
2Which scripting language is commonly used with the Unity game engine?
Scripting Language
Easy
A.HTML
B.SQL
C.C#
D.CSS
Correct Answer: C#
Explanation:
Unity primarily uses C# scripts to create game logic and control objects.
Incorrect! Try again.
3What is a variable in a game script?
Scripting Language
Easy
A.A named storage location
B.A type of sound effect
C.A three-dimensional model
D.A graphical user interface
Correct Answer: A named storage location
Explanation:
A variable stores data such as a player's score, health, speed, or name.
Incorrect! Try again.
4Which programming structure is used to make a decision in a game script?
Scripting Language
Easy
A.A mesh filter
B.A texture map
C.An audio clip
D.An if statement
Correct Answer: An if statement
Explanation:
An if statement executes code based on whether a condition is true or false.
Incorrect! Try again.
5What is a game architecture pattern?
Game Architecture Patterns
Easy
A.A format for video export
B.A reusable design solution
C.A method of drawing textures
D.A collection of sound files
Correct Answer: A reusable design solution
Explanation:
A game architecture pattern is a reusable approach to organizing code and solving common design problems.
Incorrect! Try again.
6Why are architecture patterns used in game development?
Game Architecture Patterns
Easy
A.To manufacture graphics cards
B.To organize game code
C.To increase monitor size
D.To record voice acting
Correct Answer: To organize game code
Explanation:
Architecture patterns help developers create code that is organized, understandable, and easier to maintain.
Incorrect! Try again.
7Which of the following is a game architecture pattern?
Game Architecture Patterns
Easy
A.Texture
B.Polygon
C.Keyframe
D.Observer
Correct Answer: Observer
Explanation:
Observer is a software design pattern used to notify multiple objects when an event occurs.
Incorrect! Try again.
8What does the State pattern represent?
State Pattern
Easy
A.Different sounds based on format
B.Different behaviors based on state
C.Different models based on color
D.Different textures based on size
Correct Answer: Different behaviors based on state
Explanation:
The State pattern allows an object to change its behavior when its current state changes.
Incorrect! Try again.
9Which is an example of a player state?
State Pattern
Easy
A.Texturing
B.Lighting
C.Rendering
D.Jumping
Correct Answer: Jumping
Explanation:
Jumping can be a player state alongside states such as idle, running, or attacking.
Incorrect! Try again.
10What happens during a state transition?
State Pattern
Easy
A.A model gains polygons
B.An object changes state
C.A sound becomes compressed
D.A texture changes format
Correct Answer: An object changes state
Explanation:
A state transition occurs when an object moves from one state, such as idle, to another, such as running.
Incorrect! Try again.
11Which system is commonly implemented using the State pattern?
State Pattern
Easy
A.Character behavior
B.Texture compression
C.Audio recording
D.Model sculpting
Correct Answer: Character behavior
Explanation:
The State pattern is often used to manage character behaviors such as idle, walk, attack, and jump.
Incorrect! Try again.
12What does the Singleton pattern ensure?
Singleton Pattern
Easy
A.A class has one instance
B.A script has four variables
C.A scene has one object
D.A class has four methods
Correct Answer: A class has one instance
Explanation:
The Singleton pattern ensures that a class has only one shared instance.
Incorrect! Try again.
13Which game system is commonly designed as a Singleton?
Singleton Pattern
Easy
A.Wall texture
B.Game manager
C.Footstep animation
D.Enemy model
Correct Answer: Game manager
Explanation:
A game manager is often a Singleton because the game usually needs one central manager.
Incorrect! Try again.
14How is a Singleton instance usually accessed?
Singleton Pattern
Easy
A.Through a texture channel
B.Through an audio waveform
C.Through an animation frame
D.Through a shared reference
Correct Answer: Through a shared reference
Explanation:
A Singleton usually provides a shared reference that other scripts can use to access its single instance.
Incorrect! Try again.
15What is the main purpose of the Observer pattern?
Observer Pattern
Easy
A.To notify objects about events
B.To compress background music
C.To calculate texture coordinates
D.To create three-dimensional meshes
Correct Answer: To notify objects about events
Explanation:
The Observer pattern allows interested objects to receive notifications when an event or change occurs.
Incorrect! Try again.
16In the Observer pattern, what does an observer do?
Observer Pattern
Easy
A.Listens for notifications
B.Renders every polygon
C.Creates new textures
D.Records player audio
Correct Answer: Listens for notifications
Explanation:
An observer subscribes to and listens for notifications from another object.
Incorrect! Try again.
17Which situation is a suitable use of the Observer pattern?
Observer Pattern
Easy
A.Updating the score display
B.Painting a character texture
C.Compressing an audio track
D.Building a terrain mesh
Correct Answer: Updating the score display
Explanation:
The score display can observe score-change events and update whenever the player's score changes.
Incorrect! Try again.
18What is a Scriptable Object commonly used to store in Unity?
Scriptable Objects
Easy
A.Recorded keyboard input
B.Physical controller parts
C.Rendered screen pixels
D.Reusable game data
Correct Answer: Reusable game data
Explanation:
Scriptable Objects are Unity assets commonly used to store reusable data independently of scene objects.
Incorrect! Try again.
19Which type of data could be stored in a Scriptable Object?
Scriptable Objects
Easy
A.Mouse hardware
B.Network cables
C.Monitor settings
D.Weapon statistics
Correct Answer: Weapon statistics
Explanation:
A Scriptable Object can store reusable weapon data such as damage, range, and attack speed.
Incorrect! Try again.
20Where is a Scriptable Object typically saved in a Unity project?
Scriptable Objects
Easy
A.As a scene camera
B.As a screen pixel
C.As a shader pass
D.As a project asset
Correct Answer: As a project asset
Explanation:
A Scriptable Object is saved as an asset in the Unity project and can be referenced by multiple objects.
Incorrect! Try again.
21A game script needs to move an enemy toward the player every frame. Which approach is most appropriate for calculating the movement direction?
Scripting Language
Medium
A.Use the enemy's current velocity without checking the player position
B.Subtract the enemy position from the player position and normalize the result
C.Add the enemy and player positions and use the result directly
D.Multiply the enemy position by the player's rotation
Correct Answer: Subtract the enemy position from the player position and normalize the result
Explanation:
The direction toward the player is found by calculating and normalizing the vector before applying movement.
Incorrect! Try again.
22A player-controlled object should respond to input, while its movement should remain consistent across different frame rates. Which implementation is most suitable?
Scripting Language
Medium
A.Read input only when the object collides with another object
B.Read input in the frame loop and multiply movement by delta time
C.Read input once during initialization and reuse the original value
D.Move the object by a fixed distance without using elapsed time
Correct Answer: Read input in the frame loop and multiply movement by delta time
Explanation:
Reading input regularly captures current controls, while multiplying speed by delta time makes movement approximately frame-rate independent.
Incorrect! Try again.
23A projectile script creates a new explosion effect when the projectile hits an enemy. What is the main reason to destroy or return the projectile after handling the collision?
Scripting Language
Medium
A.To increase the projectile's damage during the same collision
B.To force the game engine to reload the current scene
C.To prevent repeated collision handling and unnecessary object accumulation
D.To make the enemy ignore all future projectiles
Correct Answer: To prevent repeated collision handling and unnecessary object accumulation
Explanation:
Removing or deactivating the projectile prevents duplicate collision events and reduces unused objects that could affect performance.
Incorrect! Try again.
24A game has separate systems for input, player movement, audio, and scoring. Which architectural principle most directly helps keep these systems manageable?
Game Architecture Patterns
Medium
A.Duplicate shared logic inside each system to avoid dependencies
B.Place all gameplay logic inside the player controller
C.Allow every system to modify every other system's fields
D.Give each system a focused responsibility and a clear interface
Correct Answer: Give each system a focused responsibility and a clear interface
Explanation:
Focused responsibilities reduce coupling, while clear interfaces define how systems communicate without exposing unnecessary implementation details.
Incorrect! Try again.
25A game mode contains separate code paths for exploration, combat, and dialogue. As more modes are added, the conditional logic becomes difficult to maintain. Which design improvement is most appropriate?
Game Architecture Patterns
Medium
A.Store every mode's variables in one large global data structure
B.Represent each mode as an interchangeable state or behavior object
C.Add more nested conditional statements to the same game-mode method
D.Copy the entire game controller once for every possible mode
Correct Answer: Represent each mode as an interchangeable state or behavior object
Explanation:
Encapsulating each mode in a separate object reduces branching and makes adding or modifying modes more localized.
Incorrect! Try again.
26A UI panel must display player health, but it should not directly depend on the internal implementation of the health system. Which architectural choice best supports this requirement?
Game Architecture Patterns
Medium
A.Allow the UI panel to edit the health system's private variables
B.Expose a small health interface or event rather than internal fields
C.Move the health calculations into the UI panel
D.Make the health system inherit from the UI panel
Correct Answer: Expose a small health interface or event rather than internal fields
Explanation:
A narrow interface or event preserves encapsulation and allows the health implementation to change without requiring UI changes.
Incorrect! Try again.
27An enemy can be idle, chasing, attacking, or stunned. When the enemy becomes stunned, which State Pattern behavior is expected?
State Pattern
Medium
A.The stunned state changes only the enemy's display name
B.The current state is replaced and the stunned state controls behavior
C.The enemy must restart the entire game scene before changing behavior
D.The enemy continues executing all previous state behaviors simultaneously
Correct Answer: The current state is replaced and the stunned state controls behavior
Explanation:
The State Pattern changes the object's active behavior by transitioning from one state object to another.
Incorrect! Try again.
28In an enemy state machine, the chase state detects that the player is within attack range. What is the cleanest response?
State Pattern
Medium
A.Create a second enemy object that begins attacking
B.Keep chasing and independently start attack logic in every frame
C.Disable all enemy scripts until the player leaves the range
D.Request a transition from the chase state to the attack state
Correct Answer: Request a transition from the chase state to the attack state
Explanation:
A state transition keeps the enemy's active behavior consistent and allows attack logic to remain encapsulated in the attack state.
Incorrect! Try again.
29A player changes from swimming to walking. The swimming state needs to stop water-specific effects, while the walking state needs to set ground movement values. Which lifecycle arrangement is suitable?
State Pattern
Medium
A.Reset every object in the scene whenever the player changes state
B.Put both transitions inside the rendering method
C.Use an exit method for swimming and an enter method for walking
D.Run the swimming initialization method continuously during walking
Correct Answer: Use an exit method for swimming and an enter method for walking
Explanation:
State entry and exit methods are appropriate places to configure or clean up behavior associated with a state transition.
Incorrect! Try again.
30A state machine repeatedly switches between patrol and chase because the player is exactly at the detection boundary. Which solution most directly reduces this instability?
State Pattern
Medium
A.Remove all distance checks from the state machine
B.Make both states execute their movement code at once
C.Use separate enter and exit thresholds for detection
D.Create a new patrol state every frame
Correct Answer: Use separate enter and exit thresholds for detection
Explanation:
Hysteresis prevents rapid switching by using one threshold to enter chase and another, usually farther threshold, to leave it.
Incorrect! Try again.
31A game needs one audio manager that can be accessed by multiple scenes. Which condition is essential for a typical Singleton implementation?
Singleton Pattern
Medium
A.It requires every scene to contain a separate audio manager
B.It prevents the manager from storing any configuration data
C.It ensures that only one manager instance remains available
D.It creates a new manager whenever a sound effect is requested
Correct Answer: It ensures that only one manager instance remains available
Explanation:
The defining feature of a Singleton is controlled access to a single shared instance, often preserved across scene changes.
Incorrect! Try again.
32A Singleton manager is created in two scenes that load additively. What problem can occur if duplicate instances are not handled?
Singleton Pattern
Medium
A.Only the first manager can ever receive a method call
B.Both managers may respond to events and perform actions twice
C.The scenes become unable to contain any non-manager objects
D.The game automatically converts both managers into one object
Correct Answer: Both managers may respond to events and perform actions twice
Explanation:
Duplicate global managers can subscribe to the same events, play audio twice, or maintain conflicting data.
Incorrect! Try again.
33Why should a Singleton reference be initialized before other systems attempt to use it?
Singleton Pattern
Medium
A.It makes all Singleton methods execute on separate threads
B.It removes the need for the Singleton to contain any methods
C.It guarantees that the Singleton cannot be destroyed during gameplay
D.It prevents dependent systems from receiving a missing reference
Correct Answer: It prevents dependent systems from receiving a missing reference
Explanation:
Initialization order matters because dependent systems may access the Singleton before its instance has been assigned.
Incorrect! Try again.
34The score UI should update whenever the player's score changes, without the scoring system directly referencing the UI. Which Observer Pattern design is suitable?
Observer Pattern
Medium
A.The score system publishes an event that the UI subscribes to
B.The score system creates a new UI panel after every score change
C.The UI reads the score field continuously from every game object
D.The UI changes the score directly whenever it needs a refresh
Correct Answer: The score system publishes an event that the UI subscribes to
Explanation:
The score system acts as the subject, and the UI acts as an observer that reacts when a score-change event is published.
Incorrect! Try again.
35A menu subscribes to a level-completed event whenever it opens. After opening and closing the menu several times, the completion sound plays repeatedly. What is the likely cause?
Observer Pattern
Medium
A.The menu uses an observer instead of a Singleton
B.The menu subscribes repeatedly without unsubscribing when it closes
C.The level-completed event is declared as a local variable
D.The event contains too few parameters for the menu
Correct Answer: The menu subscribes repeatedly without unsubscribing when it closes
Explanation:
Repeated subscriptions cause the same callback to be registered multiple times. Unsubscribe when the menu is disabled or destroyed.
Incorrect! Try again.
36Several systems must react when the player dies, including the camera, audio manager, and game-over UI. What is a key advantage of using the Observer Pattern here?
Observer Pattern
Medium
A.The pattern guarantees that all observers execute in a fixed order
B.The player object no longer needs any logic related to death
C.Every observing system must inherit from the player controller
D.The death event can notify multiple systems without tightly coupling them
Correct Answer: The death event can notify multiple systems without tightly coupling them
Explanation:
Observers can independently subscribe to the death notification, so the player does not need direct references to each responding system.
Incorrect! Try again.
37A designer needs to adjust the properties of ten enemy types without editing code. Which use of a Scriptable Object is most appropriate?
Scriptable Objects
Medium
A.Store temporary enemy transforms that change every frame
B.Create one scene object for every possible enemy configuration
C.Replace all enemy behavior scripts with a single data asset
D.Store shared enemy configuration data in reusable asset instances
Correct Answer: Store shared enemy configuration data in reusable asset instances
Explanation:
Scriptable Objects are useful for storing editable, reusable data such as health, speed, damage, and visual references.
Incorrect! Try again.
38Two enemy instances use the same Scriptable Object containing health configuration. One enemy changes the asset's health value during play. What risk does this create?
Scriptable Objects
Medium
A.The Scriptable Object automatically creates a private copy for each enemy
B.The other enemy may observe the changed shared value as well
C.The game engine prevents all runtime changes to Scriptable Objects
D.Only the enemy's transform can be changed through the asset
Correct Answer: The other enemy may observe the changed shared value as well
Explanation:
Scriptable Object assets are shared references. Runtime mutation can affect every object using the same asset unless instance-specific data is copied.
Incorrect! Try again.
39A weapon system uses Scriptable Objects for weapon definitions. Which data is generally better stored on the weapon instance rather than in the shared asset?
Scriptable Objects
Medium
A.The icon displayed for the weapon type
B.The sound effect associated with firing the weapon
C.The base damage value used by all weapons of that type
D.The current ammunition remaining in that specific weapon
Correct Answer: The current ammunition remaining in that specific weapon
Explanation:
Current ammunition is runtime state belonging to one weapon instance, while base damage, icons, and sounds are commonly shared configuration.
Incorrect! Try again.
40A designer wants to create new collectible item types in the editor by changing names, icons, and effects without modifying the item pickup script. Why are Scriptable Objects useful for this design?
Scriptable Objects
Medium
A.They separate item data from the pickup behavior that consumes it
B.They force every item type to use a different pickup script
C.They replace the need for item data to be stored anywhere
D.They automatically implement collision detection for each collectible
Correct Answer: They separate item data from the pickup behavior that consumes it
Explanation:
A reusable item-data asset lets designers create variants while the pickup script remains focused on detecting and applying the item.
Incorrect! Try again.
41A Unity game uses this C# property:
public Vector3 Position => transform.position;
Another script repeatedly reads Position inside a loop and assumes the value is a cached snapshot. Which statement correctly identifies the behavior?
Scripting Language
Hard
A.The expression is evaluated once when the component instance is constructed
B.The compiler stores the first result in an automatically generated backing field
C.The value is refreshed only when Unity invokes the component's Update method
D.Each read reevaluates transform.position, so values may differ within the loop
Correct Answer: Each read reevaluates transform.position, so values may differ within the loop
Explanation:
An expression-bodied getter executes whenever the property is accessed. It does not create a cached backing field, so changes to the transform can affect later reads.
Incorrect! Try again.
42A base Unity component declares protected virtual void Update(), and a derived component declares private void Update() without override. What is the most accurate consequence?
Scripting Language
Hard
A.Unity invokes both methods every frame because message methods are automatically chained
B.C# rejects the derived class because Unity message methods cannot hide virtual methods
C.Unity may invoke the derived method, but polymorphic calls through the base type use the base method
D.The derived method overrides the base method because its name and parameters are identical
Correct Answer: Unity may invoke the derived method, but polymorphic calls through the base type use the base method
Explanation:
The derived declaration hides rather than overrides the virtual method. Unity message dispatch can find the derived Update, while ordinary virtual dispatch through the base contract still targets the base implementation.
Incorrect! Try again.
43A coroutine executes yield return new WaitForSeconds(2f);. During the wait, Time.timeScale changes from 1 to 0.5. Which interpretation is correct?
Scripting Language
Hard
A.The coroutine terminates because changing the time scale invalidates its yield instruction
B.The remaining wait follows unscaled time and therefore keeps its original real duration
C.The remaining wait follows scaled game time and therefore lasts longer in real time
D.The wait duration is fixed using the time scale captured when the object was created
Correct Answer: The remaining wait follows scaled game time and therefore lasts longer in real time
Explanation:
WaitForSeconds measures scaled time. Reducing Time.timeScale causes the remaining scaled duration to require more real-world time.
Incorrect! Try again.
44A deterministic combat simulation must support rollback. Presentation code currently reads live Transform values and emits particles directly during simulation. Which architectural change best supports reliable resimulation?
Game Architecture Patterns
Hard
A.Move particle emission into each combatant's state classes and replay every transition
B.Serialize every component before each frame and restore the entire scene during rollback
C.Store all combat objects under one persistent scene root and rewind their transforms
D.Separate pure simulation state from presentation and replay confirmed events afterward
Correct Answer: Separate pure simulation state from presentation and replay confirmed events afterward
Explanation:
Rollback requires deterministic state transitions without irreversible presentation side effects. Rendering and effects should consume confirmed simulation results rather than participate in simulation.
Incorrect! Try again.
45A game has a PlayerController that reads input, applies movement, updates animation, plays audio, saves progress, and modifies UI. Which redesign most directly reduces the cost of changing one subsystem without affecting the others?
Game Architecture Patterns
Hard
A.Split responsibilities behind explicit interfaces and coordinate them through a narrow controller
B.Convert every operation into a static method called by the existing controller
C.Place every operation in one coroutine so execution order remains centrally visible
D.Move all responsibilities into a larger base class shared by every controllable entity
Correct Answer: Split responsibilities behind explicit interfaces and coordinate them through a narrow controller
Explanation:
Explicit subsystem boundaries reduce coupling and isolate reasons for change. A thin coordinator can preserve workflow without owning every implementation.
Incorrect! Try again.
46An entity-component design allows arbitrary components, but a system silently assumes every entity with Velocity also has TransformData. Which approach best preserves composability while enforcing the system's requirement?
Game Architecture Patterns
Hard
A.Automatically add TransformData whenever any component named Velocity is created
B.Make Velocity inherit from TransformData so the dependency is encoded by inheritance
C.Query only entities containing both Velocity and TransformData components
D.Catch missing-component exceptions and skip invalid entities during system execution
Correct Answer: Query only entities containing both Velocity and TransformData components
Explanation:
A system should declare its required component set in its query. This keeps components independent while ensuring that processed entities satisfy the system's contract.
Incorrect! Try again.
47During AttackState.Update, the character can receive both a stun event and an animation-complete event in the same frame. Immediate transitions cause Exit and Enter methods to run twice. Which policy best preserves deterministic state behavior?
State Pattern
Hard
A.Allow the most recently executed callback to determine the final active state
B.Call every requested state's Enter method and retain the last returned state
C.Suppress all transitions until neither callback has executed for one full frame
D.Queue transition requests and resolve one using an explicit priority rule
Correct Answer: Queue transition requests and resolve one using an explicit priority rule
Explanation:
Deferred transition resolution prevents reentrant lifecycle calls. An explicit priority, such as stun over completion, makes simultaneous requests deterministic.
Incorrect! Try again.
48Two enemies share one PatrolState object. The state stores currentWaypoint as an instance field. What is the most robust correction if state objects are intended to remain shared?
State Pattern
Hard
A.Reset currentWaypoint whenever either enemy enters the shared state
B.Mark currentWaypoint as static so all state instances use one value
C.Move per-enemy waypoint progress into each enemy's context data
D.Clone the enemy's transform before passing it to the shared state object
Correct Answer: Move per-enemy waypoint progress into each enemy's context data
Explanation:
A shared state object must not contain mutable owner-specific runtime data. Per-entity progress belongs in the context, while the shared state contains behavior or immutable configuration.
Incorrect! Try again.
49A character can be simultaneously grounded or airborne, armed or unarmed, and normal or poisoned. A flat state machine creates a separate class for every combination. Which design most directly avoids the combinatorial explosion?
State Pattern
Hard
A.Replace all state objects with a singleton storing the character's current combination
B.Use one state class containing Boolean flags for all combinations and transitions
C.Use orthogonal state regions or composed state machines for independent concerns
D.Create a deeper inheritance hierarchy with one subclass for every combined condition
Correct Answer: Use orthogonal state regions or composed state machines for independent concerns
Explanation:
Independent dimensions should be modeled by cooperating state machines or orthogonal regions. This avoids creating the Cartesian product of all possible state combinations.
Incorrect! Try again.
50A state's Enter method subscribes to a damage event, and Exit unsubscribes. Destroying the owning GameObject can bypass the expected transition path. Which addition best prevents stale subscriptions?
State Pattern
Hard
A.Call the active state's Enter method again from OnDestroy before releasing it
B.Depend on garbage collection to remove the event subscription after object destruction
C.Make owner teardown explicitly dispose the active state and remove its subscriptions
D.Change the event to static so subscribers survive scene and GameObject destruction
Correct Answer: Make owner teardown explicitly dispose the active state and remove its subscriptions
Explanation:
Cleanup must also occur when the owner is destroyed outside a normal transition. Explicit disposal or equivalent teardown ensures event references are released.
Incorrect! Try again.
51A Unity singleton uses DontDestroyOnLoad. Returning to the bootstrap scene creates another copy, and both instances execute Awake before one is destroyed. Which design most reliably prevents duplicate initialization side effects?
Singleton Pattern
Hard
A.Destroy the older instance and let the newly loaded instance repeat initialization each time
B.Run initialization in Start, because duplicate objects are always destroyed before any Start call
C.Use a static constructor to call Unity APIs before either scene instance reaches Awake
D.Claim the singleton in Awake, destroy duplicates immediately, and initialize only the winner
Correct Answer: Claim the singleton in Awake, destroy duplicates immediately, and initialize only the winner
Explanation:
The instance must establish ownership before performing side effects. Duplicate instances should return immediately after destruction is requested and must not initialize services.
Incorrect! Try again.
52With Unity's disabled domain reload option, a static singleton reference can persist after exiting Play Mode while its referenced object has been destroyed. What is the most appropriate mitigation?
Singleton Pattern
Hard
A.Mark the static reference with DontDestroyOnLoad before leaving Play Mode
B.Replace Unity's null comparison with ReferenceEquals in every singleton access
C.Reset static state through a subsystem-registration runtime initialization hook
D.Serialize the static reference so Unity restores it whenever Play Mode begins
Correct Answer: Reset static state through a subsystem-registration runtime initialization hook
Explanation:
RuntimeInitializeOnLoadMethod with SubsystemRegistration can clear static state even when domain reload is disabled. Serialization and DontDestroyOnLoad do not manage static references.
Incorrect! Try again.
53A multiplayer client needs one inventory service per local player, but the current InventoryManager.Instance exposes one global inventory. Which change best corrects the lifetime and ownership mismatch?
Singleton Pattern
Hard
A.Keep one singleton and switch its internal data according to the last player who acted
B.Create player-scoped inventory services and inject the appropriate instance into consumers
C.Create one singleton subclass per player and select subclasses using player indices
D.Store every inventory in static dictionaries while retaining the same global service access
Correct Answer: Create player-scoped inventory services and inject the appropriate instance into consumers
Explanation:
The service lifetime should match its owner. Player-scoped instances prevent accidental cross-player access and make dependencies explicit.
Incorrect! Try again.
54An event publisher iterates a mutable subscriber list. One observer unsubscribes itself during notification, causing the next observer to be skipped. Which implementation best preserves defined delivery semantics?
Observer Pattern
Hard
A.Traverse the original list backward and require subscriptions to remain ordered
B.Disallow unsubscription permanently once the first notification has occurred
C.Restart iteration from the first subscriber after every unsubscription
D.Iterate over a snapshot of the subscriber list for the current notification
Correct Answer: Iterate over a snapshot of the subscriber list for the current notification
Explanation:
A snapshot gives the current dispatch a stable recipient set. Mutations then affect later notifications without corrupting iteration or skipping observers.
Incorrect! Try again.
55A static C# event stores an instance method from a scene object. The scene unloads, but the subscriber never unsubscribes. What is the principal failure mode?
Observer Pattern
Hard
A.Unity automatically converts the delegate to a weak reference after the scene unloads
B.The event invocation list is cleared automatically when any subscribed GameObject is destroyed
C.The subscriber retains the static publisher, forcing the publisher to unload with the scene
D.The publisher retains the subscriber through the delegate, delaying collection and enabling stale callbacks
Correct Answer: The publisher retains the subscriber through the delegate, delaying collection and enabling stale callbacks
Explanation:
A delegate normally holds a strong reference to its target. A long-lived static publisher can therefore retain scene subscribers and later invoke invalid or destroyed objects.
Incorrect! Try again.
56A combat event bus dispatches events immediately. Observer A responds to DamageApplied by publishing Death, while observer B expects to finish processing DamageApplied before any Death handlers run. Which mechanism best enforces that ordering?
Observer Pattern
Hard
A.Queue nested publications and drain them after the current dispatch completes
B.Invoke each observer on a separate thread and wait for every thread to finish
C.Sort observers alphabetically before every immediate event dispatch begins
D.Reverse the subscriber list whenever an observer publishes a nested event
Correct Answer: Queue nested publications and drain them after the current dispatch completes
Explanation:
Deferring nested events prevents reentrant dispatch. All current DamageApplied observers complete before the queued Death event is delivered.
Incorrect! Try again.
57A replicated game sends HealthChanged notifications over an unreliable network. Duplicate packets occasionally arrive, causing UI animations to play twice. Which event design best enables observers to handle duplicates correctly?
Observer Pattern
Hard
A.Include only the new health value and let every observer compare animation timestamps
B.Assign each observer a random delay so duplicate notifications rarely execute together
C.Include an entity identifier and monotonic revision so observers can reject stale revisions
D.Clear every observer's subscription immediately after receiving one health notification
Correct Answer: Include an entity identifier and monotonic revision so observers can reject stale revisions
Explanation:
Identity plus a monotonic revision supports idempotent processing. Observers can ignore duplicate or out-of-order updates they have already applied.
Incorrect! Try again.
58Several enemies reference the same EnemyStats ScriptableObject. At runtime, one enemy reduces stats.currentHealth, and all enemies appear damaged. Which design best resolves the shared-state error?
Scriptable Objects
Hard
A.Move current health into a static field indexed by the shared asset's display name
B.Mark currentHealth with HideInInspector so Unity creates one hidden value per enemy
C.Duplicate the asset automatically whenever any field changes during combat
D.Keep immutable base stats in the asset and store current health on each enemy instance
Correct Answer: Keep immutable base stats in the asset and store current health on each enemy instance
Explanation:
A referenced ScriptableObject is shared data, not per-owner storage. Configuration can remain in the asset, while mutable runtime state belongs to each enemy.
Incorrect! Try again.
59A runtime system must modify a ScriptableObject-based item definition without changing the shared asset or affecting other users of it. Which approach is most appropriate?
Scriptable Objects
Hard
A.Wrap the shared asset in a singleton and modify it through the singleton reference
B.Change the asset directly and restore its values when the current scene unloads
C.Create a runtime clone with Instantiate and modify the clone
D.Load the same asset again through Resources.Load and modify the returned object
Correct Answer: Create a runtime clone with Instantiate and modify the clone
Explanation:
Instantiate creates a separate runtime ScriptableObject instance. Loading the same asset again generally returns another reference to the same shared asset.
Incorrect! Try again.
60A ScriptableObject event channel retains listeners from a previous scene because subscribers registered in OnEnable but did not unregister. The channel asset remains loaded across scenes. Which lifecycle rule best fixes the issue?
Scriptable Objects
Hard
A.Register in constructors and unregister only when the application process exits
B.Register in Start and rely on scene unloading to edit the asset's invocation list
C.Register in Awake and clear every listener globally whenever one object is disabled
D.Pair registration in OnEnable with unregistration in OnDisable
Correct Answer: Pair registration in OnEnable with unregistration in OnDisable
Explanation:
Symmetric lifecycle registration prevents disabled or unloaded scene objects from remaining in the channel's listener collection. The persistent asset should not own stale scene references.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →