Showing posts with label Interview FAQ. Show all posts
Showing posts with label Interview FAQ. Show all posts

What is Serialization in ASP.NET?

As a programmer you will often need to send objects to another location, you may also need to convert them to an appropriate format. So, what will you do? One of the solution is Serialization. The .NET Framework 2.0 provides built-in classes to convert data to formats that are portable, or easy to transport to another location. This process of converting data into a portable format is called Serialization.

What is Deserialization in ASP.NET?

As a programmer you may need to restore the object or data into its original form. This process of restoring the object or data to its original state is called Deserialization 

Source Code:

Leap Year program using C# or CSharp.

The following code checks whether the year entered by the user is a Leap Year. If the condition specified in the if statement is true, the statements in the if block are executed. And if the condition specified in the if statement is false , the statement in the else block are executed.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int Year;
Console.WriteLine("Enter the year: ");
Year = Convert.ToInt32(Console.ReadLine());
if ((Year % 4 == 0) && (Year % 100 != 0 || Year % 400 == 0))
{
Console.WriteLine("The Year you have entered is a Leap Year {0}.", Year);
}
else
{
Console.WriteLine("The Year you have entered is not a Leap Year {0}.", Year);
}
Console.ReadLine();
}
}
}

Output:

What is .NET Framework?

If the interview ask you this question just say this,
Microsoft introduce the .NET framework with the intention of bridging the gap in interoperability between application. This framework aims at integrating various programming languages and services. It is design to make significant improvements int the code reuse, code specialization, resource management, multi-language, development. It is a platform which enables you to create robust and scalable applications. The .NET framework consists of Common Langauage Runtime(CLR), Common Language Specification(CLS), and the Just-In-Time Compiler.

.NET Architecture


Just print this image in you mind. The above image explains the .NET Architecture. It will be easy for you to explain the .NET Framework with this image.

Factorial of a number in C#(CSharp)

The following is an example of the factorial number. It is also recursive method. Have a look:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
public int factorial(int n)
{
int result;
if (n == 1)
return 1;
else
{
result = factorial(n - 1) * n;
return result;
}
}
static void Main(string[] args)
{
Program obj = new Program();
Console.WriteLine("Factorial of 3 is " + obj.factorial(3));
Console.WriteLine("Factorial of 4 is " + obj.factorial(4));
Console.WriteLine("Factorial of 5 is " + obj.factorial(5));

Console.ReadLine();
}
}
}

Output:

Factorial

Difference between HTML and XML?

                 HTML was created by Tim Berners-Lee as a simple and effective way of generating clear and readable documents. HTML enables you to create documents and Web pages that can be read by all web browsers.

                  The World Wide Web Consortium(W3C) developed XML to enable the expansion of Web Technologies into the new domains of document processing and data interchange. It is designed to ease data exchange over the Internet. XML is a text-based markup language that enables you to store data in a structured format by using meaningful tags.

Conside a sample HTML Code:

<b> My Book </b>

<p> John Smith <br />
Tech books publications <br />
$50.00 <br />
</p>

The preceding code snippet represents information about the author, publisher, and cost of a book. However, the tags used for presenting the content do not reveal this information. The tags specify the format in which the content must be displayed on ab browser.

<book>
<name> My Book </name>
<author> John Smith </author>
<publisher> Tech books publications </publisher>
<price> $50.00 </price> 
</book>

The preceding code snippet, the content is described by using meaningul tags to represent the data. XML enables you to create a markup language for your application and does not place any restriction on the number of tags that you can define.

Fibonacci Series Using C#(CSharp)

Following program generates the Fibonacci series up to 200.

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{       
static void Main(string[] args)
{
int number1, number2;
number1 = 0;
number2 = 1;

Console.WriteLine("{0}", number1);
while (number2 < 200)
{
Console.WriteLine("{0}", number2);
number2 = number2 + number1;
number1 = number2 - number1;
}

Console.ReadLine();

}
}
}

Output

Fibonacci Series
 

About Me

It's Me!Hi, I'm Moinuddin. I'm a Software Engineer at WIPRO working on Microsoft .NET Technology. I'm interested in a wide range of technology topics, mainly Microsoft including Windows Azure, WCF, WPF, Silverlight and any other cool technology that catches the eye.

Site Info

ProjectCSharp.com is mainly about demonstrating real time examples in different technologies like ASP.NET, WCF, WPF, Silverlight, Azure etc..,

Followers

Help Links

Project CSharp (C#) Copyright © 2011. All Rights Reserved.