DotNet Notepad
Saturday, October 6, 2012
Capital IQ
1) You have used .net framework version 3.5 and 4.0. What is the difference between them?
2) What is polymorphism?
3) In function overloading, return type is also part of the polymorphism?
4) So the following fns are right?
int add(int a, int b)
{
return a+b;
}
string add(int a, int b)
{
return (a+b).ToString();
}
Monday, April 4, 2011
Multiple Record insertion and updation in gridview on Winform
namespace MultipleRecordsUpdation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlDataAdapter da;
DataSet ds;
DataTable dt;
DataRow dr;
SqlConnection Con = new SqlConnection("Data Source=.\\SqlExpress;Initial Catalog=SEKHARDB;Integrated Security=True");
private void Form1_Load(object sender, EventArgs e)
{
da = new SqlDataAdapter("Select EmpID,EmpName,EmpSalary from MyEmployee", Con);
ds = new DataSet();
da.Fill(ds, "Emp");
dt = ds.Tables[0];
dgEmp.DataSource = ds.Tables[0];
//INSERT COMMAND...
SqlCommand InsertCmd = new SqlCommand("Insert into MyEmployee(EmpName,EmpSalary) values(@P1,@P2)");
SqlParameter P1;
SqlParameter P2;
SqlParameter P3;
SqlParameter Orig_EmpID;
InsertCmd.Connection = Con;
P1 = InsertCmd.Parameters.Add("@P1", SqlDbType.NVarChar,50);
P2 = InsertCmd.Parameters.Add("@P2", SqlDbType.Money);
P1.SourceColumn = "EmpName";
P1.SourceVersion = DataRowVersion.Current;
P2.SourceColumn = "EmpSalary";
P2.SourceVersion = DataRowVersion.Current;
da.InsertCommand = InsertCmd;
//UPDATE COMMAND...
SqlCommand UpdateCmd = new SqlCommand("Update MyEmployee set EmpName=@P1,EmpSalary=@P2 where EmpID=@P3");
P1 = UpdateCmd.Parameters.Add("@P1", SqlDbType.NVarChar, 50);
P2 = UpdateCmd.Parameters.Add("@P2", SqlDbType.Money);
P3 = UpdateCmd.Parameters.Add("@P3", SqlDbType.Int);
UpdateCmd.Connection = Con;
P1.SourceColumn = "EmpName";
P1.SourceVersion = DataRowVersion.Current;
P2.SourceColumn = "EmpSalary";
P2.SourceVersion = DataRowVersion.Current;
P3.SourceColumn = "EmpID";
P3.SourceVersion = DataRowVersion.Original;
da.UpdateCommand = UpdateCmd;
//ATTACH ROW UPDATE EVENT.....
da.RowUpdated+=new SqlRowUpdatedEventHandler(da_RowUpdated);
}
private void da_RowUpdated(object sender, SqlRowUpdatedEventArgs e)
{
//GET INSERTED ROW IDENTITY COLUMN ID AND PLACE IT ON ADDED ROW...
if (e.StatementType == StatementType.Insert)
{
SqlCommand Cmd = new SqlCommand("select @@Identity", e.Command.Connection);
e.Row["EmpID"] = Cmd.ExecuteScalar();
}
}
private void btnUpdateAll_Click(object sender, EventArgs e)
{
da.Update(ds, "Emp");
MessageBox.Show("Records Updated successfully...");
}
private void btnAdd_Click(object sender, EventArgs e)
{
dr = dt.NewRow();
dt.Rows.Add(dr);
}
}
}
Monday, March 28, 2011
MSMQ
MSMQ - Microsoft Message Queuing
- This provides One Way Communication between Client and Server.
- In Client System(where service is consumed), MSMQ component is installed and similarly MSMQ component is installed Server system(where service is hosted).
- As this is a One Way Communication, [Operation Contract] method should not have any return type and provide attribute IsOneWay = True
- In Real Time, this MSMQ channel is used for writing some exceptions into event files where response of the service is not needed for a request.
- MSMQ provides Offline Communication. Means even though service is down for a while, messages taken by client will not be lost instead it stored the message in Queue.
- When Service is not available, giving request to service from client will not throw any exception in MSMQ. If it is HTTP, it will throw an exception.
Friday, March 25, 2011
Valuemomentum ( A CMMi Level 3 )
Telephonic:
=========================================================================
1) When do we use static class?
2) What is single ton? How do you write this..Tell me code?
3) What is framwork difference between 2.0 and 3.5?
4) What is ajax.net?
5) I have hundred records..How do you insert those into database at a time?
http://dotnetnotepad.blogspot.com/2011/04/multiple-record-insertion-and-updation.html
5a) What is concurrency? How do you handle it?
6) What is advantage of stored procedure?
7) What is difference between union and union all?
8) What is webservice? How it is better than WCF?
9) Where do we configure security in WCF?
10) What are ado.net objects?
11) Do you know design pattern?
12) Asked something about base class library.
13) What is serialization?
=========================================================================
F to F Round
1) You finished your graduation in so and so year. What were you doing before switching to Software?
2) Why sudden change from Electrical field to Software field?
3) Person who had a telecon with you given your .net 3.5 knowledge rating as not up to the mark. Why?
4) What is difference between .Net 3.5 and .Net 2.0?
5) What is extension method?
6) What is Linq method?
7) What is 'new' keyword?
8) How do you write event log?
http://www.codeproject.com/KB/trace/writing_to_system_event.aspx?PageFlow=Fluid
9) What is static class?
10) Do you know design patterns?
11) What is singleton pattern?
12) What is the difference between singleton and static class?
13) What is difference between interface and abstract class?
14) What is difference between product application and service based application?
15) Which one you think good?
16) What is difference between Joins and (he added some other word here)
17) Suppose I want to restrict data to be sent to browser. How do you do that?
18) Do you know silverlight and WPF?
19) What have you done in database?
20) Can you write a delegate inside an Interface?
21) Can I write property inside an Interface?
22) What an Interface should not contain?
=========================================================================
1) When do we use static class?
2) What is single ton? How do you write this..Tell me code?
3) What is framwork difference between 2.0 and 3.5?
4) What is ajax.net?
5) I have hundred records..How do you insert those into database at a time?
http://dotnetnotepad.blogspot.com/2011/04/multiple-record-insertion-and-updation.html
5a) What is concurrency? How do you handle it?
6) What is advantage of stored procedure?
Precompiled execution. SQL Server compiles each stored procedure once and then reutilizes the execution plan. This results in tremendous performance boosts when stored procedures are called repeatedly.
Reduced client/server traffic. If network bandwidth is a concern in your environment, you'll be happy to learn that stored procedures can reduce long SQL queries to a single line that is transmitted over the wire.
Efficient reuse of code and programming abstraction. Stored procedures can be used by multiple users and client programs. If you utilize them in a planned manner, you'll find the development cycle takes less time.
Enhanced security controls. You can grant users permission to execute a stored procedure independently of underlying table permissions.
8) What is webservice? How it is better than WCF?
9) Where do we configure security in WCF?
10) What are ado.net objects?
11) Do you know design pattern?
12) Asked something about base class library.
13) What is serialization?
=========================================================================
F to F Round
1) You finished your graduation in so and so year. What were you doing before switching to Software?
2) Why sudden change from Electrical field to Software field?
3) Person who had a telecon with you given your .net 3.5 knowledge rating as not up to the mark. Why?
4) What is difference between .Net 3.5 and .Net 2.0?
5) What is extension method?
6) What is Linq method?
7) What is 'new' keyword?
8) How do you write event log?
http://www.codeproject.com/KB/trace/writing_to_system_event.aspx?PageFlow=Fluid
9) What is static class?
10) Do you know design patterns?
11) What is singleton pattern?
12) What is the difference between singleton and static class?
13) What is difference between interface and abstract class?
14) What is difference between product application and service based application?
15) Which one you think good?
16) What is difference between Joins and (he added some other word here)
17) Suppose I want to restrict data to be sent to browser. How do you do that?
18) Do you know silverlight and WPF?
19) What have you done in database?
20) Can you write a delegate inside an Interface?
21) Can I write property inside an Interface?
22) What an Interface should not contain?
Sunday, March 20, 2011
HCL Written Qns
1) Write a C# program such that all zeroes in the array should be at left side and all ones should be at right side.
a = { 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0 }
2) Find the 6th highest salary from Employee Table?
3) What is the functionality of the following..
5) Constructor of child class first calls ___Constructor_______________ of the parent class.
6) Interface members by default _____Public_____________ and ______abstract__________
7) a = {1,2,3,4,5,6,6,7,8,9,10}
Without comparing each cell with the other, how can you find duplicate number in the given array?
8) What is difference between web.config and global.asax?
Global.asax
The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET based application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. The Global.asax file itself is configured so that any direct URL request for it is automatically rejected. External users cannot download or view the code written within it.
Web.Config
The Web.Config is an XML based file that contains configuration information for ASP.NET resources. This file contains information about how the server will handle your application. You can set options for security, permissions, tracing, etc in this file.
9) Write a query on Employee table which gives the employees who have atleast two phone numbers?
Also write a query which gives the employees who have no phone number?
a = { 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0 }
static void Main(string[] args)
{
int[] a = { 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0 };
for (int i = 0; i < a.Length - 1; ++i)
{
for (int j = 0; j < a.Length - i - 1; ++j)
{
if (a[j] > a[j + 1])
{
int Temp = 0;
Temp = a[j + 1];
a[j + 1] = a[j];
a[j] = Temp;
}
}
}
Console.Write("a = {");
for (int k = 0; k <= a.Length - 1; k++)
{
Console.Write(a[k].ToString() + " ");
}
Console.Write("}");
Console.WriteLine("\n");
}
2) Find the 6th highest salary from Employee Table?
3) What is the functionality of the following..
- inetinfo.exe
- aspnet_isapi.dll
- aspnet_wp.exe
5) Constructor of child class first calls ___Constructor_______________ of the parent class.
6) Interface members by default _____Public_____________ and ______abstract__________
7) a = {1,2,3,4,5,6,6,7,8,9,10}
Without comparing each cell with the other, how can you find duplicate number in the given array?
8) What is difference between web.config and global.asax?
Global.asax
The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET based application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. The Global.asax file itself is configured so that any direct URL request for it is automatically rejected. External users cannot download or view the code written within it.
Web.Config
The Web.Config is an XML based file that contains configuration information for ASP.NET resources. This file contains information about how the server will handle your application. You can set options for security, permissions, tracing, etc in this file.
9) Write a query on Employee table which gives the employees who have atleast two phone numbers?
Also write a query which gives the employees who have no phone number?
Thursday, March 17, 2011
Ust Global Qns
1. Tell me the situations when you feel challenging in your development (specifically).
2. What is your present application (explain) ?
3. How many ways you can do session management ?
4. Do you think .net is language independent ? how
5. Did you ever get out of memory exception in your applications ?
6. How can you write you own Custom exception class ?
7. What is managed code and unmanaged code ?
8. Can you use a C++ dll in you .net code ? if yes , how ?
There are P/Invoke services in .net ( Platform Invocation Services )...They allow us to use c++ dll in .net code...
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5df04db1-bbc8-4389-b752-802bc84148fe/
9. What is garbage collector ?
10. What if an object taken to leve2 in GC ? what will happen ?
11. do you know about boxing ?
12. Have you used delegates? what are multicast delegates ? how to create them?
13. how many constructors can you have in a class ?
14. how can you copy an object ?
15. Do you know about shallow copy and deep copy ?
16. What are the builtin interfaces you use in your daily coding?
IDisposable, IComparable, IEnumerable...
17. What is iDisposable ? or why is dispose method ? is that called by GC ?
18. Have you used using(){} block in c# ? whats the use of it ?
The using statement defines a scope at the end of which an object will be disposed.
You create an instance in a using statement to ensure that Dispose is called on the object when the using statement is exited. A using statement can be exited either when the end of the using statement is reached or if, for example, an exception is thrown and control leaves the statement block before the end of the statement.
Suppose If an exception is thrown inside using, will it still call the dispose on the Object? Yes..surely it will call Dispose even though an exception is thrown inside using.
19. You are presently working on which version of .net? A. 3.5 ;
Q. You have worked on any other versions or only on 3.5 ? A. 2.0 also;
Q. What are the differences you find in 2.0 and 3.5 ?
20. Linq uses two interfaces what are they ? ans. 1. IEnumerable
Q. what is the other one?
21. What are the methods used in linq ? he gave some scenerio - so - the methods are called extension methods.
22. what is the syntax for extension methods ?
23. Can you tell me the logic to check if a string is palindrom or not without using builtin functions ?
24. What is an abstract class?
25. I will give you a scenerio, tell me the architecture or classes required to do that. I have a customer and he has an account . he should be able to deposit money and withdraw money.
(twist ... you can have only one method for deposit and withdraw , as withdarw means deposit a negitive balance)
26. How will you find out and solve an issue in windows application?
27. Do you have any testing tools knowledge like NUnit, ?
28. You have any knowledge in design patterns ? have you used anyone ?
29. You got any chance to work for console applications ?
30. What is the coding methodology you use ? do you know azile methodology ?
Interview Duration : 1hr.
2. What is your present application (explain) ?
3. How many ways you can do session management ?
4. Do you think .net is language independent ? how
5. Did you ever get out of memory exception in your applications ?
6. How can you write you own Custom exception class ?
class MyCustomException : Exception
{
public MyCustomException(string str)
{
Console.WriteLine(str + " thrown an exception \n");
}
}
static void Main(string[] args)
{
try
{
throw new MyCustomException("Sekhar");
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString()+"\n");
}
}
7. What is managed code and unmanaged code ?
8. Can you use a C++ dll in you .net code ? if yes , how ?
There are P/Invoke services in .net ( Platform Invocation Services )...They allow us to use c++ dll in .net code...
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5df04db1-bbc8-4389-b752-802bc84148fe/
9. What is garbage collector ?
10. What if an object taken to leve2 in GC ? what will happen ?
11. do you know about boxing ?
12. Have you used delegates? what are multicast delegates ? how to create them?
13. how many constructors can you have in a class ?
14. how can you copy an object ?
15. Do you know about shallow copy and deep copy ?
16. What are the builtin interfaces you use in your daily coding?
IDisposable, IComparable, IEnumerable...
17. What is iDisposable ? or why is dispose method ? is that called by GC ?
18. Have you used using(){} block in c# ? whats the use of it ?
The using statement defines a scope at the end of which an object will be disposed.
You create an instance in a using statement to ensure that Dispose is called on the object when the using statement is exited. A using statement can be exited either when the end of the using statement is reached or if, for example, an exception is thrown and control leaves the statement block before the end of the statement.
using(Font ObjFont = new Font("Arial",10.0f))
{
//Use the object 'ObjFont' here....
}//Compiler will call Dispose on 'ObjFont' at this end...
The object you instantiate must implement the System.IDisposable interface.
If you create an object inside using for a custom class which is not implemented IDisposable interface, then it will give you compile error saying that class must implement IDisposable interface.....
Suppose If an exception is thrown inside using, will it still call the dispose on the Object? Yes..surely it will call Dispose even though an exception is thrown inside using.
19. You are presently working on which version of .net? A. 3.5 ;
Q. You have worked on any other versions or only on 3.5 ? A. 2.0 also;
Q. What are the differences you find in 2.0 and 3.5 ?
20. Linq uses two interfaces what are they ? ans. 1. IEnumerable
Q. what is the other one?
21. What are the methods used in linq ? he gave some scenerio - so - the methods are called extension methods.
22. what is the syntax for extension methods ?
23. Can you tell me the logic to check if a string is palindrom or not without using builtin functions ?
string str = "MALAYALAM";
for (int i = 0; i < str.Length / 2; i++)
{
if(str[i]!=str[str.Length-(i+1)])
{
Console.WriteLine("Not a Palindrome");
return;
}
}
Console.WriteLine("Its a Palindrome");
//Observe..You are using String varialbe str as a Char Array...
//May be it can be used like that in .net 3.5
24. What is an abstract class?
25. I will give you a scenerio, tell me the architecture or classes required to do that. I have a customer and he has an account . he should be able to deposit money and withdraw money.
(twist ... you can have only one method for deposit and withdraw , as withdarw means deposit a negitive balance)
26. How will you find out and solve an issue in windows application?
27. Do you have any testing tools knowledge like NUnit, ?
28. You have any knowledge in design patterns ? have you used anyone ?
29. You got any chance to work for console applications ?
30. What is the coding methodology you use ? do you know azile methodology ?
Interview Duration : 1hr.
Wednesday, March 16, 2011
App Shark Qns
Telephonic - 15 min
SQL
1) Difference between UDF and SP?
2) What is concurrency?
3) How do you handle concurrency?
4) What did you do in SQL?
5) What is transaction?
6) Where/when do you commit or rollback transaction?
C#
1) What is interface?
2) There is class A and Class B and Class C. C is inherited from B, B is inherited from A. I created object for Class C. What is the order of the constructor execution?
First constructor of Class A is executed. Next, Class B constructor is executed, later Class C constructor is executed.
3) What is static variable?
4) How do you access static member?
5) What is difference between a global variable and public property?
6) What is object intializer?
7) what is generations?
8) What is garbage collector?
9) What is dispose method?
ASP.NET
1) How do you maintain state?
2) Where do you store session?
3) How do you identity a session belongs to a particular user?
4) If cookies are disabled at browser, how do you identify a session belongs to a particular user?

SQL
1) Difference between UDF and SP?
2) What is concurrency?
3) How do you handle concurrency?
4) What did you do in SQL?
5) What is transaction?
6) Where/when do you commit or rollback transaction?
C#
1) What is interface?
2) There is class A and Class B and Class C. C is inherited from B, B is inherited from A. I created object for Class C. What is the order of the constructor execution?
First constructor of Class A is executed. Next, Class B constructor is executed, later Class C constructor is executed.
namespace ClasABC
{
class Program
{
static void Main(string[] args)
{
C obj = new C();
}
}
class A
{
public A()
{
Console.WriteLine("Constructor in 'Class A' is executed");
}
}
class B : A
{
public B()
{
Console.WriteLine("Constructor in 'Class B' is executed");
}
}
class C : B
{
public C()
{
Console.WriteLine("Constructor in 'Class C' is executed");
}
}
}
OutPut:
3) What is static variable?
4) How do you access static member?
5) What is difference between a global variable and public property?
6) What is object intializer?
7) what is generations?
8) What is garbage collector?
9) What is dispose method?
ASP.NET
1) How do you maintain state?
2) Where do you store session?
3) How do you identity a session belongs to a particular user?
4) If cookies are disabled at browser, how do you identify a session belongs to a particular user?
In ASP.NET, the necessary session-to-user link may optionally be established without using cookies. Interestingly enough, you don't have to change anything in your ASP.NET application to enable cookieless sessions, except the following configuration setting in web.config file.
Note that session settings are application-wide settings. In other words, all the pages in your site will, or will not, use cookies to store session IDs.
The node can also be used to configure other aspects of the session state management, including the storage medium and the connection strings. However, as far as cookies are concerned, setting the cookieless attribute to true (default is false) is all that you have to do.
Note that session settings are application-wide settings. In other words, all the pages in your site will, or will not, use cookies to store session IDs.
Where is ASP.NET storing the session ID when cookies are not being used? In this case, the session ID is inserted in a particular position within the URL. The figure below shows a snapshot from a real-world site that uses cookieless sessions.
Figure 1. MapPoint using cookieless sessions
Imagine you request a page like http://yourserver/folder/default.aspx. As you can see from the MapPoint screenshot, the slash immediately preceding the resource name is expanded to include parentheses with the session ID stuffed inside, as below.
The session ID is embedded in the URL and there's no need to persist it anywhere. Well, not exactly.. Consider the following scenario.
DrawBack:
You visit a page and get assigned a session ID. Next, you clear the address bar of the same browser instance, go to another application and work. Then, you retype the URL of the previous application and, guess what, retrieve your session values as you get in.
If you use cookieless sessions, in your second access to the application you're assigned a different session ID and lose all of your previous state. This is a typical side effect of cookieless sessions. To understand why, let's delve deep into the implementation of cookieless sessions.
5) What is webservice?
5) What is webservice?
Subscribe to:
Posts (Atom)