Programming for Games I - Quizzes 10-18 Combined for Final Exam Review
C# Programming Concepts Quiz
Test your knowledge of C# programming concepts with this comprehensive quiz designed for gaming and software development enthusiasts. Covering a wide range of topics, this quiz is ideal for anyone looking to solidify their understanding of classes, structs, and object-oriented programming principles.
Key Features:
- 107 detailed questions
- Multiple choice format for easy answering
- Instant feedback on your responses
When we need to call a method or to access a field on an object, we use ________ operator.
& operator
Dot (.) operator
Constructor
New operator
When we create a variable of a class type, we use _______ operator.
New
*
&
. operator
We cannot declare a class within another class in C# because this is against the rule of Object-Oriented Programming.
True
False
If no value assigned to a class field, then they will be default numeric values to zero, null for string and false for bool.
True
False
When declaring a class in C#, there is no semicolon (;) to terminate class block.
True
False
Statements inside a class does not need to be terminated with a semicolon (;).
True
False
If we declare a class as a public class, it means that any other class in the project can use it to create objects.
True
False
Class constructors are special methods that fire automatically when a class instance is created.
True
False
If a constructor is not specified, C# generates a default one.
True
False
The default constructor sets any variables to their default type values—numeric values are set to zero, Booleans to false, and reference types (classes) to null.
True
False
Custom constructors can be defined with parameters, just like any other method, and are used to set class variable values at initialization.
True
False
A class can have multiple constructors.
True
False
Constructors does not need to be public.
True
False
Constructors can have return type.
True
False
Constructor name is always the class name.
True
False
Constructor overloading is when we create several constructors for a class.
True
False
For convenience, constructors will often have parameters that share a name with a class variable. In these cases, we use the this keyword to specify which variable belongs to the class. Class’s variable use this, and it makes it distinct from the constructor’s parameter; without the this keyword, the compiler will throw a warning because it won't be able to tell them apart.
True
False
Which of the following is return type of constructor:
Float
Int
No return type
String
Structs are similar to classes in that they are also blueprints for objects you.
True
False
The main difference between classes and structs is that structs are value types; meaning they are passed by value, but classes are reference type.
True
False
Structs are declared in the same way as classes, and can hold fields, methods, and constructors.
True
False
Like classes, any variables and methods belong exclusively to the struct and are accessed by its unique name.
True
False
In structs, variables cannot be initialized with values inside the struct declaration unless they're marked with the static or const modifier.
True
False
In structs, constructors without parameters aren't permitted.
True
False
Structs come with a default constructor that will automatically set all variables to their default values according to their type.
True
False
In c#, you can have classes and structs nested within each other, but this is generally frowned upon because it clutters up the code.
True
False
Classes are best suited for grouping together complex actions and data that will change throughout a program. While, structs are a better choice for simple objects and data that will remain constant for the most part.
True
False
Classes are value types, meaning that they are passed by value; structs are reference types, meaning that they are passed by reference.
True
False
If we have multiple variables storing the same memory reference, a change to one affects them all.
True
False
When a struct object is created, all of its data is stored in its corresponding variable with no references or connections to its memory location. This makes structs useful for creating objects that need to be copied quickly and efficiently, while still retaining their separate identities.
True
False
Structs are easily copied and modified as their separate objects, unlike classes that retain references to an original object.
True
False
OOP focuses on objects rather than pure sequential logic; the data they hold, how they drive action, and, most importantly, how they communicate with each other.
True
False
Inheritance is a powerful way of creating related classes without having to repeat code.
True
False
A child class have member variables and methods from parent class, but able to define its unique data too.
True
False
Child class is the same as derived class.
True
False
Parent class is the same as base class.
True
False
In inheritance, class constructors always belong to their containing class, and they cannot be used from derived classes.
True
False
Any base class members marked with the public, protected, or internal access modifiers are automatically part of the derived class.
True
False
Any base class members marked with the public, protected, or internal access modifiers are automatically part of the derived class; except for constructors.
True
False
It's generally considered best practice to create a new script for different classes instead of adding them to existing ones. This separates your scripts and avoids having too many lines of code in any single file (called a bloated file).
True
False
Which option is correct about the following code?
Character class inherits from Paladin class.
Paladin class inherits from Character class.
Both Paladin class and Character class inherit from MonoBehaviour Class.
Encapsulation defines how accessible an object's variables and methods are to outside code.
True
False
In inheritance, the parent class isn't aware of any of its children, but all children are aware of their parent.
True
False
In inheritance, parent class constructors can be called directly from child constructors with a simple syntax modification.
True
False
In polymorphism, parent classes can mark methods as virtual, meaning that their instructions can be modified by derived classes using the override keyword.
True
False
Polymorphism allows derived classes to keep the structure of their parent class while also having the freedom to tailor actions to fit their specific needs.
True
False
OOP is all about grouping related data and actions into objects—objects that can communicate and act independently from each other.
True
False
Access to class members can be set using access modifiers, just like variables.
True
False
Classes can inherit from other classes, creating trickle-down hierarchies of parent/child relationships.
True
False
Composition means classes can have members of other class or struct types.
True
False
Classes can override any parent methods marked as virtual, allowing them to perform custom actions while retaining the same blueprint.
True
False
Constructor handles the initialization logic inside a class.
True
False
The output of the program is:
Constructors cannot be initialized twice with different parameters.
The name is Ali
The name is Ahmed
Error
The output of the program is:
The name is Ali
Constructor is inaccessible due to its protection level.
Constructors can not be initialized twice with different parameters
The name is Ahmed
Access modifiers like private, protected, public or internal restrict the access of class, methods, properties or fields in C#. Access modifiers supports the OOP Principle called ____________.
Inheritance
Abstraction
Encapsulation
Polymorphism
In polymorphism, base class method, which we override in child class should be declared _______ in base class.
Private
Override
Virtual
In _______________, we use the same method name to indicate different implementations.
Abstraction
Encapsulation
Inheritance
Polymorphism
In above class header, class A is ________ class and B is ________ class. (Select all correct answers.)
Child, parent
Parent, child
Sub, super
Derived, base
In __________, we first create general class then define specialized classes that have access to the members of the general class.
Inheritance
Abstraction
Encapsulation
Polymorphism
__________ is a concept of bundling of data related methods, properties and variables in one class.
Abstraction
Encapsulation
Polymorphism
Inheritance
If constructors are not initialized then C# generates __________
Default values in terms of their type
Provide reference of a method
Private method
A default constructor
GameObjects in Unity can represent your classes and structs.
True
False
All objects in Unity are not necessarily in physical scene.
True
False
Concept in game design means the big-picture idea and design of the game, including its genre and play style.
True
False
The playable features or interactions that a character can take in game, called core mechanics.
True
False
A map of the buttons and/or keys that give players control over their character, environment interactions, and other executable actions, called control scheme.
True
False
The look and feel of the game called:
Control scheme
Story
Core mechanics
Art style
Technical Design Document (TDD):
Houses everything from how the game is played to its atmosphere, story, and the experience it is trying to create.
Focuses on all the technical aspects of the game, from the hardware it will run on to how the classes and program architecture need to be built out.
Used for marketing or promotional situations.
TDD and GDD length will vary based on the project; can be a few pages long or several hundred.
True
False
One-page used for marketing or promotional situations, a one-page is essentially a snapshot of your game.
True
False
Base object shapes provided in Unity called:
Primitives
TDD
Materials
Prefabs
Local space uses the objects parent transform as its origin, essentially changing the perspective of the scene to revolve around it.
True
False
World space uses a set origin point in the scene as a constant reference for all GameObjects. In Unity, this origin point is (0, 0, 0).
True
False
Everything is an object in Unity.
True
False
White-boxing is a design term for laying out ideas using placeholders, usually with the intent of replacing them with finished assets at a later date.
True
False
Prefabs can be saved and reused with every child object, component, C# script, and property setting intact
True
False
What are the two categories of lighting in Unity? (Check all that apply)
Lightmap
Real-time lighting
Pre-computed lighting
Precomputed Realtime Global Illumination
Real-time lighting is computed every frame, meaning that any object that passes in its path will cast realistic shadows and generally behave like a real-world light source
True
False
Pre-computed lighting stores the scene's lighting in a texture called a lightmap, which is then applied, or baked, into the scene.
True
False
Pre-computed lighting can significantly slow down our game and cost an exponential amount of computing power, depending on the number of lights in our scene.
True
False
Real-time lighting is static. This means that it doesn't react realistically or change when objects move in the scene.
True
False
Real-time lighting is computationally expensive, while pre-computed lighting saves computing power.
True
False
In addition to real-time lighting and pre-computed lighting, there is also an advanced mixed type of lighting called Precomputed Realtime Global Illumination, which bridges the gap between the real-time and precomputed processes.
True
False
By default, every scene comes with a Directional Light component to act as a main source of illumination.
True
False
Lights can be created in the hierarchy like any other GameObject.
True
False
Lights are objects in Unity, which means they can be positioned, scaled, and rotated to fit our needs.
True
False
Directional lights are great for simulating natural light, such as sunshine. They don't have an actual position in the scene, but their light hits everything as if it's always pointed in the same direction.
True
False
Point lights are essentially floating globes, sending light rays out from a central point in all directions. These have defined positions and intensities in the scene.
True
False
Spotlights send light out in a given direction, but they are locked in by their angle; similar to spotlights or floodlights in the real world.
True
False
Like all GameObjects in Unity, lights have properties that can be adjusted to give a scene a specific ambiance or theme.
True
False
Some of the light properties include: Color: the light's tint Mode: real-time or computed effects Intensity: the general strength
True
False
What data type would you use to store 3D movement and rotation information?
Vector2
Vector3
What built-in Unity component allows you to track and modify player controls?
InputManager
Inspector
Which component adds real-world physics to a GameObject ?
A Rigidbody component
A Collider component
What method does Unity suggest using to execute physics-related code on GameObjects?
LateUpdate()
FixedUpdate()
Update()
Rigidbody components and Collider components; these two components are responsible for all physical interactions and simulated movement in Unity.
True
False
While there should only be one Rigidbody component attached to a given GameObject, there can be several Collider components.
True
False
A namespace collects and groups a set of classes under a specific name to organize large projects and avoid conflicts between scripts that may share the same names.
True
False
A using directive needs to be added to a class to access a namespace's classes.
True
False
What type of data do enumerations store?
A constant variable that can be instantiated several times
One variable which is constant
A set or collection of named constants that belong to the same variable
How would you create a copy of a Prefab GameObject in an active scene?
Using the Instantiate() method with an existing Prefab
Using new keyword to create a new Prefab
Which variable properties allow you to add functionality when their value is referenced or modified?
The get and set accessors
Access modifiers set to public and private
Which Unity method displays all UI objects in the scene?
OnCollisionEnter()
Update()
Start()
OnGUI()
What data type would you use to store 3D movement and rotation information?
Translate and Rotation methods
2D Input
Position and Rotation
Vector3
What built-in Unity component allows you to track and modify player controls?
GameManager
InputManager
Inspector
Which component adds real-world physics to a GameObject?
Transform component
A Rigidbody component
What method does Unity suggest using to execute physics-related code on GameObjects?
Update()
LateUpdate()
FixedUpdate()
{"name":"Programming for Games I - Quizzes 10-18 Combined for Final Exam Review", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of C# programming concepts with this comprehensive quiz designed for gaming and software development enthusiasts. Covering a wide range of topics, this quiz is ideal for anyone looking to solidify their understanding of classes, structs, and object-oriented programming principles.Key Features:107 detailed questionsMultiple choice format for easy answeringInstant feedback on your responses","img":"https:/images/course4.png"}
More Quizzes
[S2-SUMMATIVE] Summative Assessment 2 - STRUCTURES REVIEWER
371823
Quiz
11624
INTRODUCTION TO OOP AND UML QUIZ
201049
STUCTURED PROGRAMMING CAT
9425
Java
1059
OOPS Introduction
3224
C - Program Quiz | HOWZIT AI Messenger | Indian Aibot App
HOWZIT will present prizes to the winners
740
Test your C# skills
1058
Object Oriented Programming
7425
CS1412 Final
482439
C programming control and looping statements
10516
Principles of Programming
25120