C# Flashcards

1
Q

What is using?

A

List of directives, specifies namespaces in which the classes/interfaces are located that the code is using, allows one namespace to use another namespace

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

What are partial classes?

A

Allows for one class to be spread across several definitions (often in separate files) which increases readability of the code. All parts must use partial keyword and be in the same namespace, each can inherit from different type and all inherit from it.

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

What are sealed classes?

A

Sealed classes cannot be inherited from, so can’t be extended but they can inherit from other classes. Static classes can’t inherit and can’t be inherited from.

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

What is abstract class?

A

Abstract class is similar to an interface, it provides a blueprint for inheriting classes - defines fields and methods and can implement them but doesn’t have to.. All methods are abstract. The class can’t be instantiated and can only be derived from.

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

What is string builder and what is different to string?

A

String builder is a class that helps with string modification. Strings can’t be modified, each time we add something or transform a string a new string is created, while string builder allows for string modification through modification of each character.

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

Different between as and is?

A

As is used for casting an object type to another, is is used to check the underlying type of an object.

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

Heap and Stack

A

Reference values are stored on heap, values on stack. Stack also stores local variables and method calls. Heap is dynamic but slower.

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

Can C# classes inherit from multiple classes?

A

No, they can inherit from one class but multiple interfaces.

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

Const and readonly

A

Const has to be assigned to and has the same value during lifetime of the application. Readonly can change value at runtime - doesn’t need to be assigned.

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

What is everything in C#?

A

Everything is a class.

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

What is delegation?

A

Evaluating one object in the context of another.

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

What is open recursion?

A

Allowed by delegation -> we can use open recursion by using this keyword to access the inheriting chain.

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

What is abstraction?

A

By using abstract classes or interfaces, we should express the intent of an class without providing implementation. One class shouldn’t know the implementation of another - we can give it a blueprint and tell it what to call without it having to know what exactly happens. Extension of encapsulation in order to maintain code - if too many classes know about each other’s behaviours, it will become impossible to change or maintain code.

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

What is encapsulation?

A

Hiding specific implementation by restricting access to it. Objects hide their internal state only expose themselves to others by methods through which they can communicate, for example by using an interface.

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

What is inheritance?

A

Objects can have things in common .e.g. share logic, instead of copying code, we can reuse the code by making classes inherit from other classes. Types: single (one base class), hierarchical (one base class, multiple derived classes), multilevel (derived class of derived class), multiple (several base classes, several derived classes).

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

What is destructor?

A

Method that destructs an object after it is done being used. Opposite of constructor. It gets called by garbage collector when object is destroyed - frees up resources and memory.

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

Advantage of using getters & setters

A

Encapsulation. Internal state is not exposed as if we used a public property. We have control over who has access to what within an object. Allow for extra validation, allows inheritors to override setters and getters.

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

What are inline functions?

A

Technique used by compilers that instructs to insert complete body function wherever the function is called in the source code.

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

What is virtual function?

A

Function that can be overridden by a derived class.

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

What is friend function?

A

Friend of a class that can access field that are private or protected. Must be declared within the class.

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

What is method overloading?

A

A function that can complete different tasks depending on the parameters we pass in. The signature must be exactly the same except for the parameters. The implementation can be the same/similar except we use the same params to get to the result.

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

What is method overriding?

A

Using inheritance, we can override the behaviour of a method in the parent class The signature must be identical but the implementation can be different.

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

Difference between overriding and overloading methods

A

Overriding uses inheritance to allow child classes to have different implementations. Overloading is defining several methods whose implementation differs based on the parameters we send.

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

What is operator overloading?

A

Providing special meaning/implementation to operators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is virtual pure function?
It is a virtual method that must be overridden in the child class - doesn't have any implementation in the parent class -> abstract class and an abstract method.
26
What is the finalize function?
Called by garbage collector to used to cleanup unmanaged resources before the object is destroyed.
27
What are two types of arguments?
Passed by value and passed by reference. Reference type arguments are mutable. Value type arguments are destroyed when the method is done executing.
28
DATA STRUCTURE: What is heap?
Complete binary tree. Either minimum or maximum tree, root will be smallest or largest node in the tree.
29
Which data structures use pointers?
Linked lists, stack, queu, binary trees.
30
Full vs complete binary tree
Full - each node other than leaves have two children. | Complete - every level except the last one is completely filled - all nodes are left as possible.
31
What is infix?
It's an operator position - between elements - A*(B+C).)
32
What is prefix?
It's an operator position - before operator - /*A+B.
33
What is postfix?
It's an operator position - follows after each operator - ABC+*D/.
34
How to implement LRU cache?
Last recently used. The least recent should be removed first -> browser keeps track about last visited pages in a queue, double-linked list, hash.
35
Call stack
Stack saves the information about the last function called and pushes it to the bottom, once it's done performing, the highest possible function it goes through the function stack.
36
Void vs NULL
Technically, null is a value since it points to a location in memory. Void does not point at anything - data type identifier that means nothing.
37
Most common searching algorithms
Binary search, linear search.
38
What are most common sorting algorithms?
Selection sort, bubble sort, merge sort, radix sort, heap sort, quick sort.
39
What are fibonacci numbers?
It is a series of numbers starting with 0 ad 1 with the following number being a addition of the two previous numbers. 0 1 1 2 3 5
40
What is linear search?
Search in sequence, each element is searched and compared against the searched key.
41
How does binary search in binary tree?
If tree is empty - the search ends. If the tree not empty, check if root element is it, if not check left of root, then check left of that node, then left until there is none, then go right.
42
What is merge sort?
Divide and conquer. Divides an array in half and first sorts each half by more halving until we have just two elements. Adjacent elements of sequence sorted first and merged. O(nlogn)
43
What is bubble sort?
Compares adjacent elements and exchanges their values, if they are out of order - largest items sink to the bottom of the list. The smallest value bubbles up to the start. O(n^2)
44
What is quick sort?
Pick random element and partition array such that all numbers are less than the element that comes before all elements that are greater than it. Forms subarrays to do it. It's not great since the random element can be in bad position.
45
What is selection sort?
Smallest number is first located and switched with the element at 0 index. Then the second smallest position is put at the second position but that can mean it goes through each element at lesat once. O(n^2)
46
What is radix sort?
Sorts ints, first looks at first digits, the same ones are grouped together, that continues until all sorted
47
JIT vs AOT
JIT - compiles IL to machine code, AOT - ahead of time delivers fast startup in large apps but needs more disk space and memory
48
Methods vs functions
Methods are functions belonging to a class - can operate on the data of the object. Functions need all arguments passed in.
49
What are mixins?
Contains methods used by other classes without it being parent class of the other classes, it's more included than inherited from.
50
What is a monad?
Abstracting boilerplate code by passing in their own data type e.g. generics -> List where T is monad
51
What is roslyn?
Compiles C# into Intermediary language.
52
What is RUYJIT?
Compiles IL into machine ode.
53
Do you modify access to interface?
No, can include public identifier but it's public by default.
54
Stack vs Heap Memory
Stack stores value types, function arguments, keeps stack call of methods. Heap - where reference types are stored, keeps track of objects.
55
What is .Net web service?
Reusable piece of code that allows for publishing things over the internet and interacting with other resources over HTTP, XML, SOAP. ASP.Net provides simple way of implementing them.
56
Why should we prefer MVC over Web Forms?
Web forms are outdated and not well maintained plus MVC allows for separation of concerns.
57
What is Json in relation to .Net?
JavaScript object notation. A way to depict data through api calls, easy to read and organise data. Libraries to parse json strings for storage etc.
58
What is Laravel?
PHP version of .NET, open source framework based on MVC.
59
.Net vs .Net Core
.Net Core is the open source, cross-platform, NUGGET based subset of .Net. They have shared common libraries.
60
What is included in .Net core?
.Net runtime, type system, assembly loading, garbage collector, set of framework libraries, SDK tools & language compiler, dotnet app host.
61
Does .NET Core have the same libraries?
It shares some base libraries with .Net, except they are shipped as smaller libraries via nugget.
62
What is Core CLR?
Common language runtime execution engine that takes care of compilation and garbage collection.
63
What is Mono and how does it differ to Core?
Mono is a 3rd party library, implementation of .Net Core for other platforms before Microsoft created Core.
64
Characteristics of Core
Cross-platform, open source, can be shipped over nugget, flexible deployment, command line tools, compatible with .Net, developed by Microsoft.
65
What is CTS?
Common type system. System for data types shared by most Microsoft languages/frameworks, to ensure smooth communicate between all .Net languages. All types inherit from System.Object
66
How to sort array?
Sort(), Reverse()
67
What is circular reference?
Trying to reference a project from a project that is referenced by that project. Resources are dependent on each other and create lock condition and the resources can't be used.
68
What are generics?
Placeholders for type of fields, methods, parameters, gets specific type at compile time. Why - reusable code, type safe.
69
What is object pool?
The pool of objects currently being used in code, reduces overhead of creating and recreating objects.
70
What are delegates?
Instead of using a specific method, we can pass in a blueprint of the method (the signature) without having to define or name the method yet.
71
What is constructor chaining?
Calling constructor from another constructor - e.g. child constructor calling parent.
72
What is enum?
Value type. Predefined list of possible values = named constants.
73
What are nullable types?
Value types can't normally be null unless we add the null operator which allows it to be nullable.
74
What is null coalescing operator?
If first operand is null, the second one will be assigned. var i = null ?? this;
75
What is static constructor?
Static constructor gets called to initialize static data before the first instance is created.
76
What are attributes?
Reusable code blocks that assign some sort of behaviour to class which is evaluated at runtime, method, property etc. [Route], [DataContract],[HttpGet]
77
What is a thread?
It's a flow of control - set of instructions to be executed, tasks are executed in the thread - by default, C# only has one but more can be created - multi-threading -> could cause deadlock or circular reference.
78
How to hide method of pareint in child?
By using the new keyword and implementing the parent method with new implementation but same signature.
79
Abstract vs virtual
Abstract classes cannot be implemented by parent, must be implemented by child classes, in abstract classes, virtual by default. Virtual methods must have implementation in parent, don't have to be implemented in child.
80
What is System.IO?
Library namespace that contains functionality for reading, writing to the file system - StreamWriter, StreamReader.
81
What are regular expressions?
Patterns that we can use to abstract what we expect e.g. a string to look like - template to match a set of input.
82
Async vs Sync
Program can be executed async or sync. Sync execution follows chronologically line by line and waits for all code to complete before it returns (only one thread can access resource), while async returns immediately so that program can perform other operations while the code executes.
83
Do we have to declare private fields?
No, they are private by default, unless we defined getters and setters?
84
What is serialization?
Process of converting data to the expected data format. Most common: JSON, XML, binary.
85
What is reflection?
Able to access metadata of objects - e.g. assembly information during runtime and informs user or modifiers behaviour.
86
What is IEnumerable?
Interface for collections that contains GetAwaiter() which allows to iterate through the collection. Base class for collections, IQueryable implements it too.
87
IEnumerable vs IQueryable?
IQ derives from IE. IE keeps in memory the object while it is filtered. IQ filters through the collection without saving it in memory. IE is better for LINQ to objects, while IQ is better LINQ to anything else.
88
What are static classes?
Classes that can't be instantiated, can't be inherited from. If class static, all members are static. Static members are on heap. It's members can be accessed anywhere. All members also static, no this since there is no instance.
89
Exception handling in C#
try, catch, finally - only one catch per exception type.
90
What is finally?
It is a statement after the try and catch code block. It is always executed. It's great to use for closing db connections or getting rid of resources.
91
When to use params keyword?
When I don't now how many parameters will be passed in. Must be last in the list and only one per method. Must be a single-dimensional array.
92
What are two types of errors?
Compilation (syntax), runtime errors (exception thrown due to bad data etc. - stack overflow exception or null reference).
93
What is var?
Implicitly typed variable used to define a new variable without specifying the type - the variable must be however initialized which sets the type. Only for local variables.
94
What is value type?
Data structure that is directly stored in memory - the variable directly contains the value in memory, instead of pointing to chunk of memory. Stored on the heap. When value passed as argument, a copy is passed in and the original variable is not changed.
95
Name value types in C#
Struct, int, double, decimal, long, char, , float, bool, byte, enum etc.
96
What is reference type?
Variable that is stored on the heap, usually, contains the address in memory of the value rather than the value itself. Passing by reference - passes in the memory location and mutates the object.
97
What is anonymous type?
Type that doesn't have a name - it is subset of reference type and all its properties are read-only. Defined with new keyword.
98
What is casting?
Explicitly converting one type as another type if it's possible.
99
What is bad OOP design?
Duplicate code, implementation that is not abstracted, rigidity - hard to change if code is unpredictable, fragility - breaks every change, importability 0 module works only in specific situation, can't be reused.
100
What is the different between array, array list, jagged array?
Array is one-dimensional & fixed length, jagged array is multi-dimensional - array of arrays, array list - no fixed length, stores different data types.
101
What is polymorphism>
One name, many forms. Related to inheritance. Parent implements a method while children implement their own version of that method. Static - overloading, dynamic - overridding.
102
What are namespaces?
Containers for classes. Include classes, interfaces, enums etc. Organize large chunks of data of code. E.g. System
103
Finalize vs Dispose
Dispose from IDisposable - can be called to remove object from memory, Finalize used to clean up resources when objects are no longer used - cannot be called directly.
104
What is boxing and unboxing?
Converting value type to reference type and vice versa. Boxing - to object, Unboxing - to reference.
105
What is garbage collection?
Process that gets rid of unused objects in memory. Automatic memory manager.
106
What is intermediary language?
C# is compiled into it, it is then compiled into machine code. CPU independent, partially compiled C# code.
107
What is common intermediary language?
.Net Intermediary language.
108
Advantages of LINQ
Easier and simpler syntax than SQL, many extension methods, can be used on many data sources - bridges the gap between objects and data.
109
What is global cache?
Machine wide cache. .Net applicatoins share libraries through GC.
110
What is BinaryFormatter?
Formatter for binary serialization.
111
What are the types/contents of assembly?
Manifest, type metadata, IL, resources (images, assets)
112
What does manifest of assembly contain?
Data about the assembly such as assembly version or key, security demands.
113
What is an assembly?
Versioned and deployed unit. Collection of types and resources which together form a unit of function. Can be designed as executable (exe) or reusable (dll). Assembly is compiled output.
114
How to disallow a class to be inherited from?
Seal it.
115
What are extender classes?
Extend functionality of some other class - e.g. static extension methods.
116
What is base class library?
Library that all .Net framework inherit from. Contains base functionality. E.g. System.IO
117
What is ASP.Net?
The .Net framework meant for web development - make developing web applications easier. Has subsets - Web API, MVC, Web Forms
118
What is .Net or .Net Core?
Frameworks for building applications, both developed by Microsoft. One is single platform, the other is cross-platform.
119
What is expression tree?
Data structure that contains expressions represents structured queries -> this then ran over a data set. C# compiles queries into language appropriate for data source.
120
Take(1) vs First() vs FirstOrDefault()
Use first when we never expect the collection to be empty, if it can be empty use FirstOrDefault. Take(1) returns sequence with the specified number of elements.
121
Why is LINQ better than SQL?
LINQ is type safe, debugging of LINQ possible, errors can be discovered during compilation, LINQ compiled into IL, SQL would require another step.
122
What is Data Context?
Class that bridges LINQ and SQL. Allowing access to the db and updating data in db. Does 3 things: creates connection to db, submits and retrieves data converts to SLQ and vice versa.
123
What is association?
Way of linking objects, two objects are instances of unrelated classes, they collaborate to achieve their goals. No clear owner - both parent and child - but they can interact.
124
What is aggregation?
Specialized type of association, way of linking objects. One object belongs to the other object but they're still independent, don't control each other life cycles, there is owner and ownee, ownee can't belong to anyone else.
125
What is composition?
Specialized form of aggregation - one object completely controls the other which doesn't have independent life cycle. Death relationship - if parent dead, child dead.
126
What are 3 ways of linking objects?
Association, aggregation, composition.
127
What is an object?
Instance of a class.
128
Deferred vs Immediate execution
Query is not executed until it is needed, saves performance. Immediate - immediately executes e.g. ToList() or Count()
129
What are query operators?
Operators that take in a sequence and transform it based on conditions specified.
130
What is LINQ?
Can filter and manipulate data more easily than other queries. Allows to write queries over set of data. Can write LINQ query on any collection implementing IE.
131
When are graphs used?
Maps, LAN networks, transportation (finding shortest path)
132
git -d
delete the branch
133
git clone
copy a repo
134
git stash drop
deletes stash
135
git stash pop
apply + drop stash
136
What is staging area in GIT?
Intermediate area before completing commits, can format, review files.
137
git repo
Contains metadata, source code for repo in .git
138
GIT
code versioning program and source code management system
139
git stash apply
apply stash and don't delete it
140
git rm
Removes file from staging area
141
commit message
Adds message to commit
142
C# design patterns
Observer (view updates if model changes), abstract method (extends factory method by introducing an abstract class), factory method, singleton
143
JS design pattern
Modules - encapsulation, clsses. Prototype - JS inheritance. Observer - observe object. Singleton - Angular services.
144
What is singleton?
Only one version of an object exists, client can't create another instance, C# - making constructor private - all methods defined as static, BAD - cause application to be too rigidly coupled
145
What is factory method?
Creating an instance of several derived classes. Centralized creation of objects. Interface or abstract class based. Client shouldn't know implementation.
146
2 most common design patterns
Factory method, singleton
147
What are design patterns?
Documented, tried tested solutions to recurring problems in a given context - way to initialize objects etc.
148
What is scrum?
15 minute daily meetings, group working together, defining goals, 2 weeks - 1 month sprints, define stories
149
Stack vs Array
Array can delete any element based on indices, not just last one.
150
Use of stack
Stack call, recursion, execution context
151
How is stack different to linked list
Can remove any element of linked list, order is important in stack.
152
How can stack be implemented?
Using two queues, linked lists, arrays (array not dynamic so we have to worry about stack overflow)
153
What are hash tables?
Can be implemented using linked lists or array of linked lists. Hash function that maps value to a key (index location). Can't avoid collisions where one value is computed to the same index - need load factor.
154
Wat is binary search tree?
Binary trees that are low values on left side of root and larger values on right of root. Left & right nodes also must be binary search trees. No duplicates. To check if binary tree is BST - traverse, if sorted, it is BST.
155
Types of linked lists
Single, doubly (pointers go both ways - previous and next), circular linked
156
What are linked lists?
Linear, dynamic. Can't access random elements, must traverse through the whole thing. Pointers are stored instead of data. Each element is separate object pointing to the next node.
157
What are graphs?
Set of ordered pairs - edges connect all nodes. Represent objects and relationships - vertices and edges. can be cyclic or not, connected or not. Weighted edges, labelled v or c. Each graph can be represented in adjacent linked list arrays or array lists.
158
Graph traversal techniques
DFS - depth-first search goes deep first through each node. BFS - breadth-first - goes through all nodes of the one level than next level.
159
What is binary tree?
Types of graph, similar to linked lists but each node points to number of nodes - non-linear data structure. Each node only has two children - left and right. Min nodes = 0, max nodes = 2. To insert new item -> check if item in tree already -> is the tree empty (yes, insert as root), if not -> not empty - is node bigger or lower tan root - right, not left.
160
Use of hash tables
db indexing, cache
161
What is data structure?
Way of organizing data to manipulate the data efficiently. Relationship between data matters and is represented by the data structure composition. Some are highly specialized to specific tasks.
162
What is array?
Static size, all elements referenced by index. Stores same data types. Can access al elements randomly using the index. Can delete any element.
163
Data abstraction
Tool to consider complex data in manageable chunk. Mostly focus on data objects involved and what operations will be done on them.
164
Examples of data structures examples
Numerical analysis, operating system, AI, compiler design, database management, graphics, statistical analysis.
165
Linear vs Non-Linear
Linear - elements follow in sequence - linked lists. Non-linear - no sequence - trees, graphs.
166
What are dynamic data structures?
Expand and contract depending on data.
167
What is QUEUE?
First in, first out. Ordered list, dynamic memory. FIFO - enqueue, dequeue. Implemented through linked lists or arrays or 2 stacks. List of computer jobs.
168
Operations of abstract data
Inserting, removing, sorting, searching (looks for specific node, then stops), traversing (goes through each node once)
169
What is ordered list
Sequence of pointers, each node's position determined by the value of its key component. Values form increasing sequence.
170
Multi-dimensional arrays
Multiple indices to store data. Data represents = table with more than one column.
171
Priority queue
Order matters, priority defined by key for each element. Two queues - 1 for storing keys, 1 for storing data.
172
What is stack?
Insertion order important - first in, last out. Dynamic memory. Can store elements of similar data types while arrays can only hold data of one type. Ideal for recursion.
173
How do I call a method of a class without instantiating it?
Making that class or method static.
174
What are token in compiler?
Smallest element of program meaningful to the compiler, something that can't be broke down more - keyword, identifier, constant, operator.
175
What is exception handling?
Event that occurs during execution, unexpected behaviour to be handled through throw, try, catch, finally.
176
Interface vs abstract class
Both are blueprints for inheriting classes, define methods and properties. Interface cannot contain any implementation while abstract class can. All members of interface are public - can't contain private, static members. A class can inherit from multiple interfaces but only one class.
177
What is super keyword used for?
Used to invoke overridden method that overrides one of the superclass methods. Forwards constructor call to the constructor of the base/super class.
178
What are constructor?
Constructor methods initialize objects they belong to - can set state. Default is parameter less constructor. Can be overloaded.
179
What is interface of protocol?
Class that sets out structure but never implementation.
180
What is black box?
Concept for hiding away code. We need to know the inputs and outputs, not the implementation.
181
Object vs class
Class is the blueprint, says what fields, methods it contains. Object is instance of the class with its own state. and behaviour.
182
When to use a struct?
When we want to store primitive, value types. Smaller than 16 bytes, immutable.
183
What is a struct?
It's a value type object. Contains value type data. Can contain data and methods, default access is public. Can't inherit from other classes. Best used for small classes. Stored on stack. Members cannot be null.
184
What is abstract class?
Cannot be instantiated, sets out blueprint for inheriting classes, always base class. At least one abstract member but can have non-abstract members with implementation.
185
What is a class?
Model, blueprint, template without a state or actual data. Describes features, behaviour of object. Default access modifier is private. Supports inheritance.
186
What happens when we call function in OOP?
Tries to find the function with that signature starting in child class and then goes up the chain if none found. It's runtime's job.
187
Dynamic dispatch C#
Dynamic dispatch becomes possible when each object carries data about its generating type. Type is able to keep track of using virtual functions table. Allows object to override some functions which have been inherited.
188
this pointer in OOP
This is part of every instance. Manages state within a data structure. Pointer passed with a call to instance level function which than operates on object. With dynamic dispatch, it is possible to substitute function specifications.
189
What is OOP?
Object oriented programming is a programming paradigm based around data or objects rather than logic or functions. It's a way to organise code. It's built on this pointer and dynamic dispatch.
190
Library vs Framework
Framework is a more complex robust standalone environment that provides everything for building apps. It defines the programming language, the runtime, types. Library in comparison provides a limited piece of functionality within a framework.
191
git log
To find specific commit in project, history by author, date or content
192
git checkout
checkout branch, updates files based on the branch we want to checkout without merging
193
three laws of TDD
1. Not allowed to write production code unless it is to make a failing test pass 2. don't write more than is sufficient to fail 3. no more production code than is sufficient for failing code to pass
194
fix broken commit
git command --amend, can fix commit message but better to create a new one
195
git status vs git diff
diff shows differences between various commits and also between working directory and index
196
git add
adds files from existing directory to indesx
197
git reset
resets index and working directory to the state of your last commit
198
Benefits of TDD
Less time debugging, prevents feature creep by defining the tests first, helps define requirements, adding functionality is safer and easier
199
git diff
Difference between commits, commit and working tree.
200
git merge
Merges with master.
201
rebasing
Type of merging the new branch is added to the master.
202
git init
Creates new repo in selected project.
203
What does commit contain?
Set of files representing state of object at given time, message, timestamp, author, reference to parent commit objects, SHA name string identifying commit.
204
git config
Sets up config for git installation.
205
git status
Shoes difference between working directory and the index (staging).
206
What is compiler?
Translates code into machine code saves it in local file. Once compiled, source code is disregarded - if errors -> stops compiling - C#.
207
What is interpreter?
Source code needed all the time. Executes program one statement at a time. Less time to analyze source bode overall execution is slower, doesn't translate into machine code. Stops executing if there is a syntax error.
208
What are lambda expressions?
Expressions that create functions. Way of defining anonymous functions that can be passed around as parameter to a method call. Data type inferred from context. Kinda like fat arrows in JS but lambda expressions can be named.
209
What is managed code?
Code that is executed using runtime that has garbage collector that managements memory and disposes of objects that are not used, type checking and exception handling.
210
What is unmanaged code?
Directly compiled to native machine code, depends on architecture of target machine, executed directly by operating system. Developer must deal with memory leaks, type checking and exception handling.
211
What are traversal techniques?
Pre-order - Root, L, R In-order - L, Root, R Post-order - L, R, Root
212
What is binary search?
If data already sorted, starts in the middle and looks if element is bigger or smaller than the middle point, then goes either left or right, can't apply to linked list - can't sort or find middle element
213
What is heap sort?
Based on priority.
214
What are execution steps?
1. source compiled to CIL 2. CIL is assembled into bytecode and CLI assembly is created 3. CLI is passed through JIT to generate machine code 4. CPU executes native code
215
SDK vs runtime
SDK - all the stuff that makes developing an app easier, | runtime - virtual machine that hosts and runs the application & abstracts all interaction with operating system
216
What is CLI?
Common language infrastructure - compiled code library for deployment versioning and security.
217
What is restful?
Representational state transfer. Architectural standard. Set of constraints on data transfer.
218
Composition over Inheritance
Composition - takes what it wants, flexible/easy to modify. | Inheritance - more rigid, must implement everything.
219
What is mutzing?
Don't bloat code, remove unnecessary code.
220
What is dependency inversion?
High level classes shouldn't depend on low level classes. Abstraction shouldn't depend on details, details should depend on abstraction.
221
What is interface segregation principle?
Shouldn't implement interface if we won't use all the properties, shouldn't depend on methods, it doesn't need.
222
What is listov substitute principle?
Child should be substitutable for parent, child should extend all functionality not reduce it.
223
What is open/closed principle?
Classes should be easily extended but not modified.
224
Higher-order functions
Can be used as arguments and be returned by other functions.