.Net Deck 6 Flashcards

1
Q

How do you store Flags in an Enum?

A

[Flags]
public enum UserStatus: short
{
NotSet = 0,

[Description(“Inactive”)]
Inactive = 1,

[Description(“Active”)]
Active = 2
}

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

What are the first 4 numeric values of a Enum used to store Flags ?

A

0,1,2,4,8,16

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

How do you send email on the server?

A

You send it via SMTP

Simple Mail Transfer Protocol

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

What is the best was to concatenate strings in .Net and why?

A

There are 6 types of string concatenations:

Using the plus (+) symbol.
Using string.Concat().
Using string.Join().
Using string.Format().
Using string.Append().
Using StringBuilder.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write a C# function that accepts an array of integers, adds all the members and returns the result.

A
public int SumArr(int[] arr)
{
            int sum = 0;
            foreach (int i in arr)
            {
                sum = sum + i;
            }
        return sum; }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In an Api application, what information is used to route your request?

A

database proc

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

What protocol is normally used in a web request?

A

HTTP

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

What are the different types of HTTP methods? When would you use these over others?

A
POST| Create
GET| Read
PUT | Update/Replace
PATCH | Update/Modify
DELETE | Delete
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is attribute routing?

A

Routing is how Web API matches a URI to an action

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