Types and Classes Flashcards

1
Q

What are the two kinds of types in programming?

A
Built in
User defined (for object oriented programming)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a class?

A

Defines a type and allows the creation of new types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an object?

A

An instance of a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the construct to instantiate (create) an object?

A
Type ObjectIdentifier = new Type();
i.e Employee John = new Employee();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a method?

A

A method takes in parameters and does something with those values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a public vs private class or method?

A

Public is accessible by anywhere in the code

Private is only accessible by within the same class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 3 attributes of classes?

A

Fields
Properties
Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are properties of a class?

A

Inherently public; used to store values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are fields of a class?

A

Inherently private, only can be accessed by methods of the class; used to store values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is camelCase vs PascalCase?

A

camelCase uses lowercase first letter

PascalCase uses uppercase first letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What syntax uses camelCase?

A

Fields, Variables, Parameters (myValue)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What syntax uses PascalCase?

A

Class, Constants, Properties (MyValue)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is polymorphism?

A

Derived class overrides the inherited behaviour of the base class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is polymorshpism implemented?

A

Create virtual method in parent(base) class and modify it in the derived class by specifying override

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is encapsulation?

A

Allows classes to hide their implementation through using access modifiers to deny access to members of a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an overloaded constructor?

A

A procedure that is automatically invoked with the instantiation of an object, overloaded means it accepts parameters

17
Q

What is a default constructor?

A

A procedure that is automatically invoked with the instantiation of an object, default has no parameters and can’t change

18
Q

What is the single inheritance model?

A
A class can inherit from one base class
Standard supported in .NET Framework
19
Q

What access does public access modifier give?

A

Type or member can be accessed by any other code in assembly and othe rassemblies

20
Q

What access does private access modifier give?

A

Type or member can only be accessed by code in the same class or struct

21
Q

What access does protected access modifier give?

A

Type or member can only be accessed by code in the same class or in a derived class

22
Q

What access does internal access modifier give?

A

Type or member can be accessed by any code in the same assembly, not from another

23
Q

What access does protected internal access modifier give?

A

Type or member can be accessed by any code in the same assembly or derived class in another assembly

24
Q

What is the difference between a constructor and a method?

A

Constructor is run implicitly once with new object, Method is explicitly called

Constructor has same name as class