Arrays in C# Quiz – 15 Questions with Answers
15 questions · 12 min · Medium
Test your knowledge of classes and objects in C#, including class definitions, object creation, fields, methods, constructors, properties, and access modifiers.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
15 questions · 12 min · Medium
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
A. A blueprint for creating objects
A class defines the data and behavior that objects created from it can have.
A. An instance of a class
An object is an instance of a class and can contain its own state and access the behavior defined by the class.
A. class
The class keyword is used to declare a class in C#.
A. new
The new keyword creates an instance of a class and invokes an appropriate constructor.
A. Car car = new Car();
This syntax declares a Car reference named car and creates a new Car object.
A. Method
Methods define operations or behavior that objects of a class can perform.
A. A special member used to initialize an object
A constructor is invoked when an object is created and is commonly used to initialize its state.
A. It must have the same name as the class
A constructor has the same name as its containing class and does not have a return type.
A. public
A public member is accessible from code that can access the containing type, subject to other language rules.
A. private
Class members are private by default when no access modifier is explicitly specified.
A. Properties
Properties provide a controlled way to get or set values associated with an object.
A. public string Name { get; set; }
An auto-implemented property can use get and set accessors without explicitly declaring a backing field.
A. The current object instance
Inside an instance member, this refers to the current instance of the class.
A. It cannot be instantiated directly
A static class cannot be instantiated and can contain only static members.
A. A class defines a type, while an object is an instance of that type
A class defines the structure and behavior of a type, while objects are instances created from that type.