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


Top 5 Contributors of the Month
david stephan

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

Difference between Array and ArrayList?

Posted By :Vinodh     Posted Date :September 18, 2011    Points :40   Category :C# 
An array can contain only one data type ,where as an Array list can contain any data type in the form of object

Array cannot dynamically increase or decrease its size, where as Array list can

You can also find related Interview Question to Difference between Array and ArrayList?  below: 

What is the difference between arraylist and array classes ?

  
arraylist size can be dynamically increased where as array size can't be increased. (More...)

What is the difference between ARRAY and STACK?

  
STACK follows LIFO. Thus the item that is first entered would be the last removed.

In array the items can be entered or removed in any order. Basically each member access is done using index. No strict order is to be followed here to remove a particular element. (More...)

What's the difference between the System.Array.CopyTo() and System.Array.Clone() in c#?

  
The first one performs a deep copy of the array, the second one is shallow. (More...)

What's the difference between the System.Array.CopyTo() and System.Array.Clone()?

  
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object. (More...)

What's the difference between the System.Array.CopyTo() and System.Array.Clone()?

  
The first one performs a deep copy of the array, the second one is shallow. (More...)

What are the similarities between an array and an ArrayList?

  
The following are the similarities between an array and an ArrayList:

- Both array and ArrayList can have duplicate elements in them.
- Both are unordered lists.
- Both uses index to refer to their elements.
- Both supports null values (More...)

What is the difference between Array List and Array?

  
Array List:
1] Array List belongs to System.Collection namespace.
2] Size of the array can be increase and decrease
3] Can contain different types of data.


Arrya:
1] Array belongs to System namespace.
2] Size is fixed.
3] Can contain only one type of value. (More...)

What's difference between HashTable and ArrayList ?

  
Array can be accessed using INDEX value. Hashtable provides way of accessing the index using a KEY value, thus removing the INDEX problem. (More...)

Difference between the System.Array.CopyTo() and System.Array.Clone()?

  
System.Array.CopyTo() : Deep a Copy of the Array
System.Array.Clone(): shallow (More...)

What is the difference between the Array.Clone() and Array.CopyTo() ?

  
Array.Clone -- method returns a new array object containing all the elements in the original array.
Array.CopyTo -- method copies the elements into another existing array. (More...)

What is the difference between the System.Array.CopyTo() and System.Array.Clone()?

  
Clone() : method returns a new array (a shallow copy) object containing all the elements in the original array.
CopyTo() : method copies the elements into another existing array.

Both perform a shallow copy.

A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.

A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object. (More...)

Difference Between Delete and Truncate

  
.Delete table is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow.

. Truncate table also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the de-allocation of the data pages of the table, which makes it faster. Of course, truncate table cannot be rolled back.

. Truncate table is functionally identical to delete statement with no "where clause" both remove all rows in the table. But truncate table is faster and uses fewer system and transaction log resources than delete.

. Truncate table removes all rows from a table, but the table structure and its columns, constraints, indexes etc., remains as it is.

. In truncate table the counter used by an identity column for new rows is reset to the seed for the column.

. If you want to retain the identity counter, use delete statement instead.

. If you want to remove table definition and its data, use the drop table statement.

. You cannot use truncate table on a table referenced by a foreign key constraint; instead, use delete statement without a where clause. Because truncate table is not logged, it cannot activate a trigger.

. Truncate table may not be used on tables participating in an indexed view. (More...)

Difference between assembly manifest & metadata?

  
assembly manifest - An integral part of every assembly that renders the assembly self-describing. The assembly manifest contains the assembly's metadata. The manifest establishes the assembly identity, specifies the files that make up the assembly implementation, specifies the types and resources that make up the assembly, itemizes the compile-time dependencies on other assemblies, and specifies the set of permissions required for the assembly to run properly. This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.

metadata - Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on. This can include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime. (More...)

What is the difference between ref & out parameters?

  
An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter. (More...)

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