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 (33)
 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 ?    31 Yes 2 No
Neeraj Kumar Shrivastwa
 
Answer
# 2
No. 
Is This Answer Correct ?    40 Yes 19 No
Vishalsharma
 
 
 
Answer
# 3
No,we cannot store multiple datatype in Array.we can store
similar datatype in Array.
 
Is This Answer Correct ?    30 Yes 10 No
Satyadarshi
 
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
 
If we inherit a class do the private variables also get inherited ? TCS 6
Can we create instance for Abstract class? HCL 28
i have a table named login in mysql database containing (empid,fname,lname,mobno,emailid,usrname,usrpwd) i have 2 textboxes in which i enter my username and pwd..so based on what is entered in those textboxes it should retreive all other details of dat username in the remaining 6 textboxes..i want the code for this... Royal-Enfield 1
What is a pre-requisite for connection pooling?   2
Trace the O/p for a program on inheritance and Polymorphism. 3 classes A,B,C A with two methods public virtual SomeMethodA public virtual SomemoreMethodA B:A overide virtual SomeMethodA C:B new Method SomeMethodA override SomeMoreMethodA main method { b new instance of B b.SomeMethodA b.SomeMoreMethodA b1 new instance of C b1.SomeMethodA b1.SomeMoreMethodA }   1
Hi Everyone, the design of the form disappear during writing codes for dataset and data grid. The error show in "line of assigning dataset". I don't know what's happen. If anyone know , please share of technical help from someone. Thanks, Horace Trever   1
How?s method overriding different from overloading?   4
If i have 100 objects in my application are out of scope.when first time garbage collected how many objects memory reference are free? ITC-Infotech 2
What is abstract class ? Digital-GlobalSoft 5
What is the use of multicast delegate while methods of multicast delegate do not execute in a order?   2
Can you allow class to be inherited, but prevent the method from being over-ridden? Mind-Tree 2
What are virtual methods? How are they used? TCS 3
 
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