Unity Certified Associate Programmer Exam-style mock test
Unity Certified Associate Programmer Practice Exams|Practice test
Full explanations
Exam format
Pass line 70%
33 USD One-time · lifetime access
Enroll →
Sample questions
Example1 · C# Scripting Fundamentals in Unity
A developer at a B2B SaaS company is building an in-app onboarding tour in Unity. They need a script that caches a reference to the company's branded header panel exactly once when the GameObject is created, before any frame updates run. Which MonoBehaviour method should hold this caching logic?
・FixedUpdate(), because it runs on the fixed physics timestep before rendering frames begin
Incorrect. FixedUpdate() runs repeatedly on the physics timestep and is meant for physics calculations, not one-time setup.
・LateUpdate(), because it runs each frame after all other Update calls have completed
Incorrect. LateUpdate() runs every frame after Update, so it is not a single initialization point.
✓Awake(), because it runs once when the script instance is loaded prior to any frame updates
Correct. Awake() is called once when the instance is loaded, before Start and before any frame updates, making it ideal for caching references.
・OnGUI(), because it is invoked when the object becomes enabled and processes layout events
Incorrect. OnGUI() is called multiple times per frame for immediate-mode GUI rendering, not for one-time initialization.
Explanation
Awake() executes exactly once as the script loads and runs before the first frame, which matches one-time reference caching.
Example2 · GameObjects, Components & Prefabs
At the B2B SaaS firm Flowdeck, a developer builds an interactive onboarding dashboard in Unity. A script on the 'TourMarker' GameObject needs a reference to that same object's Rigidbody at runtime so it can disable gravity when a tooltip appears. Which single line correctly retrieves that Rigidbody from inside the script?
・Rigidbody rb = gameObject.FindComponent<Rigidbody>();
Incorrect. There is no FindComponent method on GameObject; the correct generic accessor for a component on the same object is GetComponent.
・Rigidbody rb = Component.Get(typeof(Rigidbody), this);
Incorrect. Component.Get is not a valid Unity API; components are retrieved through the generic GetComponent method instead.
✓Rigidbody rb = GetComponent<Rigidbody>();
Correct. GetComponent<Rigidbody>() returns the Rigidbody attached to the same GameObject the script runs on, which is exactly what is needed here.
・Rigidbody rb = transform.AddComponent<Rigidbody>();
Incorrect. AddComponent creates and attaches a new component rather than retrieving the existing Rigidbody, and it is not called on Transform this way.
Explanation
GetComponent<T>() is the standard way to access an existing component attached to the same GameObject as the script.
Example3 · Physics, Input & Collision
In a B2B SaaS onboarding mini-game, a player-controlled cursor orb must move with momentum and respond to collisions from the physics engine. Which approach correctly drives the orb's movement through Unity's physics system?
・Set transform.position each frame toward the target so the orb snaps directly to the new location without physics interference
Incorrect. Setting transform.position bypasses the physics engine, so collisions and momentum are not resolved and the orb teleports.
✓Call rigidbody.AddForce() inside FixedUpdate() so the physics engine integrates the force and resolves collisions consistently
Correct. AddForce in FixedUpdate lets the physics engine integrate the force on its fixed timestep and resolve collisions properly.
・Change transform.position inside LateUpdate() every frame after camera movement so the orb always ends up where intended
Incorrect. Writing transform.position in LateUpdate still bypasses physics, breaking collision response and momentum.
・Assign a value to rigidbody.velocity once in Start() and never update it again during the rest of the gameplay loop
Incorrect. Setting velocity once in Start gives a single impulse that never responds to new input or collisions over time.
Explanation
Physics-driven movement should apply forces (or velocity) to the Rigidbody inside FixedUpdate so the engine integrates motion and resolves collisions; directly writing transform.position bypasses physics.
Example4 · UI, Animation & Audio
A healthcare services firm builds a VR training app where a patient-vitals panel must float in front of a 3D hospital ward and be occluded by passing nurse avatars. Which Canvas Render Mode setting lets the UI exist in world space and respect 3D depth sorting?
・Set the Canvas Render Mode to Screen Space - Overlay so the panel always draws on top regardless of camera position or scene geometry
Incorrect. Screen Space - Overlay always renders on top of the scene and cannot be occluded by 3D geometry such as avatars.
✓Set the Canvas Render Mode to World Space and position the panel transform within the scene so it is depth-sorted against 3D objects
Correct. World Space places the Canvas as a transform in the scene so it is depth-sorted against 3D objects and can be occluded by them.
・Set the Canvas Render Mode to Screen Space - Camera and assign the main camera so the panel follows the viewport at a fixed plane distance
Incorrect. Screen Space - Camera renders at a fixed distance from the camera plane and does not sit inside the ward to be occluded by avatars.
・Keep the default Overlay mode but lower the Canvas sort order value below the renderers of the nurse avatar meshes in the ward
Incorrect. Canvas sort order affects UI layering only and does not make an Overlay canvas respect 3D scene depth.
Explanation
World Space render mode treats the Canvas like any other scene object, enabling true 3D depth sorting and occlusion needed for VR panels.
Example5 · Performance, Build & Debugging
A healthcare services firm ships a patient-intake kiosk app that stutters whenever a new appointment panel opens. The programmer wants to find which methods consume the most main-thread time during that frame spike. Which Unity Profiler module and view should they inspect first?
・The Memory module in detailed snapshot mode, filtering by the managed heap to list every allocated object type currently resident
Incorrect. The Memory module reveals allocations, not per-method CPU time, so it will not point to the slow method causing the stutter.
✓The CPU Usage module with the Timeline view, drilling into the spike frame to see per-method main-thread durations
Correct. The CPU Usage module's Timeline view shows per-method main-thread durations for a selected frame, pinpointing the method responsible for the spike.
・The Rendering module in frame-debugger mode to count draw calls and batches issued during that visible UI transition
Incorrect. The Rendering module surfaces draw-call and batching data, which diagnoses GPU/render cost rather than the main-thread method causing the stall.
・The Audio module, checking active voices and DSP load to confirm playback is not blocking the main thread this frame
Incorrect. The Audio module reports voice and DSP load, which is unrelated to the scripted UI logic driving the frame spike.
Explanation
CPU-bound stutters are diagnosed by selecting the spike frame in the CPU Usage module's Timeline (or Hierarchy) view to read per-method durations on the main thread.
Example6 · C# Scripting Fundamentals in Unity
A developer at a healthcare services firm is building a patient-triage kiosk and needs to store a patient's body temperature such as 37.4 in a MonoBehaviour field that is visible and editable in the Unity Inspector. Which field declaration correctly stores a decimal temperature value that is exposed to the Inspector?
✓public float bodyTemperature; declares a floating-point field that Unity serializes and shows in the Inspector
Correct. A public float holds decimal values like 37.4 and public serializable fields are exposed in the Inspector by default.
・private int bodyTemperature; declares a whole-number field that Unity serializes and shows in the Inspector
Incorrect. An int stores only whole numbers, so the fractional part of 37.4 would be truncated to 37.
・public bool bodyTemperature; declares a true-or-false field that Unity serializes and shows in the Inspector
Incorrect. A bool stores only true or false and cannot represent a numeric temperature value at all.
・internal string bodyTemperature; declares a text field that Unity automatically serializes and shows in the Inspector
Incorrect. A string stores text rather than a number, and the internal modifier is not Unity's default serialization trigger.
Explanation
float is the standard type for decimal numbers in Unity, and public primitive fields are serialized and shown in the Inspector automatically.
Example7 · C# Scripting Fundamentals in Unity
In the UrbanThread retail kiosk app, a developer needs code to run once when a GameObject is first created and before any other logic executes for that object. Which MonoBehaviour method should hold this one-time setup code?
✓The Awake method, which Unity calls once as the script instance loads, before any Start methods run
Correct. Awake runs once when the script instance is loaded, before any Start call, making it the right place for one-time initialization.
・The FixedUpdate method, which Unity calls on a fixed timestep tied to the physics simulation loop
Incorrect. FixedUpdate runs repeatedly on the physics timestep and is intended for physics work, not one-time setup.
・The LateUpdate method, which Unity calls once per frame after all Update methods have completed
Incorrect. LateUpdate runs every frame after Update and is meant for follow-up frame logic, not initialization.
・The OnGUI method, which Unity calls every frame to render and handle immediate-mode interface events
Incorrect. OnGUI runs every frame for immediate-mode UI rendering and is unrelated to one-time object setup.
Explanation
Awake is the earliest lifecycle callback, called once as the script loads and before Start, so one-time initialization belongs there.
Example8 · C# Scripting Fundamentals in Unity
The UrbanThread loyalty script stores a shopper's point balance that must always be a whole number and never hold fractional values. Which C# type declaration best fits this requirement?
・A float field, because it can represent both whole and fractional point totals using decimal precision
Incorrect. float stores fractional values, which contradicts the requirement that the balance always be a whole number.
✓An int field, because it holds whole-number values and rejects any fractional point amount
Correct. int represents whole numbers only, so it enforces the whole-number point balance requirement.
・A string field, because point values can be stored and displayed directly as readable text
Incorrect. string stores text, not arithmetic numbers, so it is unsuitable for a numeric point balance.
・A bool field, because it is the most memory-efficient way to record whether points exist
Incorrect. bool only stores true or false and cannot represent a numeric point total at all.
Explanation
A whole-number-only value maps directly to int, which stores integers and cannot hold fractional amounts.
Example9 · C# Scripting Fundamentals in Unity
On the UrbanThread checkout controller, a developer wants a private variable to remain inaccessible to other classes yet still be editable in the Inspector. Which approach achieves both goals?
・Change the field to public so Unity displays it in the Inspector and other scripts can also read it
Incorrect. Making the field public does expose it but also grants access to other classes, breaking the privacy requirement.
✓Mark the private field with the [SerializeField] attribute so Unity shows it while keeping it non-public
Correct. [SerializeField] serializes a private field so it appears in the Inspector while remaining non-public to other code.
・Add the [HideInInspector] attribute to the field so Unity keeps the value private and editable at runtime
Incorrect. [HideInInspector] does the opposite, hiding a serialized field from the Inspector rather than showing it.
・Wrap the field in a public property with a getter so the Inspector can bind to the exposed value
Incorrect. Unity does not serialize ordinary C# properties by default, so a getter property would not appear in the Inspector.
Explanation
[SerializeField] lets Unity serialize and display a private field in the Inspector without exposing it publicly to other scripts.
Example10 · C# Scripting Fundamentals in Unity
A developer at a financial services firm is scripting a trading dashboard in Unity and needs a field to store an account balance like 10425.37 that must retain decimal precision when shown in the UI. Which variable declaration best fits this requirement?
・public int accountBalance declared on the component so the inspector can display the whole-number balance value
Incorrect. An int can only hold whole numbers, so assigning 10425.37 would truncate the decimal portion and lose the required precision.
✓public float accountBalance declared as a serialized field so the decimal balance appears in the inspector
Correct. A float stores fractional numeric values, so it preserves the decimal balance and is serialized for inspector editing while remaining usable in arithmetic.
・public bool accountBalance declared on the component to track whether the account balance is currently positive
Incorrect. A bool stores only true or false, which cannot represent a numeric monetary balance at all.
・public string accountBalance declared so the balance can be concatenated directly into a formatted label
Incorrect. A string holds text, so the value cannot be used in numeric calculations without conversion and is a poor fit for a balance amount.
Explanation
Monetary values with decimals require a floating-point numeric type; float is the standard Unity-serializable choice for such fields.
Example11 · C# Scripting Fundamentals in Unity
On a payment-processing scene, a developer wants a transaction-fee value to appear and be editable in the Inspector but does not want other scripts to access or modify it directly through code. Which declaration achieves this?
・public float transactionFee, which exposes the field to the Inspector and also lets every other script read and write it
Incorrect. Making the field public does expose it to the Inspector but it also grants unrestricted read/write access to other scripts, which the requirement forbids.
・private float transactionFee, which keeps the field script-private but leaves it hidden from the Inspector entirely
Incorrect. A plain private field is hidden from other scripts but Unity will not show a private field in the Inspector by default.
✓[SerializeField] private float transactionFee, which exposes it to the Inspector while keeping it inaccessible from other scripts
Correct. The SerializeField attribute forces a private field to be shown and edited in the Inspector while its private access keeps other scripts from touching it.
・[HideInInspector] public float transactionFee, which makes it public to scripts yet deliberately hidden from the Inspector view
Incorrect. This does the opposite of what is needed: it hides the field from the Inspector while exposing it publicly to code.
Explanation
SerializeField exposes a private field to the Inspector without making it public, satisfying both encapsulation and editor visibility.
Example12 · C# Scripting Fundamentals in Unity
In the inventory app for a manufacturing distributor, a script must store the count of steel pallets currently on a forklift, a value that is always whole and never negative in practice. Which variable declaration best fits storing this whole-number quantity?
・public float palletCount = 0f; so the warehouse count supports fractional readings from the scale
Incorrect. A float stores fractional values and is unnecessary for a counted whole quantity, risking rounding display issues.
✓public int palletCount = 0; because the quantity is a non-fractional counted whole number
Correct. An int stores non-fractional whole numbers, which matches a counted pallet quantity precisely.
・public string palletCount = "0"; so the quantity text can be shown directly in the UI label
Incorrect. A string stores text and cannot be used directly in arithmetic without parsing, which is error-prone.
・public bool palletCount = false; because each forklift either carries pallets or does not
Incorrect. A bool stores only true or false and cannot represent a numeric count of multiple pallets.
Explanation
A counted, non-fractional quantity maps to the int type; float, string, and bool do not represent whole counts correctly.
Example13 · C# Scripting Fundamentals in Unity
A conveyor-belt controller script for the distributor's packing line needs to cache a reference to its own Rigidbody once, before any physics runs, so later frames avoid repeated lookups. In which MonoBehaviour method should the GetComponent call be placed for this one-time setup?
・Inside Update(), so the Rigidbody reference refreshes on every rendered frame during operation
Incorrect. Update runs every frame, so caching there repeats the lookup needlessly and wastes performance.
✓Inside Awake(), which runs once when the script instance is loaded before gameplay begins
Correct. Awake runs once on load before gameplay, making it the proper place for one-time reference caching.
・Inside OnDestroy(), so the reference is prepared while the conveyor object is being removed
Incorrect. OnDestroy runs as the object is removed, far too late to cache a reference for gameplay use.
・Inside FixedUpdate(), so the lookup stays synchronized with each physics simulation step
Incorrect. FixedUpdate runs each physics step, so caching there also repeats the lookup unnecessarily each tick.
Explanation
Awake executes once when the instance loads, which is the correct lifecycle point for caching component references.
Example14 · C# Scripting Fundamentals in Unity
A telecom operator's network-ops simulation game caches a reference to a signal-tower component once, right when a script instance is created, before any per-frame logic runs. In which MonoBehaviour method should this one-time reference caching be placed so it executes a single time as the object initializes?
✓Awake, which Unity calls once when the script instance is being loaded, before any Start method runs
Correct. Awake runs once as the instance loads, before Start, making it the right place for one-time reference caching.
・Update, which Unity calls every frame so the reference stays current as the simulation advances continuously
Incorrect. Update runs every frame, so caching there would redundantly re-assign the reference on every tick instead of once.
・FixedUpdate, which Unity invokes on a fixed physics timestep to keep tower calculations deterministic over time
Incorrect. FixedUpdate is tied to the physics timestep and also repeats; it is not intended for one-time initialization.
・Awake, called once at load
Incorrect. While Awake is correct, this phrasing is too terse; the first option fully and accurately describes the one-time load behavior.
Explanation
Awake executes exactly once when the script instance loads, before Start and before any per-frame callbacks, which is ideal for one-time reference caching.
Example15 · C# Scripting Fundamentals in Unity
In the telecom operator's billing-simulation script, a developer passes a struct representing a call-record to a method and modifies its fields inside that method, then is surprised the original record is unchanged. Why does the caller's original struct remain unmodified?
✓A struct is a value type, so passing it to a method copies the whole value and the method mutates only that local copy
Correct. Structs are value types; passing one by value copies it, so the method mutates a copy, leaving the caller's original intact.
・A struct is a reference type whose heap pointer is shared, meaning the method modified a different object entirely by design
Incorrect. Structs are value types, not reference types, so no shared heap pointer is passed to the method in this case.
・Structs are immutable in C#, so the compiler silently discards any field assignments performed within the called method
Incorrect. Structs are not inherently immutable in C#; their fields can be assigned, but the change affects only the passed copy.
・Methods always clone
Incorrect. This oversimplifies; it is value-type copy semantics specifically, not a blanket rule that all methods clone arguments.
Explanation
Structs are value types, so passing one by value creates a copy; mutations inside the method affect that copy, not the caller's original.
▶ Try 10 free questions (graded)