Top 100 Game Programmer Practice MCQs
Every question on one page: open one, choose an answer, and see why at once. Signed in, your latest answer to each question counts, and you can answer again after 24 hours.
Curated: · Written: · Reviewed: —
This collection is currently unranked practice while editorial review is pending.
MCQ-1A per-frame `spawnEnemy` function does `Enemy* e = new Enemy();` then returns `nullptr` early when validation fails, leaking `e`, while callers own the returned pointer. Which RAII change fixes the leak without changing caller ownership?
Answer to see the discussion.
MCQ-2A C++ level spawns at most 512 enemies into `std::vector<Enemy>`, caching an `Enemy*` immediately after the first `emplace_back`. The level-load memory budget covers exactly 512 `Enemy` slots, and no reallocation is allowed during spawning. Which reservation keeps every cached pointer valid?
Answer to see the discussion.
MCQ-3A game targets 60 fps with a 16.6 ms frame budget. Profiling shows 9 ms CPU work, 14 ms GPU work, and a fixed 4 ms CPU-GPU sync on the critical path, with CPU and GPU work overlapped. A GPU optimization cuts GPU work by 6 ms; what is the resulting frame time and bottleneck?
Answer to see the discussion.
MCQ-4A Unity C# game with 180 enemies spikes every 2 seconds and profiler shows 1.2 MB per frame allocated in `Enemy.Update`, mostly a LINQ `Where().ToList()` targeting call per enemy per frame, while projectiles spawn about four times per second. Which change most directly reduces the GC pauses without rewriting the system?
Answer to see the discussion.
MCQ-5A gameplay check uses unit forward and wall-normal vectors to test perpendicularity before projecting movement onto the wall. Which dot product and scalar projection confirm the vectors are perpendicular?
Answer to see the discussion.
MCQ-6A camera moves along direction `(2, 0, 2)` at a speed of 5 units per second, but diagonal movement must not be faster than axis-aligned movement. Which velocity results from correctly preparing the direction before applying that speed?
Answer to see the discussion.
MCQ-7A game engine uses column vectors with `v' = M * v`, so the rightmost matrix acts first. An object must be scaled about its origin, then rotated, then translated into place. Which product applies those transforms in that sequence?
Answer to see the discussion.
MCQ-8Thousands of AABBs never move, and one sphere moves through them each frame. Which broadphase structure cuts the pair tests most effectively?
Answer to see the discussion.
MCQ-9A projectile travels at `900 m/s` toward a `0.2 m` wall while frame time varies between `8 ms` and `33 ms`, and replays must match at `60 Hz` and `144 Hz`. Physics uses a fixed `1/120 s` step, so each step still moves the projectile several metres. Which physics change stops the projectile tunnelling through the wall?
Answer to see the discussion.
MCQ-10Physics steps at `1/60 s` while rendering at `144 Hz` with a `6.94 ms` frame time. After stepping, the accumulator holds `10 ms` leftover and rendering interpolates between previous and current physics states. Which interpolation weight should the renderer use for this frame?
Answer to see the discussion.
MCQ-11A C++ game server stores items in `unordered_map<int, Item>` using an identity hash at a high load factor. Crafted item IDs create long collision chains and cause frame spikes during lookups. Which hash and load-factor change best fixes this?
Answer to see the discussion.
MCQ-12A loot table sorted by rarity contains duplicate rarities, and a roll must return the first entry strictly above the threshold so equal-rarity entries are skipped. Which binary search result should the roll use?
Answer to see the discussion.
MCQ-13`A` holds 4 items sorted by rarity in a buffer with 3 trailing empty slots, and `B` holds 3 sorted items; equal-rarity `A` items must precede `B` items, with no extra allocation in a single pass. Which two-pointer walk merges them in linear time while preserving that order?
Answer to see the discussion.
MCQ-14A level editor pushes place, move, and delete actions onto an undo stack. The designer undoes the delete and then the move, places a new prop as a fresh edit, then presses redo once. What should the editor do with the redo stack when the new edit is recorded?
Answer to see the discussion.
MCQ-15A C++ game keeps `5000` active particles in spawn order and removes dead particles from the middle every frame, given only a pointer to the particle being removed. It only iterates front to back and never needs random access by index. Which structure best fits this splicing pattern?
Answer to see the discussion.
MCQ-16A scene hierarchy is listed with each parent before its children and siblings in order. Which traversal visits the nodes in that same order?
Answer to see the discussion.
MCQ-17An enemy uses BFS, which treats every step as equal, to reach a goal through three corridors that meet only at the start and goal. The northern corridor has six mud steps costing four each, the southern has eight road steps costing one each, and the eastern has seven mixed steps costing two each, so which corridor does BFS return?
Answer to see the discussion.
MCQ-18An NPC runs `A*` on a four-connected grid along the only route `S-A-B-G`, where each of the three steps costs 2 and `h(S)=5`, `h(A)=4`, `h(B)=2`, `h(G)=0`. The heuristic is consistent, satisfying `h(n) <= 2 + h(next)` on every edge. What path cost does `A*` return when `G` is expanded?
Answer to see the discussion.
MCQ-19A C++ game keeps 5000 enemies in a min-heap keyed by next think time. One enemy is alerted, so its think time moves from 10 seconds to 1 second from now while its stored key stays at 10 seconds. Which heap operation restores the correct earliest event before the next frame?
Answer to see the discussion.
MCQ-20A character's `flags` uses `JUMP = 1` and `CROUCH = 2` as separate bits. The game must trigger only when both actions are active in the same frame. Which bitmask test checks for both flags together?
Answer to see the discussion.
MCQ-21An NPC in C++ must be in exactly one of `Idle`, `Chase`, or `Flee`, with only `Idle->Chase`, `Chase->Idle/Flee`, and `Flee->Idle` allowed, and its state is replicated as a single byte. A bug allowed `Idle->Flee` and simultaneous chase/flee flags. Which encoding enforces both constraints?
Answer to see the discussion.
MCQ-22A C++ `PlayerHealth` component changes health from damage and healing. HUD, audio, and achievement systems must react without `PlayerHealth` depending on them, and a subscriber may unsubscribe during notification. Which observer design fits this situation?
Answer to see the discussion.
MCQ-23A shipped C# `Weapon` class hard-codes rifle `Fire()`, and designers add shotgun and laser variants weekly without modifying existing code. A pickup must swap firing mode on the same `Weapon` instance, combined independently with multiple ammo types. Which composition choice fits?
Answer to see the discussion.
MCQ-24A Unity rigidbody player must apply a constant force each physics step so motion stays consistent across frame rates, while a camera follows the player every rendered frame. Which callback pairing fits these two jobs?
Answer to see the discussion.
MCQ-25A C# simulation stores 8000 `Particle` structs in an array and calls `Step(Particle p)` for each element every frame. `Step` reads the current velocity, then updates velocity and position in place, but the profiler shows the 64-byte struct copies dominating frame time. Which signature change removes the copies while keeping the updates?
Answer to see the discussion.
MCQ-26A `UObject* cachedMesh` member is assigned in `BeginPlay` and is the only reference to a spawned object. No `UPROPERTY` marks the member, and a garbage collection runs before the mesh is used. What happens to the referenced object?
Answer to see the discussion.
MCQ-27A large triangle viewed at a glancing angle stores a tint per vertex that must blend linearly in screen space, so equal screen-space steps receive equal tint steps. Which shader approach produces that interpolation?
Answer to see the discussion.
MCQ-28A 4K texture without mipmaps shimmers and aliases when its surface is viewed from far away, where many texels collapse into one screen pixel. Which mip level choice fixes that distant aliasing?
Answer to see the discussion.
MCQ-29A prop uses an 80k-triangle LOD0 and a 6k-triangle LOD1, and the camera can zoom from 24mm to 200mm at 1080p. At the same 40m distance it fills 180 pixels wide-zoomed-out but only 22 pixels zoomed-in, yet LOD0 still draws. Which swap rule cuts draw cost without visible popping?
Answer to see the discussion.
MCQ-30A normalised frustum has a prop with a 2 m bounding sphere whose centre is 1 m outside the left plane, and another whose centre is 3 m outside that plane. The first straddles the screen edge and must be drawn, the second is fully off-screen. Which rejection rule draws the first and rejects the second?
Answer to see the discussion.
MCQ-31A level contains 800 static props sharing one material, with no repeated geometry, all visible on screen and never moving. The profiler shows 800 draw calls and CPU submission is the bottleneck. Which batching approach most directly reduces the draw calls?
Answer to see the discussion.
MCQ-32Two threads write `player.position` at the same time with no lock or atomic. What does C++ call this outcome, and what single lock prevents it?
Answer to see the discussion.
MCQ-33A C++ job system has eight worker threads claiming tasks from a shared `nextTask` counter for 1024 tasks, where each worker needs a unique index and any index at or above 1024 means it should exit. Workers cannot take a mutex or retry indefinitely on the hot path because they must make lock-free progress within the frame budget. Which atomic operation should each worker use to claim its task index?
Answer to see the discussion.
MCQ-34Four clients run identical Q16.16 fixed-point lockstep simulation at 60 Hz, but one applies inputs after one tick while the others use three. Remote inputs arrive up to two ticks after capture, need one tick of processing, and input latency must stay within three ticks. Which delay change restores identical simulation?
Answer to see the discussion.
MCQ-35A shooter with `120 ms` ping fires at a strafing target under the crosshair on the client. The server receives the shot `120 ms` later, rewinds the target to the client's fire time, and confirms a hit, while the client predicted a miss from the target's later position. Which rewind explains the server hit?
Answer to see the discussion.
MCQ-36A ball hits a stationary floor with restitution 0.5 in a 2D physics engine. Which velocity change on collision follows from that restitution value?
Answer to see the discussion.
MCQ-37A hitscan rifle's ray starts just behind its barrel collider, passes a trigger volume at 6 m, then an enemy at 18 m, with a wall at 150 m beyond the 100 m weapon range. The shot must damage the enemy's body collider, never the barrel or trigger, and report no hit beyond range. Which query fits?
Answer to see the discussion.
MCQ-38A first-person game raises its perspective camera from 60 degrees to 100 degrees vertical field of view, and doorframes near the screen edges now stretch noticeably while the centre looks normal. Which projection matrix parameter controls this edge distortion?
Answer to see the discussion.
MCQ-39A turret parent sits at `(10, 0, 0)`, is rotated 90 degrees counterclockwise about Z so local +X points along world +Y, and has uniform scale 2. Its child muzzle has local position `(2, 0, 0)` and you need its world position for a spawn effect. What world position should the effect use?
Answer to see the discussion.
MCQ-40A game world places gameplay 500 km from the origin and renders with float32 vertex positions, causing visible jitter. The GPU pipeline cannot be changed to double precision. Which fix removes the jitter?
Answer to see the discussion.
MCQ-41A C++ simulation has `200000` entities with `Vec3 pos` (12 bytes), `Vec3 vel` (12 bytes), `int health`, and `int cooldown`, using 64-byte cache lines and 64-byte-aligned arrays. Each frame integration reads and writes only `pos` and `vel`. How many cache lines does the fastest layout load for that integration pass?
Answer to see the discussion.
MCQ-42Thread W writes its own counter 100,000 times per second, while thread R reads its own counter at the same rate and writes it once per second. The counters are adjacent on the same 64-byte cache line. Which thread suffers most from false sharing?
Answer to see the discussion.
MCQ-43A Linux C++20 game uses `std::string` from libstdc++ for enemy tags. The tag `Enemy_Alpha_07_XYZ` triggers a heap allocation in the profiler, though the developer expected small string optimization to cover it. What explains the allocation?
Answer to see the discussion.
MCQ-44A shipped C++ game must handle a recoverable failure in its per-frame update without unwinding through engine code. Which policy fits the shipped build?
Answer to see the discussion.
MCQ-45A C++ game crashes only in its Release -O2 build, with a suspected use-after-free in an entity pool, while Debug runs clean and the shipped dump has no line numbers. Which rebuild step isolates the fault?
Answer to see the discussion.
MCQ-46A Unity team already on Git adds a 2 GB texture pack that bloats every clone, and artists update separate textures weekly without editing the same file together. They want to keep Git workflow without a new server. Which storage choice fits?
Answer to see the discussion.
MCQ-47A C++ game engine takes 20 minutes to rebuild, and designers change enemy chase behaviour and weapon damage several times a day. Rendering and physics must stay native for the 16.6 ms frame budget, while gameplay logic needs live iteration during playtests. Which boundary lets designers iterate without a full rebuild?
Answer to see the discussion.
MCQ-48A 3D sound source sits behind the player in a stereo game mix. It should sound quieter than when in front and be panned toward the rear speakers. Which spatial audio parameters control that effect?
Answer to see the discussion.
MCQ-49A 30 fps game uses vsync and polls input once at the start of `Update`. A key press arrives just after that poll, so the current frame misses it and the next frame's image is presented at the following vsync boundary. What is the worst-case press-to-presented-frame latency, excluding scanout?
Answer to see the discussion.
MCQ-50A shipped game saves `SaveData` as JSON containing health, position, and gold, with no stamina field. Version 2 renames gold to coins at a one-to-one value and adds stamina, which migrated characters must start with full at 100. Which migration should the loader apply?
Answer to see the discussion.
MCQ-51A character in `Update` moves at 5 units per second, with frame times varying between 8 ms and 33 ms and no hitches beyond that range. Design requires identical travel speed at 30, 60 and 120 fps, with no replay determinism or physics tick involved. What per-frame multiplication achieves that?
Answer to see the discussion.
MCQ-52A camera turn needs the fastest approach that eases out without overshoot. Which damping shape is defined by that behaviour?
Answer to see the discussion.
MCQ-53A projectile leaves a `5 m` tower at 45 degrees with speed `20 m/s` under `g = 10 m/s^2` toward flat ground below. What horizontal distance from the tower base does it land?
Answer to see the discussion.
MCQ-54An enemy is `3 m` from its target, moving at max speed `6 m/s` toward it, with a slowing radius of `4 m`. It must stop at the target without oscillating around it. Which steering force should it apply now?
Answer to see the discussion.
MCQ-55A guard must flee below 30 health, otherwise chase only when the player is visible and within 20 m, otherwise patrol. Its nested if-else chain is edited weekly and bugs swap the chase conditions. Which behavior tree structure encodes the chase conjunction and the priority fallback?
Answer to see the discussion.
MCQ-56An NPC navigates a navmesh when a dynamic crate blocks one polygon, closing its adjacency edges to neighbours. The team runs A* over navmesh nodes to route around the crate to the goal. Which A* formulation applies to this navmesh search?
Answer to see the discussion.
MCQ-57A game rolls loot on every kill using `randFloat()` returning uniform values in [0,1), and must average a 5 percent drop rate over thousands of kills. Which threshold test gives that rate?
Answer to see the discussion.
MCQ-58A wide-FOV camera views two overlapping transparent smoke puffs near opposite screen edges, with depth testing on and no depth writes for transparent surfaces. Their straight-line distances from the camera rank opposite to their distances along the view axis, and the nearer puff must blend over the farther one. Which sorting key orders them correctly for this view?
Answer to see the discussion.
MCQ-59A decal lies exactly coplanar with the floor and flickers as depth values compete. The engine locks the 24-bit depth format and projection, and gameplay raycasts require the decal to stay coplanar. Which depth fix stops the flicker for this decal?
Answer to see the discussion.
MCQ-60A low-poly wall uses a flat geometric normal and must show scratched detail in lighting without changing its silhouette or adding vertices. The scratch texture is authored in tangent space for the wall's UVs. Which perturbation should the shader apply?
Answer to see the discussion.
MCQ-61A diffuse surface stores normal `N = (0, 3, 4)` and a directional light points toward `L = (0, 4, 3)`, both unnormalised, with intensity 1. What diffuse brightness factor does Lambert's law give after normalising both vectors?
Answer to see the discussion.
MCQ-62A directional shadow map renders clean shadows on flat ground but striped acne across a sloped terrain mesh, while contact shadows must stay attached to objects. Increasing the constant depth bias clears the stripes yet visibly detaches shadows from their casters. Which bias adjustment should the renderer use?
Answer to see the discussion.
MCQ-63A character running at constant speed switches between two run cycles with identical phase and root speed, and the crossfade must finish in 0.3 seconds without changing blended root speed or foot phase rate. The blend weight is `t = elapsed / duration`, clamped to [0,1]. Which weight interpolation should the animator use?
Answer to see the discussion.
MCQ-64A character's hip advances while its right foot must stay planted on a step, solved with two-bone leg IK and a knee pole direction. The foot currently slides forward as the hip moves. Which constraint keeps the foot planted?
Answer to see the discussion.
MCQ-65A ragdoll limb falls at `30 m/s` toward a `0.05 m` floor at `60 Hz`, moving `0.5 m` per step, and the physics budget allows no extra substeps. Which collision fix stops the limb tunnelling through the floor?
Answer to see the discussion.
MCQ-66A server replicates 500 mostly static objects, with 10 moving ones that change every tick. Full transforms exceed the 20 KB/s budget even at 10 Hz, and moving objects need interpolation between updates. Which update strategy fits the budget?
Answer to see the discussion.
MCQ-67A live game has 40 abilities designers retune weekly in data files, each combining cooldown, resource cost, and unlock condition. Runtime must reject unavailable abilities each frame without code changes per ability. Which component design fits this setup?
Answer to see the discussion.
MCQ-68A RPG inventory holds up to 10000 distinct item types, each stack capped at 99, and total weight must never exceed the player's carry limit. Adding must find an existing entry by item ID, merge counts, and reject the whole addition if weight would exceed the limit, while the HUD reads total weight every frame. Which structure and invariant enforce this?
Answer to see the discussion.
MCQ-69A dialogue system has 48 nodes in a branching tree. Players can backtrack to the hub and choose another branch, but completed branch nodes must never show again in the same playthrough. Which graph state tracking prevents revisiting them?
Answer to see the discussion.
MCQ-70A top-down game has hundreds of active objective markers scattered across a 2D map. The quest tracker must find the marker nearest the player every frame, so which spatial query structure fits?
Answer to see the discussion.
MCQ-71A 2D game stores enemies in 32 m grid buckets and updates a minimap each frame for enemies within 25 m of the player. Enemies move between buckets as they walk, and the minimap must not miss any enemy inside that radius. Which bucket query should the minimap run?
Answer to see the discussion.
MCQ-72A game has 400 enemies on the Enemy layer that must collide with World geometry and the Player, but use steering separation so they should pass through each other. The engine currently tests every layer against every layer, reporting thousands of enemy-enemy overlaps each frame. Which Enemy mask removes those pairs while keeping needed hits?
Answer to see the discussion.
MCQ-73A kinematic platform moves right at 3 m/s while a player stands idle on it with no input, sliding backward relative to the deck each frame. The platform is moved by setting its physics velocity, and the player uses a dynamic character controller. Which velocity inheritance keeps the player carried with the platform?
Answer to see the discussion.
MCQ-74A kinematic crate rests on a non-solid trigger pressure plate that must keep a door open only while the crate is on it, closing immediately when it leaves, with no timer. Which `pressed` state and trigger pair implements that held behaviour?
Answer to see the discussion.
MCQ-75A player dies and respawns at the checkpoint with level 8, 12 potions, and an active quest flag intact. Enemies must return to their spawn positions and full health, while player position and health restore for the new attempt. Which reset boundary should respawn apply?
Answer to see the discussion.
MCQ-76A player completes the tutorial on one device, then reinstalls and logs in on a new device. The tutorial must not replay for that account, but must still appear for a brand-new account. Which check decides whether to trigger it?
Answer to see the discussion.
MCQ-77A rifle kicks `recoil` to 12 degrees on firing and must recover toward zero with rate `lambda` regardless of frame rate. At 60 Hz the offset should decay exponentially, never overshoot, and stay stable at low frame rates. Which update applies each frame?
Answer to see the discussion.
MCQ-78A character should reach full speed almost immediately and halt almost immediately when input stops. Which acceleration and friction settings produce that speed curve?
Answer to see the discussion.
MCQ-79A third-person camera sits on a 4 m boom from the head pivot, with a 0.1 m near plane, and thin walls 0.2 m thick can lie between pivot and desired position. A raycast stops the camera centre at the wall surface, yet the near plane still clips into geometry. Which sphere cast camera collision applies?
Answer to see the discussion.
MCQ-80A first-person sniper has a 90-degree vertical FOV and needs 4x zoom for aiming, while movement speed and world scale must stay unchanged. Which camera change gives that zoom?
Answer to see the discussion.
MCQ-81A streamed texture pops in at low resolution when the player turns quickly toward a large wall filling much of the screen. Which mip streaming priority should the engine apply?
Answer to see the discussion.
MCQ-82A mobile game has a lit shader with 256 keyword permutations, but any given level uses eight of them. Which eight depends on the quality tier chosen at launch, so the build cannot strip the rest, and the loading screen idles for five seconds before gameplay. The first draw compiles for 3 seconds and freezes the frame. Which precompilation or variant reduction should the team apply?
Answer to see the discussion.
MCQ-83A mobile game ships 2048x2048 color textures with smooth alpha and exceeds its 256 MB GPU memory budget. Target Android and iOS devices support ASTC, and textures must be sampled directly by the GPU without CPU decompression during play. Which compression format fits these textures?
Answer to see the discussion.
MCQ-84A console shooter allows at most `256` live bullets of `48` bytes each, with a fixed `12288`-byte pool budget and no allocation after level load. Playtests average `90` live bullets and peak at `210`, and spawns beyond the cap must be dropped. Which fixed pool sizing fits the deterministic memory budget?
Answer to see the discussion.
MCQ-85A server creates a vehicle actor and then a turret actor attached to it, and a client joins after both already exist. In what order does the joining client receive their spawn messages?
Answer to see the discussion.
MCQ-86A shipped C++ build defines `NDEBUG` for release optimisation and `CHEAT_ENABLED` for internal testing, and its cheat handler sits under `#ifdef CHEAT_ENABLED`. QA can still enter the code that sets `collisionEnabled=false` in the shipped binary. Which build change removes that code path from the shipped build?
Answer to see the discussion.
MCQ-87A character stands on a 30-degree ramp with ground normal.y = 0.866, while design allows jumping on slopes up to 45 degrees. The jump code requires `dot(normal, up) > 0.9`, so jumping fails on the ramp. Which ground check should replace it?
Answer to see the discussion.
MCQ-88A refactor rewrote `Enemy.Update` and its helpers, raising frame time from 11 ms to 15 ms in a deterministic replay with the same scene, seed, hardware and Release build. The team has CPU profiler captures from before and after the change. Which comparison isolates which function caused the increase?
Answer to see the discussion.
MCQ-89A C++ shooter allocates each bullet with `new Bullet()` inside the per-frame firing code, and the profiler shows allocation spikes during combat. A code review flags the raw `new` in this hot path. Which replacement should the review propose?
Answer to see the discussion.
MCQ-90A 60 fps title gates shipping on p95 frame time on target hardware: 15.1 ms against a 16.6 ms budget, leaving 1.5 ms headroom, with CPU and GPU costs adding on the critical path. A designer wants volumetric fog costing 2.8 ms GPU and 0.3 ms CPU, with a low setting costing 0.9 ms GPU. Which data best supports deciding whether to ship it?
Answer to see the discussion.
MCQ-91Your private feature branch has eight commits and the team requires linear history on main. A teammate merged three `Health` API commits to main that two other features already use, your merge conflicts in `Player.cpp`, and the build passes after resolving it but the integration test fails. Which merge and test step resolves it?
Answer to see the discussion.
MCQ-92A 3D action game is six weeks from certification, with core combat and saves finished, but scope added photo mode, ranked ladder, and four-player co-op. Playtesters rank co-op lowest in value, it needs netcode not yet started, while photo mode reuses the camera and ranked ladder reuses combat. Which cut list should the team adopt?
Answer to see the discussion.
MCQ-93A live game crashes on launch for most players after its latest update, and the team must restore play today outside the normal cycle. Which severity and release channel choice applies?
Answer to see the discussion.
MCQ-94A C++ game migrates its physics from Engine 4 to Engine 5, where `Body::AddForce(F)` now treats `F` as acceleration and ignores mass. The old code passes the same tuned force values to a 2 kg crate and an 80 kg player, and the player's mass rises when carrying the crate, with forces applied every fixed physics step. Which migration preserves the original motion for both bodies?
Answer to see the discussion.