write program in C# for palindrome? (aug 2009)
write program in C3 for generating below output?(aug 2009)
#
# #
# # #
# # # #

Answers were Sorted based on User's Feedback



write program in C# for palindrome? (aug 2009) write program in C3 for generating below output?(aug..

Answer / elan

string sName = "elan";
char[] aName = sName.ToCharArray();
Array.Reverse(aName);
string sReversedName = new string(aName);
if (sName == sReversedName)
{
MessageBox.Show("it is palindrome");
}
else
{
MessageBox.Show("it is not palindrome");
}

Is This Answer Correct ?    25 Yes 10 No

write program in C# for palindrome? (aug 2009) write program in C3 for generating below output?(aug..

Answer / kanan

int k = 3;

for (int i = 1; i <= 4; i++)
{
for (int j = k; j > 0; j--)
{
Response.Write("&nbsp;&nbsp;");
}
for (int x = 0; x < i; x++)
{
Response.Write("#");
Response.Write("&nbsp;&nbsp;");
}
k--;
Response.Write("<br/>");

Is This Answer Correct ?    15 Yes 1 No

write program in C# for palindrome? (aug 2009) write program in C3 for generating below output?(aug..

Answer / elan

Hi Kanan,

Your code will work, however it was very standard one and
in interview, interviewer will expect candidate to provide
answers with regards to Array. In that point of view we
have provide answers using array. It will express our
knowledge in Array to employer.

I hope my answer make sence. Please provide your comments
if you have anything.

Is This Answer Correct ?    6 Yes 1 No

write program in C# for palindrome? (aug 2009) write program in C3 for generating below output?(aug..

Answer / elan

Hi Kannan,

Also my reply is for the following question.

write program in C# for palindrome? (aug 2009)

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More C Sharp Interview Questions

Name which controls do not have events?

0 Answers  


i have a question which is quite simple but yet complicated for me my question is why do we use void, if it does not return anything to the compiler? if it is used for normal display it can also be done by what is called Console.Write() or Consol.WriteLine() and if i do not use void with my method then my compiler throws me an error. if i return a value say integer then i write public int fun() display of the result can also be done here then why is it so necessary to use void with a function and why so compiler throw us an error if v don't use void return type?

2 Answers  


In a single .NET DLL how many classes it contains?

0 Answers   Siebel,


what are some characteristics of an array?

0 Answers  


What operator means?

0 Answers  






What are generic types?

0 Answers  


Expalin the way you implement inheritance by using VB.NET/C#?

0 Answers   Siebel,


What is the difference between constant and readonly in c#?

0 Answers  


Does the system.exception class have any cool features?

0 Answers  


How is method overriding different from overloading?

0 Answers  


Is c# front end or back end?

0 Answers  


What is the difference between list and array in c#?

0 Answers  


Categories