




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. Which C# data type is best suited for storing a true/false value? A) int B) float C) bool D) string Answer: C Explanation: The bool type represents Boolean values true or false, which is ideal for logical conditions. Question 2. What will the following C# code output? int a = 5; a += 3; Debug.Log(a); A) 5 B) 8 C) 3 D) 0 Answer: B Explanation: The += operator adds 3 to a, resulting in 8, which is logged. Question 3. Which loop is guaranteed to execute at least once? A) for B) while
C) do‑while D) foreach Answer: C Explanation: A do‑while loop evaluates its condition after the first iteration, ensuring one execution. Question 4. Which collection provides fast key‑based lookup? A) List
Question 8. What is the correct way to declare a property that can be read but not set from outside the class? A) public int Health { get; set; } B) public int Health { get; private set; } C) public int Health { private get; set; } D) public int Health { get; protected set; } Answer: B Explanation: The private set accessor restricts modification to within the class while allowing public reads. Question 9. Which MonoBehaviour method is called first when a scene loads? A) Start() B) Awake() C) Update() D) OnEnable() Answer: B Explanation: Awake() runs before any Start() calls and before the object becomes enabled. Question 10. Which method is called once per physics step, independent of frame rate?
A) Update() B) LateUpdate() C) FixedUpdate() D) OnGUI() Answer: C Explanation: FixedUpdate() runs at a fixed timestep used for physics calculations. Question 11. When would you use LateUpdate() instead of Update()? A) To handle input B) To perform physics calculations C) To apply camera follow logic after all Update() calls D) To initialize variables Answer: C Explanation: LateUpdate() runs after all Update() calls, making it ideal for camera positioning based on updated object states. Question 12. Which statement about Coroutines is true? A) They run on a separate thread. B) They can pause execution with yield return. C) They must be declared as static.
Explanation: Colliders define the shape used for collision detection; without one, physics collisions won’t occur. Question 15. What does GetComponent<Rigidbody>() return if the component is missing? A) Throws an exception B) Returns null C) Returns a default Rigidbody D) Creates a new Rigidbody automatically Answer: B Explanation: GetComponent returns null when the requested component does not exist on the GameObject. Question 16. Which method would you use to destroy a GameObject after 2 seconds? A) Destroy(gameObject, 2f); B) DestroyImmediate(gameObject, 2f); C) GameObject.Destroy(gameObject, 2f); D) Both A and C are correct. Answer: D Explanation: Both syntaxes call UnityEngine.Object.Destroy with an optional delay parameter.
Question 17. To make a GameObject inactive without destroying it, you should: A) Destroy(gameObject); B) SetActive(false); C) HideFlags = HideFlags.HideInHierarchy; D) Disable(); Answer: B Explanation: SetActive(false) disables the GameObject while keeping it in the scene hierarchy. Question 18. Which Input method retrieves the horizontal axis value defined in the Input Manager? A) Input.GetKey(KeyCode.Horizontal); B) Input.GetAxis("Horizontal"); C) Input.GetButton("Horizontal"); D) Input.GetMouseButton(0); Answer: B Explanation: GetAxis returns a float representing the value of the named axis (e.g.,
B) CreateInstance(prefab); C) new GameObject(prefab); D) Load(prefab); Answer: A Explanation: Instantiate clones the prefab and returns a reference to the new GameObject. Question 22. When you apply changes to a Prefab instance in the scene, how do you propagate those changes back to the original Prefab? A) Apply button in the Inspector B) Save menu option C) Revert button D) Drag the instance onto the Prefab asset Answer: A Explanation: The Apply button writes the modified instance data back to the Prefab asset. Question 23. Which import setting should you adjust to reduce memory usage for a texture used as a UI sprite? A) Max Size B) Compression (e.g., ASTC) C) Generate Mip Maps
D) Both A and B Answer: D Explanation: Reducing Max Size and using appropriate compression lowers texture memory consumption. Question 24. How can you load an asset at runtime from the Resources folder? A) Resources.Load("AssetName"); B) AssetBundle.LoadAsset("AssetName"); C) Resources.FindObjectOfType<Asset>(); D) AssetDatabase.LoadAssetAtPath("AssetName"); Answer: A Explanation: Resources.Load retrieves assets placed in a Resources folder using a path relative to that folder. Question 25. Which class is used to load scenes asynchronously? A) SceneManager.LoadScene B) SceneManager.LoadSceneAsync C) Application.LoadLevelAsync D) Scene.LoadAsync Answer: B
Question 28. What exception is thrown when you try to access a component that is null? A) InvalidOperationException B) NullReferenceException C) ArgumentNullException D) MissingComponentException Answer: B Explanation: Accessing members of a null reference triggers a NullReferenceException. Question 29. Which profiling tool provides a visual representation of CPU usage per frame? A) Unity Profiler B) Visual Studio Debugger C) MonoDevelop Profiler D) Windows Task Manager Answer: A Explanation: The Unity Profiler shows detailed CPU, GPU, memory, and rendering statistics per frame. Question 30. To avoid performance issues, which practice is recommended inside Update()?
A) Call GetComponent every frame B) Instantiate new objects each frame C) Cache component references in Awake() D) Use Debug.Log each frame Answer: C Explanation: Caching references prevents costly lookups and allocations during Update. Question 31. What is object pooling used for? A) Managing memory for textures B) Reusing a set of objects to avoid frequent Instantiate/Destroy C) Organizing scripts in the project hierarchy D) Encrypting saved game data Answer: B Explanation: Object pools keep inactive objects ready for reuse, reducing runtime allocation overhead. Question 32. Which UI component displays a numeric value that can be changed by the player? A) Text B) Image
Explanation: anchoredPosition defines the offset from the anchor points. Question 35. To change a material’s color at runtime, which code is correct? A) renderer.material.color = Color.red; B) renderer.sharedMaterial.color = Color.red; C) renderer.GetComponent<Material>().color = Color.red; D) renderer.SetColor(Color.red); Answer: A Explanation: renderer.material returns the instance material, allowing per‑object color changes. Question 36. What is the relationship between Mesh, Material, and Shader? A) Mesh stores geometry, Material holds texture data, Shader defines how material is rendered. B) Mesh defines lighting, Material defines vertices, Shader stores UVs. C) Mesh, Material, and Shader are interchangeable. D) Mesh contains shader code. Answer: A Explanation: Mesh = vertices/faces, Material = textures/properties, Shader = GPU program that uses those properties.
Question 37. Which Animator parameter type triggers a transition without needing a boolean? A) Float B) Int C) Trigger D) Bool Answer: C Explanation: Triggers are set once and automatically reset after the transition, ideal for one‑off events. Question 38. How do you set a trigger parameter named “Jump” on an Animator component? A) animator.SetBool("Jump", true); B) animator.SetTrigger("Jump"); C) animator.Play("Jump"); D) animator.SetInt("Jump", 1); Answer: B Explanation: SetTrigger activates the trigger parameter, causing any transitions that listen for it. Question 39. Which component is required for a GameObject to be affected by Unity’s physics engine?
C) OnCollisionStay D) OnTriggerStay Answer: B Explanation: Trigger interactions invoke OnTriggerEnter (and related) callbacks, not collision callbacks. Question 42. How can you prevent two specific layers from colliding with each other? A) Use Physics.IgnoreCollision on each pair of colliders. B) Modify the Layer Collision Matrix in Project Settings → Physics. C) Set the colliders to be triggers. D) Change the tag of the GameObjects. Answer: B Explanation: The Layer Collision Matrix lets you enable or disable collisions between layers globally. Question 43. Which method adds a constant force to a Rigidbody each physics step? A) rigidbody.AddForce(force, ForceMode.Force); B) rigidbody.AddForce(force, ForceMode.Impulse); C) rigidbody.velocity = force; D) rigidbody.MovePosition(force);
Answer: A Explanation: ForceMode.Force applies a continuous force over time, suitable for per‑step additions. Question 44. To move a character without using physics, which component is most appropriate? A) Rigidbody B) CharacterController C) NavMeshAgent D) Transform Answer: B Explanation: CharacterController provides built‑in collision handling for kinematic movement without physics forces. Question 45. Which class is used to store simple key/value pairs between game sessions? A) PlayerPrefs B) JsonUtility C) BinaryFormatter D) ScriptableObject Answer: A