.Net Deck 2 Flashcards

1
Q

Write out C# function that accepts two numbers - adds these numbers - returns the result of the addition:

A
public static int Sum(int num1, int num2)
    {
        int total;
        total = num1 + num2;
        return total;
    }v
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Adjust the Add function from the previous answer to - accept an optional third parameter - throw an error if it is not passed at least two arguments.

A
public static int Sum(int num1, int num2, int? num3 = null)
{
  int total = num1 + num2 + num3;
  return total;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the main differences or considerations between the JS and C#.

A

C# is strictly typed Object Oriented Programming Language whereas java script is loosely type client side scripting language

C# runs inside the .NET framework, so it’s good for building desktop applications, but can also be used to build web applications and servers. JavaScript runs in a browser. It can still be used to make games and stuff, but they have to run inside Firefox, Chrome, IE etc.

C# is strongly typed, meaning you have to explicitly define the types of all variables and function return types. JavaScript is weakly typed, so any variable can hold any type of value and any function can return anything. Functions can actually return other functions and variables can contain functions.

C# is object oriented, so we have classes and inheritance and the like.

C# is a compiled programming language. JavaScript (as the name implies) is a scripting language. So JavaScript can fail due to syntactic errors at run time

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

Does .Net support other types of Web Applications other than ASP.Net MVC?

A

Yes one example of other web apps supported by .Net core are single page applications.

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

What is the generic name of the library used in .Net that is used to communicate with Databases?

A

ado.net

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

What are the .Net objects and classes used to communicate and execute commands at the database?

A

SqlConnection, SqlCommand, SqlDataReader

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

What do you use to debug C#?

A

Setting a breakpoint and running program in debug mode

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

What is a Null Reference Exception?

A

A NullReferenceException happens when you try to access a reference variable that isn’t referencing any object

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

What is a an MVC View?

A

A View, in the context of a Model View Controller (MVC) architecture, is a software class that contains a template and data form and produces a response for the browser. It receives data from the Controller of the MVC and packages it and presents it to the browser for display.

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

What is a Model?

A

Model is a class which represents data object which can be used for transferring data

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