Sie sind auf Seite 1von 3

2 What Will Be The Output Of Given Code Snippet?

Class UnsafeCode
{
Unsafe Static Void Main()
{
Int[] Nums = New Int[10];
Console.WriteLine("Index Pointer Like Array.");
Fixed (int* P = Nums)
{
For (int I = 0 ;i <10 ;i++)
P[i] = I;
For (int I = 10 ;i >0 ;i--)
Console.WriteLine("p[{0}]: {1} ", I, P[i]);
Console.ReadLine();
}
}
}(mark - 4 ; neg mark - 1)
P[10] :0, P[9] :9, P[8] :8…..p[1]:1
P[10] : 1, P[9] :2, P[8] :3…..p[1] :0
P[1] : 1, P[2] :2, P[3] :3…..p[10] :0
Compile Time Error
Not Interested
3 To Use DataAdapter Which Work As A Mediator Between Database And Dataset.(mark - 4 ;
neg mark - 1)
Public DataSet GetEmployeeData()
{
SqlConnection ConString = New SqlConnection("myconnection");
ConString.Open();
SqlCommand CmdQuery = New SqlCommand("Select * From Employee", ConString);
SqlDataAdapter Sda = New SqlDataAdapter(CmdQuery);
DataSet DsData = New DataSet();
Sda.Fill(dsData);
Return DsData;
}
Public DataSet GetEmployeeData()
{
SqlConnection Constring = New SqlConnection("myConnection");
Constring.Open();
SqlCommand CmdQuery = New SqlCommand("Select * From Employee", ConString);
SqlDataAdapter Sda = New SqlDataAdapter(cmdquery);
DataSet DsData = New DataSet();
Sda.Fill(dsData);
Return DsData;
}
Public DataSet GetEmployeeData()
{
SqlConnection ConString = New SqlConnection("myconnection");
ConString.Open();
SqlCommand CmdQuery = New SqlCommand("Select * From Employee", ConString);
SqlDataAdapter Sda = New SqlDataAdapter(cmdquery);
DataSet DsData = New DataSet();
Sda.Fill(dsData);
return DsData;
}
Public DataSet GetEmployeeData()
{
SqlConnection ConString = New SqlConnection("myconnection");
ConString.Open();
SqlCommand CmdQuery = New SqlCommand("Select * From Employee", Constring);
SqlDataAdapter Sda = New SqlDataAdapter(cmdQuery);
DataSet DsData = New DataSet();
Sda.Fill(dsData);
Return DsData;
}
Not Interested
1 The Specified ConnectionString Section Is Used Throughout The Project For Database
Connection:(mark - 4 ; neg mark - 1)
< Em>< Configuration>
< AppSettings>
< Add Key="connectionString" Value="server=local; Pwd=password; Database=default" />
< /appSettings>< /em>

< Em>< Configuration>


< AppSettings>
< Add Key="ConnectionString" Value="server=local; Pwd=password; Database=default" /><
Br />< /appSettings>< /em>
< Em>< Configuration>
< AppSettings>< Br />< Add Key="ConnectionString" Value="server=local; Pwd=password;
Database=default" />
< /appSettings>< /em>

< Em>< Configuration>


< AppSettings>
< Add Key="connectionString" Value="server=local; Pwd=password; Database=default" />
< /appSettings>< /em>

Not Interested

Note:
1. < AppSettings>< /appSettings>
2. Option 1 and 4 are same
3. tag </em> closed before </Configuration>(Means </Configuration> not
closed)