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:
No
Yes
No
Agee, No,Yes,No
Agree
Agree
Agree
Agree
Agree
indeed
Agree
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();
}
}
Correct Answer
No
Yes
No
No yes No