GeekInterview.com
Series: Subject: Topic:

C# Interview Questions

Showing Questions 21 - 40 of 460 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

Late and early binding

Asked By: kapil | Asked On: Nov 12th, 2011

Which one best in late binding and early binding? What is the difference between them ?

Answered by: Sivavt on: Mar 26th, 2012

Early binding Or Compile time Or static binding: Assigning of object to type reference happens at compile time.

Late binding Or Run time Or Dynamic binding: Assigning of object to type reference happens at run time.

Early binding is efficient while late binding provides flexibility to programmers.

Answered by: Devender Thadkapalli on: Nov 28th, 2011

Early binding is best. Because any errors can be resolved at compile time. Late binding is at Run Time

Will finally block get executed if the exception had not occurred?

Asked By: Interview Candidate | Asked On: Sep 15th, 2004

Yes. What is the c# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?

Answered by: Sivavt on: Mar 25th, 2012

yes. Finally will be executed even if the exception hasn't occurred. Catch all statement.

Code
  1. try{}
  2. catch{}
  3.  
  4. Or
  5.  
  6. try{}
  7. catch(Exception e){}

Answered by: Dadan Tiwari on: Feb 13th, 2012

Yes. Finally block will always execute whether execption occur or not.

Any process can be divided into multiple

Asked By: Interview Candidate | Asked On: Nov 27th, 2005

Skill/topic: advanceda) programsb) threadsc) application domains

Star Read Best Answer

Editorial / Best Answer

Answered by: LordAlex

View all answers by LordAlex

Member Since Nov-2011 | Answered On : Nov 5th, 2011

Application domains are typically created by runtime host( i.e. Windows process/program). Application domains provide an isolation boundary for security,.... .NET program is an Assembly loading into an Application domain. Threads are the operating system construct used by the common language runtime to execute code in Application domains. Therefore, for .NET, Process (runtime host) -> Application Domains -> Assemblies (.NET programs)-> Managed Threads.

Answered by: Sivavt on: Mar 25th, 2012

App domains. This could be best understood by taking an example of a browser program. A browser may run multiple web applications simultaneously. All these could be run in separate app domains. So, i...

Answered by: vvemu on: Mar 5th, 2012

Threads

Constructors can not be static ?

Asked By: Interview Candidate | Asked On: Jan 1st, 2006

Answered by: Sivavt on: Mar 25th, 2012

Yes, there can be a static constructor. It will be at class level & executed just once. It is totally in run-times control & not sure of when this will be executed. But, it is assured that it will be executed before creating instance of the class.

Answered by: Aashish Chachra on: Mar 2nd, 2012

A class can have only one static constructor. Static constructor can not have any parameter. Static constructor cannot have any access specifier, not even private. It is used to initialize the static ...

When to use string classes

Asked By: sushil_gupta | Asked On: Jan 17th, 2011

When we have string builder which are mutable why we need immutable string classes in c#.

Answered by: Sivavt on: Mar 25th, 2012

String is immutable, meaning, if there is any change in the string value, run time allocates new memory & assign it to the string reference. For the programmer, it looks like the same string but inter...

Answered by: anupamsh on: Mar 7th, 2012

This is how I would answer: 1) Strings are immutable and once created, cannot be changed. Hence, strings are best used in cases when you need thread safety and features where strings will not change,...

Properties in c#

Asked By: Velvizhi.Sadanah | Asked On: Feb 6th, 2012

What are properties in c#? What are the advantages of using properties ?

Answered by: Sivavt on: Mar 25th, 2012

Properties combine the behavior of method & variable.

Answered by: Lokesh M on: Feb 9th, 2012

Properties are members of classes. They are also used in structs and interfaces. Properties are an extension of fields but they do not designate storage locations. Properties provide a flexible mech...

How do I get deterministic finalization in c#?

Asked By: Interview Candidate | Asked On: Sep 13th, 2004

In a garbage collected environment, it's impossible to get true determinism. However, a design pattern that we recommend is implementing idisposable on any class that contains a critical resource. Whenever this class is consumed, it may be placed in a using statement, as shown in the following example:...

Answered by: anupamsh on: Mar 7th, 2012

That is true. A class implementing the interface IDisposable can be used in the using statement, something like: "c# using (MyClass objMyClass = new MyClass()) { objMy...

What is encoding and serialization in .Net?

Asked By: wenkat40 | Asked On: Mar 4th, 2011

Answered by: ffiv77 on: Feb 20th, 2012

Serialization is the process of converting an object into a stream of bytes in order to persist it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.

Answered by: Devender Thadkapalli on: Nov 28th, 2011

Encoding is a Format, it could be binary or soap or MTOM

How can you sort the elements of the array in descending order

Asked By: Interview Candidate | Asked On: Jan 1st, 2006

A) sort methodsb) reverse methodsc) by calling sort and then reverse methodsd) can’t sort in descending

Star Read Best Answer

Editorial / Best Answer

Answered by: Prakhar

Answered On : Apr 12th, 2006

        int[] arr = new int[3];
        arr[0] = 4;
        arr[1] = 1;
        arr[2] = 5;

        Array.Sort(arr);
        Array.Reverse(arr);

Answered by: maniekb on: Feb 2nd, 2012

This is more elegant and efficient? Disagree.

Answered by: rfb99 on: Dec 16th, 2011

It is far more elegant and efficient to do something like

Array.Sort(arr, delegate(int x, int y) { return y.CompareTo(x); });

Abstract usage in c#

Asked By: raghavendra1267 | Asked On: Nov 3rd, 2011

Can any one give real time example for abstract class and virtual function plz in c#(.Net)

Answered by: cse.jai on: Jan 20th, 2012

An abstract class is a class that cannot be instantiated. The purpose of an abstract class is to provide a common definition of a base class that multiple derived classes can share. For example, a cla...

Which are the important features of il

Asked By: Interview Candidate | Asked On: Jan 1st, 2006

A) use of attributesb) strong data typingc) object orientation & use of interfaced) all of the above

Answered by: Devender Thadkapalli on: Nov 28th, 2011

All of the above

Answered by: Priya Kollu on: Nov 25th, 2011

D all of the above

What is late binding and early binding? What is the benefits and disadvantages of using them?

Asked By: BostonCow | Asked On: Apr 3rd, 2007

Answered by: Devender Thadkapalli on: Nov 28th, 2011

Early binding is better. You can make your objects strongly type and resolve the errors if any at compile time instead of runtime

Answered by: Suresh Jayaraman on: Sep 30th, 2011

The polymorphism is achieved by early binding and late binding Early Binding: Compiler bind the objects to methods at the compile time.This is called early binding or static binding.Function overloa...

Which of the following is used to denote comments in c#?

Asked By: Interview Candidate | Asked On: Nov 27th, 2005

Skill/topic: intermediatea) /* */b) //c) ///explanation: /// is used from XML documentation

Answered by: Yelnik Nidup on: Nov 18th, 2011

// and /* */

Answered by: sahilpopli on: Nov 10th, 2011

A) /*Is used for multiple
lines omments */
// and
B) // is used for singlr line comment

All types in c# implicitly derive from

Asked By: Interview Candidate | Asked On: Nov 27th, 2005

Skill/topic: beginnera) system.Object classb) system classc) system.Csharp class

Answered by: Anujan on: Nov 6th, 2011

From the System.Object class is correct, all value types derive from System.Value Type which in-turn derives from System.Object.

Answered by: samiksc on: Dec 7th, 2005

(A) System.Object class

Which of the following is not a member of system.Object?

Asked By: musclebai | Asked On: Feb 7th, 2008

A)instance equalsb)static equalsc)instance referenceequalsd)instance gettype

Answered by: LordAlex on: Nov 5th, 2011

Instance equals - because Object has instance Equals

Instance referenceequals - because Object has static ReferenceEquals

Instance Gettype - because Object has instance GetType

Answered by: sajja.babu on: Jan 7th, 2010

StaticEquals and ReferenceEquals are not members of instance class object

C# data table multiple rows

Asked By: manisha.varshney | Asked On: Apr 13th, 2010

You have multiple rows in c# data table and you have to save it in database using just one call, how will you do it?

Star Read Best Answer

Editorial / Best Answer

Answered by: LordAlex

View all answers by LordAlex

Member Since Nov-2011 | Answered On : Nov 5th, 2011

In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to: 1. Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter. 2. Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects. 3. Invoke the GetChanges method to create a second DataSet that features only the changes to the data. 4. Call the Update method of the DataAdapter, passing the second DataSet as an argument. 5. Invoke the Merge method to merge the changes from the second DataSet into the first. 6. Invoke the AcceptChanges on the DataSet. Alternatively, invoke RejectChanges to cancel the changes.

Answered by: LordAlex on: Nov 5th, 2011

In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to: 1. Build and fill each DataTable in a DataSet with data fro...

Answered by: rabipatra_k on: Jul 22nd, 2010

We can also use bulk upload functionality of CSharp

What is the advantage of serialization ?

Asked By: Ranjith | Asked On: Nov 10th, 2005

Answered by: jaya on: Nov 4th, 2011

Serialization is a process of converting an object into a stream of data so that it can be is easily transmittable over the network or can be continued in a persistent storage location.

Answered by: san82 on: Apr 15th, 2009

Serialization in .NET allows the programmer to take an instance of an object and convert it into a format that is easily transmittable over the network, or even stored in a database or file system. Th...

Which method is actually called ultimately when console.Writeline( ) is invoked

Asked By: Interview Candidate | Asked On: Jan 1st, 2006

A) append( )b) appendformat( )c) tostring( )

Answered by: LordAlex on: Nov 4th, 2011

Does some one dig the code with Reflector?? In deed, according the Reflector, see code.... it's clear only ToString() can be called. "c# public virtual void System.TextWriter....

Answered by: Seeker911 on: Jun 15th, 2011

The answer is C

Ultimately ToString() is called. Depending on what overload is used when calling Console.WriteLine() either Append or AppendFormat will be called called then ToString()

In c# events are actually a special form of delegates

Asked By: Interview Candidate | Asked On: Jan 1st, 2006

A) trueb) false

Answered by: LordAlex on: Nov 3rd, 2011

An event is a member that enables a class or object to provide notifications. An event is declared like a field except that the declaration includes an event keyword and the type must be a delegate ty...

Answered by: vishnupavadi on: Aug 8th, 2011

False

event is an instance of delegate which is used to notify some action of an object to other object.

Explain the advantages and limitations of using aliases in c#?

Asked By: sophiya_261978 | Asked On: Aug 24th, 2007

Answered by: LordAlex on: Nov 3rd, 2011

C# provides a set of predefined struct types called the simple types. The simple types are identified through reserved words, but these reserved words are simply aliases for predefined struct types in the System namespace.
{sbyte, byte, short, ushort, int, uint, long, ulong, and char}

Answered by: PeterVH on: Aug 19th, 2011

Well, it is needed if for some reason you have conflicting names. Silly example, but suppose you declare a variable with the name DateTime, and to be very funny (sarcasm) you also define a variable na...

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.