Fundamentals and Data Structes Flashcards

1
Q

Structs

A

-are like classes but

-are value types
-stored in stack
-dont have parametress contructor
-dont support virual or abstract methods
-for smaller data
-dont support inheritance
-cannot have a null reference
-dont have a memory overhead

and classes are oposite!

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

Enums

A

An enum is a special “class” that represents a group of constants (unchangeable/read-only variables).

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

null coalescing operator

A

.It will return the value of its left-hand operand if it is not null. If it is null, then it will evaluate the right-hand operand and returns its result. Or if the left-hand operand evaluates to non-null, then it does not evaluate its right-hand operand.

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

Delegates

A

-holds the reference to a method

private delegate void OnClickDelegate()

-it is just a callback
-when I want to give a function as arugment to another function, i have to create it as a delegate

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

Lambda expression

A

() => {}

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

Mulitcast delegates

A

Mulitcast delegates are like a chain reaction of subscriptions
->
calling one method immediately call method that subscribes to it

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

LINQ

A

Language Integrated Query

retriving data from a data source
obtain a data source ->
create the query ->
execute the query

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

Async Code

A

public static async Task<T> GetData<T> (string ulr)</T></T>

  1. use try-catch
  2. using(var client = new HttpClient() )
  3. HttpResponseMessage response = await client.GetAsync(url)
  4. the use this condition to work with the result
    if response.StatusCode == System.Net.HttpStatusCode.OK
  5. make a string out of a response and then an object
    var ResponseString = await response.Content.ReadAsStringAsync()
    var ResponseObject = JSONConvert.DeserializeObject<T>(ResponseString)</T>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Action

A

actions has no return value, no return code
are always void

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

Func

A

an action that has a return value

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

Predicate

A

returns a bool

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

Func<T></T>

A

is a predefined delegate type for a method that returns some value of the type T.

public static string GetMessage() { return “Hello world”; }
Func<string> f = GetMessage;</string>

Func<TParameter, TOutput>- we decalre the given parameter and the output parameter

MUST HAVE RETURN TYPE

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

var

A

var- A var variable must be initialized at the time of declaration.

var can contain any type of data,
the compiler to figure out the variable type at compilation time.

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

IEnumerable vs List - What to Use? How do they work?

A

IEnumerable is read-only and List is not.

A class that implement IEnumerable allows you to use the foreach syntax.

Many types other than List<T> implement IEnumerable such as an ArrayList. So one advantage is you can pass different collection types to the same function.</T>

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

Action/Func vs Methods, what’s the point?

A

Action and Func are framework-provided Delegate types.

Delegates allow functions to be treated like variables, meaning that you can (among other things) pass them from method to method.

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

Claim

A

A claim is a name value pair that represents what the subject is, not what the subject can do

Claims are pieces of information provided to you (your app) by a third-party application that describes the user.

Tokens, jwt

17
Q

There are two types of authentication in ASP.Net identity.

A

Role-Based Security

A user gets assigned to one or more roles through which the user gets access rights. Also, by assigning a user to a role, the user immediately gets all the access rights defined for that role.

Claims-Based Security

A claims-based identity is the set of claims. A claim is a statement that an entity (a user or another application) makes about itself, it’s just a claim.

18
Q

Dictionary<TKey, TValue>

A

The Dictionary<TKey, TValue> is a generic collection that stores key-value pairs in no particular order.

Keys must be unique and cannot be null.

Values can be null or duplicate.

19
Q

ArrayList

A

In C#, the ArrayList is a non-generic collection of objects whose size increases dynamically. It is the same as Array except that its size increases dynamically.

non generic

20
Q

List<T></T>

A

List<T> equivalent of the ArrayList, which implements IList<T>.
Generic</T></T>

Are resizeable

List<T> can contain elements of the specified type. It provides compile-time type checking and doesn't perform boxing-unboxing because it is generic.</T>

21
Q

Hashtable

A

The Hashtable is a non-generic collection that stores key-value pairs, similar to generic Dictionary<TKey, TValue> collection.

Keys must be unique and cannot be null.
Values can be null or duplicate.

22
Q

Stack

A

generic

Stack is a special type of collection that stores elements in LIFO style (Last In First Out).

Stack<T> can contain elements of the specified type. It provides compile-time type checking and doesn't perform boxing-unboxing because it is generic.</T>

23
Q

Queue<T></T>

A

generic

Queue is a special type of collection that stores the elements in FIFO style (First In First Out), exactly opposite of the Stack<T> collection</T>

24
Q

Tuple

A

The Tuple<T> class was introduced in .NET Framework 4.0. A tuple is a data structure that contains a sequence of elements of different data types. It can be used where you want to have a data structure to hold an object with properties, but you don't want to create a separate type for it.</T>

25
Q

Boxing

A

The process of converting a Value Type variable (char, int etc.) to a Reference Type variable (object) is called Boxing.

Boxing is an implicit conversion process in which object type (super type) is used.

Value Type variables are always stored in Stack memory, while Reference Type variables are stored in Heap memory.

26
Q
A