.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

How do we generate random numbers?

Posted By :nishithraj     Posted Date :March 26, 2010    Points :10   Category :C# 
Using Math.random() method we can generate random numbers between 0 to 9

You can also find related Interview Question to How do we generate random numbers?  below: 

Is there a way to generate more then on .xap file from a same silverlight application.

Since for each .xap file we have to create a new silverlight application.

Can we generate Trigger for two table and give a example ?

yes,we can create trigger on two tables.



WHEN (newRow.a <= 10)
INSERT INTO T5 VALUES(:newRow.b, :newRow.a);
END trig1

How can we find out odd and even numbers?

int input=50;

if(input ==1)
response.write("this number is odd number");
response.write("this number is even number");
} (More...)

How do you generate a strong name?

.NET provides an utility called strong name tool. You can run this toolfrom the VS.NET command prompt to generate a strong name with an option "-k" and providing the strong key file name. i.e. sn- -k < file-name >
What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
The Debug build is the program compiled with full symbolic debug information and no optimization. The Release build is the program compiled employing optimization and contains no symbolic debug information. These settings can be changed as per need from Project Configuration properties. The release runs faster since it does not have any debug symbols and is optimized.

What are the correct version numbers for C#?

These are the versions of C# known about at the time of this writing:

C# 1.0; released with .NET 1.0 and VS2002 (January 2002)
C# 1.2 (bizarrely enough); released with .NET 1.1 and VS2003 (April 2003). First version to call Dispose on IEnumerators which implemented IDisposable. A few other small features.
C# 2.0; released with .NET 2.0 and VS2005 (November 2005). Major new features: generics, anonymous methods, nullable types, iterator blocks
C# 3.0; released with .NET 3.5 and VS2008 (November 2007). Major new features: lambda expressions, extension methods, expression trees, anonymous types, implicit typing (var), query expressions
C# 4.0; released with .NET 4.0 and VS2010 (April 2010). Major new features: late binding (dynamic), delegate and interface generic variance, more COM support, named arguments and optional parameters
C# 5.0; unknown time frame. Anounced features as of PDC 2010: async programming, metaprogramming.

Reference Link :-
http://stackoverflow.com/questions/247621/what-are-the-correct-version-numbers-for-c (More...)

how to show the line numbers in C# code editor?


Ans ->

Tools -> option

TextEditor ->C# ->Line number option check

What are the different ways to generate proxy in WCF?

A service proxy or simply proxy in WCF enables application(s) to interact with WCF Service by sending and receiving messages. It's basically a class that encapsulates service details i.e. service path, service implementation technology, platform and communication protocol etc. It contains all the methods of service contract (signature only, not the implementation). So, when the application interact the service through proxy, it gives the impression that it's communicating a local object.

We can create proxy for a service by using Visual Studio or SvcUtil.exe.

Generating proxy using Visual Studio is simple and straight forward.

->Right click References and choose "Add Service Reference".
->Provide base address of the service on "Add Service Reference" dialog box and click "Go" button. Service will be listed below.
->Provide namespace and click OK.

Visual studio will generate a proxy automatically.

We can generate proxy using svcutil.exe utility using command line. This utility requires few parameters like HTTP-GET address or the metadata exchange endpoint address and a proxy filename i.e. optional.

svcutil http://localhost/MyService/Service1.svc /out:MyServiceProxy.cs
If we are hosting the service at a different port (other than default for IIS which is 80), we need to provide port number in base address.

svcutil http://localhost:8080/MyService/Service1.svc /out:MyServiceProxy.cs

Which method is used to generate the click event of the Control class for the Button control in C#?

The PerformClick() method of the Button class is used to generate the Click event of the System.Windows.Forms.Control class. (More...)

What is Proxy and how to generate proxy for WCF Services?

The proxy is a CLR class that exposes a single CLR interface representing the service contract. The proxy provides the same operations as service's contract, but also has additional methods for managing the proxy life cycle and the connection to the service. The proxy completely encapsulates every aspect of the service: its location, its implementation technology and runtime platform, and the communication transport.

The proxy can be generated using Visual Studio by right clicking Reference and clicking on Add Service Reference. This brings up the Add Service Reference dialog box, where you need to supply the base address of the service (or a base address and a MEX URI) and the namespace to contain the proxy.

Proxy can also be generated by using SvcUtil.exe command-line utility. We need to provide SvcUtil with the HTTP-GET address or the metadata exchange endpoint address and, optionally, with a proxy filename. The default proxy filename is output.cs but you can also use the /out switch to indicate a different name.

SvcUtil http://localhost/MyService/MyService.svc /out:Proxy.cs

When we are hosting in IIS and selecting a port other than port 80 (such as port 88), we must provide that port number as part of the base address:

SvcUtil http://localhost:88/MyService/MyService.svc /out:Proxy.cs

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend