1What is a scripting language mainly used for in game development?
Scripting Language
Easy
A.Compressing video files
B.Designing circuit boards
C.Defining game behavior
D.Manufacturing controllers
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.C#
C.CSS
D.SQL
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 graphical user interface
B.A type of sound effect
C.A three-dimensional model
D.A named storage location
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.An if statement
B.A texture map
C.An audio clip
D.A mesh filter
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 method of drawing textures
B.A reusable design solution
C.A format for video export
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 organize game code
B.To increase monitor size
C.To record voice acting
D.To manufacture graphics cards
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.Polygon
B.Texture
C.Observer
D.Keyframe
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 models based on color
C.Different behaviors based on state
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.Jumping
B.Lighting
C.Rendering
D.Texturing
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 texture changes format
B.A sound becomes compressed
C.An object changes state
D.A model gains polygons
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.Texture compression
B.Audio recording
C.Model sculpting
D.Character behavior
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 script has four variables
B.A class has one instance
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.Game manager
B.Wall texture
C.Enemy model
D.Footstep animation
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 shared reference
B.Through an audio waveform
C.Through an animation frame
D.Through a texture channel
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 compress background music
B.To create three-dimensional meshes
C.To calculate texture coordinates
D.To notify objects about events
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.Records player audio
B.Creates new textures
C.Listens for notifications
D.Renders every polygon
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.Compressing an audio track
B.Updating the score display
C.Building a terrain mesh
D.Painting a character texture
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.Reusable game data
C.Rendered screen pixels
D.Physical controller parts
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.Network cables
B.Weapon statistics
C.Mouse hardware
D.Monitor settings
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 screen pixel
B.As a shader pass
C.As a project asset
D.As a scene camera
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.Add the enemy and player positions and use the result directly
B.Multiply the enemy position by the player's rotation
C.Use the enemy's current velocity without checking the player position
D.Subtract the enemy position from the player position and normalize the result
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.Move the object by a fixed distance without using elapsed time
B.Read input once during initialization and reuse the original value
C.Read input in the frame loop and multiply movement by delta time
D.Read input only when the object collides with another object
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 force the game engine to reload the current scene
B.To prevent repeated collision handling and unnecessary object accumulation
C.To make the enemy ignore all future projectiles
D.To increase the projectile's damage during the same collision
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.Allow every system to modify every other system's fields
B.Give each system a focused responsibility and a clear interface
C.Duplicate shared logic inside each system to avoid dependencies
D.Place all gameplay logic inside the player controller
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.Copy the entire game controller once for every possible mode
B.Represent each mode as an interchangeable state or behavior object
C.Add more nested conditional statements to the same game-mode method
D.Store every mode's variables in one large global data structure
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.Move the health calculations into the UI panel
C.Expose a small health interface or event rather than internal fields
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 continues executing all previous state behaviors simultaneously
D.The enemy must restart the entire game scene before changing behavior
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.Request a transition from the chase state to the attack state
B.Keep chasing and independently start attack logic in every frame
C.Create a second enemy object that begins attacking
D.Disable all enemy scripts until the player leaves the range
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.Put both transitions inside the rendering method
B.Use an exit method for swimming and an enter method for walking
C.Run the swimming initialization method continuously during walking
D.Reset every object in the scene whenever the player changes state
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.Make both states execute their movement code at once
B.Remove all distance checks from the state machine
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 creates a new manager whenever a sound effect is requested
D.It ensures that only one manager instance remains available
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.The game automatically converts both managers into one object
C.Both managers may respond to events and perform actions twice
D.The scenes become unable to contain any non-manager objects
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 prevents dependent systems from receiving a missing reference
B.It guarantees that the Singleton cannot be destroyed during gameplay
C.It removes the need for the Singleton to contain any methods
D.It makes all Singleton methods execute on separate threads
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 creates a new UI panel after every score change
B.The UI reads the score field continuously from every game object
C.The UI changes the score directly whenever it needs a refresh
D.The score system publishes an event that the UI subscribes to
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 level-completed event is declared as a local variable
B.The menu uses an observer instead of a Singleton
C.The menu subscribes repeatedly without unsubscribing when it closes
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 death event can notify multiple systems without tightly coupling them
C.The player object no longer needs any logic related to death
D.Every observing system must inherit from the player controller
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.Replace all enemy behavior scripts with a single data asset
B.Create one scene object for every possible enemy configuration
C.Store temporary enemy transforms that change every frame
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.Only the enemy's transform can be changed through the asset
B.The game engine prevents all runtime changes to Scriptable Objects
C.The Scriptable Object automatically creates a private copy for each enemy
D.The other enemy may observe the changed shared value as well
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 sound effect associated with firing the weapon
B.The base damage value used by all weapons of that type
C.The current ammunition remaining in that specific weapon
D.The icon displayed for the weapon type
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 automatically implement collision detection for each collectible
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 separate item data from the pickup behavior that consumes it
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.Each read reevaluates transform.position, so values may differ within the loop
B.The value is refreshed only when Unity invokes the component's Update method
C.The compiler stores the first result in an automatically generated backing field
D.The expression is evaluated once when the component instance is constructed
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 may invoke the derived method, but polymorphic calls through the base type use the base method
B.C# rejects the derived class because Unity message methods cannot hide virtual methods
C.The derived method overrides the base method because its name and parameters are identical
D.Unity invokes both methods every frame because message methods are automatically chained
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 scaled game time and therefore lasts longer in real time
C.The remaining wait follows unscaled time and therefore keeps its original real duration
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.Separate pure simulation state from presentation and replay confirmed events afterward
D.Store all combat objects under one persistent scene root and rewind their transforms
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.Place every operation in one coroutine so execution order remains centrally visible
C.Convert every operation into a static method called by the existing controller
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.Make Velocity inherit from TransformData so the dependency is encoded by inheritance
B.Query only entities containing both Velocity and TransformData components
C.Automatically add TransformData whenever any component named Velocity is created
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.Queue transition requests and resolve one using an explicit priority rule
B.Allow the most recently executed callback to determine the final active state
C.Suppress all transitions until neither callback has executed for one full frame
D.Call every requested state's Enter method and retain the last returned state
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.Move per-enemy waypoint progress into each enemy's context data
B.Reset currentWaypoint whenever either enemy enters the shared state
C.Mark currentWaypoint as static so all state instances use one value
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 orthogonal state regions or composed state machines for independent concerns
C.Use one state class containing Boolean flags for all combinations and transitions
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.Make owner teardown explicitly dispose the active state and remove its subscriptions
B.Call the active state's Enter method again from OnDestroy before releasing it
C.Depend on garbage collection to remove the event subscription after object destruction
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.Claim the singleton in Awake, destroy duplicates immediately, and initialize only the winner
B.Use a static constructor to call Unity APIs before either scene instance reaches Awake
C.Destroy the older instance and let the newly loaded instance repeat initialization each time
D.Run initialization in Start, because duplicate objects are always destroyed before any Start call
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.Serialize the static reference so Unity restores it whenever Play Mode begins
B.Replace Unity's null comparison with ReferenceEquals in every singleton access
C.Reset static state through a subsystem-registration runtime initialization hook
D.Mark the static reference with DontDestroyOnLoad before leaving Play Mode
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 one singleton subclass per player and select subclasses using player indices
C.Store every inventory in static dictionaries while retaining the same global service access
D.Create player-scoped inventory services and inject the appropriate instance into consumers
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.Iterate over a snapshot of the subscriber list for the current notification
B.Disallow unsubscription permanently once the first notification has occurred
C.Restart iteration from the first subscriber after every unsubscription
D.Traverse the original list backward and require subscriptions to remain ordered
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.The subscriber retains the static publisher, forcing the publisher to unload with the scene
B.The publisher retains the subscriber through the delegate, delaying collection and enabling stale callbacks
C.Unity automatically converts the delegate to a weak reference after the scene unloads
D.The event invocation list is cleared automatically when any subscribed GameObject is destroyed
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.Reverse the subscriber list whenever an observer publishes a nested event
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.Queue nested publications and drain them after the current dispatch completes
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.Clear every observer's subscription immediately after receiving one health notification
C.Include an entity identifier and monotonic revision so observers can reject stale revisions
D.Assign each observer a random delay so duplicate notifications rarely execute together
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.Change the asset directly and restore its values when the current scene unloads
B.Create a runtime clone with Instantiate and modify the clone
C.Wrap the shared asset in a singleton and modify it through the singleton reference
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.Pair registration in OnEnable with unregistration in OnDisable
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.Register in constructors and unregister only when the application process exits
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 →