C# Fundamentals

2021-8-16 Less than 1 minute

# C# Fundamentals

1. What is the purpose of a namespace?

namespace tells the system where to direct things.
1

2. What is the difference between a class and a struct?

structs are value types. classes are not.
1

3. What is the method that returns an instance of a class, yet it has no return type?

Void
1

# Example 1

abstract class Car
{
  ...
  public virtual string Start()
  {
    return "Vroooom";
  }
}
1
2
3
4
5
6
7
8

5. In the example what is the access modifier of the Start() method?

public
1

6. In the example what is string an indication of?

Start()
1

7. In the example what is abstract preventing?

prevents Car from initiating
1

8. In the example what is the purpose of virtual?

overrides abstract
1

9. Name four access modifiers:

private, internal, public, protected
1

10. If you set a class or method to private, what can access it?

only the classes or methods that have access to it within the method or class.
1
Last update: October 25, 2021 00:27
Contributors: Derek Shain