unity and c# basics coursera week 3 quiz answers

C# basics quiz

1. True or false: C# is similar to Java and JavaScript.

  • True
  • False

2. What are the benefits of using coding conventions? Select all that apply.

  • Coding conventions facilitate copying, changing and maintaining the code.
  • Coding conventions enable readers to understand the code more quickly.
  • Coding conventions create a consistent look to the code.
  • Coding conventions take away the manual input of codes and notations.

3. Which naming convention would you use to name a class, record or struct? Select the best answer.

  • Camel case
  • Pascal case

4. Which naming convention would you use for private or internal fields? Select the best answer.

  • Camel case
  • Pascal case

5. Which types of naming conventions have you used? How did you find them useful?

Pascal case, Camel case, snake_case, and kebab-case. These naming conventions help improve code readability, maintainability, and consistency.

C# programming concepts quiz

6. How can scripts be attached to objects? Select all that apply.

  • Select Component from the top navigation, and then select Scripts.
  • Drag and drop.
  • Select GameObject from the top navigation.
  • Select the Add Component button.

7. Which statement or function would you use in a script to make a decision based on a condition? Select the best answer.

  • IF statement
  • SetActive function
  • LookAt
  • WhileLoop

8. Which function is used to remove GameObjects?

Destroy

9. Which function can detect a click on a Collider or a GUI text element? Select the best answer.

OnMouseDown

10. True or false: The scope of a variable is the area in code in which the variable can be used.

  • True
  • False

Working in C# quiz

11. Which languages is C# similar to? Select the best answer.

C, C++, Java, JavaScript

12. When naming a class, record or struct, which naming convention should be used?

  • Pascal case
  • Snake case
  • All caps
  • Camel case

13. What are the benefits of using coding conventions? Select all that apply.

  • Coding conventions enable readers to understand the code more quickly by making assumptions based on previous experience.
  • Coding conventions provide boilerplate code so developers don’t have to create their own code.
  • Coding conventions facilitate copying, changing and maintaining the code.
  • Coding conventions create a consistent look to the code, so that readers can focus on content, not layout.

14. Which naming convention would you use when naming private or internal fields? Select the best answer.

  • Pascal case
  • Kebab case
  • Snake case
  • Camel case

15. What can be used to manage things that need to happen after a delay or over the course of time?

Coroutines

16. What are some of the useful features in the Unity Manual that you could use? Select all that apply.

  • Sample game design documents that you can use as templates
  • An index that allows you to search by topic
  • A button to switch between a specific topic in Unity Manual and Scripting API library
  • Ability to copy code samples

17. In which window can you attach a script to a GameObject?

  • Game
  • Hierarchy
  • Inspector
  • Scene

18. True or false? The component name, the class and the filename of the script should all have the same name. Select the best answer.

  • True
  • False

19. How do you enable or disable a component in Unity? Select the best answer.

  • Use the Escape button.
  • Use the enabled flag.
  • Use the Remove flag.
  • Use the Destroy function.

20. True or false? OnMouseDown detects a click on a Collider or a GUI text element. Select the best answer.

  • False
  • True

Leave a Reply