Hot Area:

HOTSPOT
You are building a data access layer in an application that contains the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

HOTSPOT
You are building a data access layer in an application that contains the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Answer:



Leave a Reply 12

Your email address will not be published. Required fields are marked *


z1ppz

z1ppz

class Program
{
public static Object GetTypeDefault(DbType dbDataType)
{
switch (dbDataType)
{
case DbType.Boolean:
return false;
case DbType.DateTime:
return DateTime.MinValue;
case DbType.Decimal:
return 0m;
case DbType.Int32:
return 0;
case DbType.String:
return String.Empty;
default:
return null;
}
}

public static void Main()
{
Console.WriteLine(“Type the number of the desired DbType”);
Console.WriteLine(“Choose between Boolean (3), DateTime (6), Decimal (7), Int32 (11), String (13)”);
int a;

a = Convert.ToInt32(Console.ReadLine());

var answer = GetTypeDefault((DbType)a);

Console.WriteLine(answer == null
? “Default: null”
: $”The specified number represents the following answer: {Convert.ToString(answer)}”);
Console.ReadKey();
}
}

CJ

CJ

Correct Answer
No
Yes
No