1.What is an Array ? What are different ways of writing an Array ?
Array is a datastructure that stores a collection of value that are of same data type.
diff ways of writing an array are-
a)specify the data length in declaration.
int [] count= new int[5];
b) int[] count = new int[] { 1, 2, 3 };
skip the length but have to specify the value.
c)int[] count = new int[2] { 1, 2, 3 };
both a and b. one thing should be taken care here the length of int array should be equal
to number of values specified.
Array is a datastructure that stores a collection of value that are of same data type.
diff ways of writing an array are-
a)specify the data length in declaration.
int [] count= new int[5];
b) int[] count = new int[] { 1, 2, 3 };
skip the length but have to specify the value.
c)int[] count = new int[2] { 1, 2, 3 };
both a and b. one thing should be taken care here the length of int array should be equal
to number of values specified.
2.Array is reference type or value type ?
Reference Type
Reference Type
3.How do you search an item in an Array ?
The BinarySearch static method of Array class can be used to search for an item in a array. . The method takes at least two parameters - an array and an object (the item you are looking for). If an item found in an array, the method returns the index of the item (based on first item as 0th item), else method returns a negative value.
eg-
string[] name = new string[] { "chai", "alex", "dave" };
string[] name = new string[] { "chai", "alex", "dave" };
int i=Array.BinarySearch(name, "dfsdf");
4.How to achieve Deep copy and Shallow copy using Array ?
Deep Copy-- By using Array.CopyTo
Shallow Copy---Array.Clone()
Deep Copy-- By using Array.CopyTo
Shallow Copy---Array.Clone()
5.What are different types of an Array ?
a) Single dimensional Array
b) Multidimensional Array
c) Jaggd Array
a) Single dimensional Array
b) Multidimensional Array
c) Jaggd Array
6.Can diff data types be stored in a single Array?
No
No
7.Where does array index starts ?
Array index starts at Zero.
Suppose you have int [] count= {1,2,3} then
int[0] will give you "1".
Array index starts at Zero.
Suppose you have int [] count= {1,2,3} then
int[0] will give you "1".
8.Give an example of accessing Array using foreach loop.
string[] name = new string[] { "chai", "alex", "dave" };
foreach (string a in name)
{
Console.WriteLine(a.ToString());
}
string[] name = new string[] { "chai", "alex", "dave" };
foreach (string a in name)
{
Console.WriteLine(a.ToString());
}
9. How do you sort an item in Array in reverse order ?
Use Count and Reverse property of an array.
eg-
int[] count = new int[] { 1, 2, 3,6,8,4 };
Array.Sort(count);
Array.Reverse(count);
10.Find the maximum no in an array.
you can use the property of array called Max or use the below algo-
Suppose you have a arraylist say with 3 string values- a[0]-name,a[1]-age,a[2]-gender.After converting using below code it will look like
string.Join(",",(string[])a.ToArray(typeof(string)))
string a=name,age,gender
Use Count and Reverse property of an array.
eg-
int[] count = new int[] { 1, 2, 3,6,8,4 };
Array.Sort(count);
Array.Reverse(count);
10.Find the maximum no in an array.
you can use the property of array called Max or use the below algo-
11.Convert arraylist to string array
string.Join(",",(string[])a.ToArray(typeof(string)))
string a=name,age,gender
AllitTechnologies Interview Question and Answers
ReplyDeleteDotnet Interview Question and Answers
6.Can diff data types be stored in a single Array?
ReplyDeleteIts yes, it can be stored
Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article. thank you for sharing such a great blog with us.
ReplyDeletemicrosoft azure training in bangalore
rpa training in bangalore
best rpa training in bangalore
rpa online training
This comment has been removed by the author.
ReplyDeleteThanks For Sharing Your Information Please Keep UpDating Us The Information Shared Is Very Valuable Time Went On Just Reading The Article Python Online Training Devops Online Training
ReplyDeleteAws Online Training DataScience Online Training
Hadoop Online Training
Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
ReplyDeleteData Science training in Chennai
Data science training in Bangalore
Data science online training
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteData Science Training in Bangalore
Data Science Training institute in Bangalore
Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
ReplyDeleteSelenium training in chennai
Selenium training in bangalore
Selenium training institute in bangalore
I was looking for this certain information for a long time. Thank you and good luck.
ReplyDeletedevops online training
aws online training
data science with python online training
data science online training
rpa online training
I really like your blog. You make it interesting to read and entertaining at the same time. I cant wait to read more from you.
ReplyDeleteDevOps Training in chennai
DevOps Training in Bangalore
Tableau Training in Chennai
Tableau Training in Bangalore
I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
ReplyDeleteartificial Intelligence course
machine learning courses in mumbai
i am enjoyed while reading your article. Thank you so much for this incredible guide, Keep Sharing
ReplyDeleteAWS Training in Hyderabad
ReplyDeleteThe Content You Shared With Us Is Excellent & Extraordinary Useful to all Aspirants Thanks For Sharing With Us!
Best Degree College In Hyderabad
Top Degree College In Hyderabad
Top And Best BBA College In Hyderabad
Top And Best B.Com College In Hyderabad
The context has been explained really well. Looking forward to see more of such informative updates.Thank you For Sharing this Blog. The Blog is really Impressive Fetch the Information easily from this Content.
ReplyDeleteData Science Training In Chennai
Data Science Online Training In Chennai
Data Science Training In Bangalore
Data Science Training In Hyderabad
Data Science Training In Coimbatore
Data Science Training
Data Science Online Training
I perceived a lots of new Technical things in this wonderful site.Unique information's are shared through it.Keep working Like this...
ReplyDeleteSalesforce Training in Chennai
Salesforce Online Training in Chennai
Salesforce Training in Bangalore
Salesforce Training in Hyderabad
Salesforce training in ameerpet
Salesforce Training in Pune
Salesforce Online Training
Salesforce Training
I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the best of luck for all your blogging efforts.
ReplyDeletemachine learning courses in bangalore
Thanks For sharing a nice post about all Course.It is very helpful and for us.
ReplyDeleteWorkday training in bangalore
Thanks for sharing a useful info. I would also suggest for Data Science course with Real time experience, visit: https://socialprachar.com/data-science-training-in-bengaluru/
ReplyDeleteif ur interested in learning AWS course please visit our websiteAWS Training in Hyderabad
ReplyDeleteThe AWS certification course has become the need of the hour for freshers, IT professionals, or young entrepreneurs. AWS is one of the largest global cloud platforms that aids in hosting and managing company services on the internet. It was conceived in the year 2006 to service the clients in the best way possible by offering customized IT infrastructure. Due to its robustness, Digital Nest added AWS training in Hyderabad under the umbrella of other courses.
ReplyDeleteReally fantastic blog. Informative and knowledgeable content. This blog is useful to many people. Keep sharing more stuff like this. Thank you.
ReplyDeleteData Science Training
I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.
ReplyDeletedata science training institute in hyderabad
Thank you for sharing your knowledge and expertise with the community. Start on a AWS journey.
ReplyDelete