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
 
datagridview using updata in windows c#   1
Which CSS property can be used for controlling the stretchiness of a control? TCS 1
i want display a given number into Rupees Format Like Given number is : 156735 my Expected output is 1,56,735. how to display?   6
C# is case sensitive, what is mean by case sensitive   3
how can include .netframeworl 2.0 in application setup   1
give an example for suspending, resuming, and stopping a thread ? GCI 1
What does the parameter Initial Catalog define inside Connection String?   5
What?s the difference between the System.Array.CopyTo() and System.Array.Clone()? Wipro 6
I am using a data table and a datagridview. I am creating two columns in data grid view : 1)DataGridViewComboBoxColumn 2)DataGridViewTextBoxColumn. The items of datagridviewcombo are the list of all items in data table column 1. I want that the data type of the DataGridViewTextBoxColumn should be the same as the data type of the item selected from the datagridviewcombo at runtime. How can I do that.Also I want that each cell in column of datatable should be of variable data type. Pls help. thnx. Storm 1
What is the functionality of break and continue in Visual Studio? JPMorgan-Chase 2
OOPs concept ? MMTS 1
how can i return string by vilating duplicates(inpyt like asdfsda but output should be 2a2d2sf and 2a,2d,2s,f) Microsoft 2
 
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