ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Microsoft Related >> C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions (615)
 C Sharp interview questions  C Sharp Interview Questions (722)
 ASP.NET interview questions  ASP.NET Interview Questions (1444)
 VB.NET interview questions  VB.NET Interview Questions (151)
 COM+ interview questions  COM+ Interview Questions (41)
 ADO.NET interview questions  ADO.NET Interview Questions (199)
 IIS interview questions  IIS Interview Questions (86)
 MTS interview questions  MTS Interview Questions (5)
 Crystal Reports interview questions  Crystal Reports Interview Questions (62)
 BizTalk interview questions  BizTalk Interview Questions (34)
 Dot Net interview questions  Dot Net Interview Questions (861)
 Exchange Server interview questions  Exchange Server Interview Questions (103)
 SharePoint interview questions  SharePoint Interview Questions (25)
 WCF interview questions  WCF Interview Questions (8)
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions (193)
Question
Can you store multiple data types in System.Array?
 Question Submitted By :: C-Sharp
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
If you take an array of object, you can store multiple data
type in an array.
object[] obj = new object[4];
obj[0]=1;
obj[1]="Neeraj";
obj[2]=true;
obj[3]=System.DateTime.Now;
 
Is This Answer Correct ?    32 Yes 2 No
Neeraj Kumar Shrivastwa
 
Answer
# 2
No,we cannot store multiple datatype in Array.we can store
similar datatype in Array.
 
Is This Answer Correct ?    32 Yes 10 No
Satyadarshi
 
 
 
Answer
# 3
No. 
Is This Answer Correct ?    40 Yes 19 No
Vishalsharma
 
Answer
# 4
Yes you can, if you have an object array. since
System.Object is the base class of all other types, an item
in an array of Objects can have a reference to any other
type of object.
 
Is This Answer Correct ?    19 Yes 1 No
Tsahi
 
Answer
# 5
What payal has mentioned is absolutely right. Array doesnt
store different datatypes. but ArrayList can store
different types of datatype in a single object.
 
Is This Answer Correct ?    11 Yes 1 No
Vishal Shah
 
Answer
# 6
S, Use Generic lists. 
Is This Answer Correct ?    5 Yes 2 No
Uma
 
Answer
# 7
No,we cannot store multiple datatype in Array.we can store
similar datatype in Array,but i think that we can store in
ArrayList class in c#.
 
Is This Answer Correct ?    8 Yes 6 No
Payal Mehta
 
Answer
# 8
no..we cant ..only similar data types in an array.
but we can store in ArrayList
 
Is This Answer Correct ?    5 Yes 3 No
Ann
 
Answer
# 9
yes, if array type is specified as object 
Is This Answer Correct ?    2 Yes 0 No
Abc
 
Answer
# 10
Ok, so here is the catch:

An array of objects can store different datatype members -
object[] ar = new object[3];
ar[0] = "test";
ar[1] = 56;

An arraylist can also be used for this purpose -
ArrayList arr = new ArrayList();
arr.Add(56);
arr.Add("ASDf");

And a generic list too can be used for this purpose -
List<object> llst1 = new List<object>();
llst1.Add(56);
llst1.Add("ASDf");
 
Is This Answer Correct ?    2 Yes 1 No
Vishal
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
What debugging tools come with the .NET SDK? CorDBG   1
How to throw an caught exception from cath block? TCS 3
About delegates and events? ADITI 2
how to communicate inventory system and account system?   1
Whats the use of string builder? ADITI 1
why sturcture ? why class?why you prefer structure and in which cases u go for class? Microsoft 1
How can you clean up objects holding resources from within the code? Wipro 4
Wats the diff between sealed class and private class in inheritance iSoft 7
t name of controls, which are displayed same in all browers? TCS 1
When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)? Mind-Tree 2
can we declare a variable by name "this" in a class? Please explain? IBM 3
What is Nullable Type in c# IBM 5
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com