21 Jun 2011

Emids

1)use of throw exception
throw
The throw statement is used to signal the occurrence of an anomalous situation (exception) during the program execution.
class MyException : System.Exception {}
// ...
throw new MyException();

You can explicitly throw an exception using the throw statement. You can also throw a caught exception again using the throw statement.


throws
keyword used in method declarations that specify which exceptions are not handled within the method but rather passed to the next higher level of the program.


4)how to create unit testing
5)Use of denormalization
Denormalization is the process of attempting to optimize the read performance of a database by adding redundant data or by grouping data.
6)is it possible to use DML operation in View
Yes

create text box and label , Textbox has to allow multiple chars and output has to show in Label . create below 3 scenarios
1) Count all vowel in the string ‘a’,’e’,’I’,’o’,’u’
2) count the number of occurances of the dates dd/mm/yy or mm/dd/yy,yy/mm/dd formats from the above textbox
3) dates comparision ,2 text boxes format dd/mm/yyyy and mm/dd/yyyy



protected void Button1_Click(object sender, EventArgs e)
{
string str = TextBox1.Text.ToString();
int j = 0;
foreach (char ch in str)
{
if (ch == 'a') j++;
if (ch == 'e') j++;
if (ch == 'i') j++;
if (ch == 'o') j++;
if (ch == 'u') j++;
}
Label1.Text=j.ToString();
}
}

No comments:

Post a Comment