Pooling Basics
Which technique best avoids the performance cost of frequent object creation and destruction during runtime in a game scene?
- Object pooling
- Garbage collection
- Infinite loops
- Object cloning
- Object fooling
Update Loop Optimization
What is a recommended approach to optimize the update logic for a large number of game objects?
- Process only active or visible objects
- Update all objects every frame regardless of state
- Use random delays in update calls
- Remove the update method entirely
- Update objects based on the camera's z-index
Scene Graphs
In a scene graph, how is parent-child transformation typically handled?
- Children inherit transformations from their parents
- Parents inherit transformations from their children
- Only root nodes are transformed
- Transformations are ignored in graphs
- Parent and child transformations cancel each other out
Disabling Components
In many game engines, what is an efficient way to temporarily stop a GameObject from being updated and rendered?
- Disable its component or setActive(false)
- Rename the GameObject
- Reduce its opacity to zero
- Remove the object and recreate it later
- Set positionX to NaN
Spatial Partitioning
Which data structure is commonly used to partition a 2D scene to accelerate collision detection?
- QuadTree
- HeapSort
- StringArray
- StackTrace
- CircleGrid
Timer Usage
In game loops, what is the advantage of using deltaTime (time since last frame) to update object movement?
- Ensures frame-rate independent movement
- Increases frame rate by skipping rendering
- Disables motion blur automatically
- Enables instant respawn mechanics
- Multiplies memory usage by deltaTime
Reference Removal
What happens if references to unused game objects are not cleared in your scene, especially in languages with garbage collection?
- Memory leaks may occur
- Frame rate instantly doubles
- Objects become automatically optimized
- The scene rendering turns grayscale
- Sound effects are disabled
Code Snippet: Optimized Loop
Given the code snippet, which loop is more efficient for iterating over a large list of static game objects in update():nA) for (let obj of gameObjects) { /* do nothing */ }nB) for (let i = 0; i u003C gameObjects.length; ++i) { /* do nothing */ }nC) gameObjects.forEach(function(obj){ /* do nothing */ });nD) while(true) { /* do nothing */ }nE) forEachObject(gameObjects, obj =u003E { /* do nothing */ });nWhich is the most efficient?
- B) for (let i = 0; i u003C gameObjects.length; ++i) { /* do nothing */ }
- C) gameObjects.forEach(function(obj){ /* do nothing */ });
- A) for (let obj of gameObjects) { /* do nothing */ }
- D) while(true) { /* do nothing */ }
- E) forEachObject(gameObjects, obj =u003E { /* do nothing */ });
Scene Loading
What is an efficient practice when transitioning between large scenes in a game?
- Unload unused assets and preload required ones for the next scene
- Keep all assets from all scenes loaded
- Use a recursive loading approach
- Bake all scenes into a single texture
- Resize all assets on-the-fly during transition
Fixed vs Variable Timestep
Why is a fixed timestep commonly used for physics updates instead of a variable timestep?
- It makes physics simulations deterministic and stable
- It brakes the physics engine
- It decreases update frequency to once per second
- It disables deltaTime usage
- It saves GPU memory