?
Solved

Review my answers on arrays

Posted on 2006-06-15
1
Medium Priority
?
180 Views
Last Modified: 2010-04-16

//1. Create an array of integers named MyIntegerArray, and make it so that it will hold ten elements.  Do this on one line of code.  1.2

int [] MyIntegerArray = new int [10];

//2. Create an array of strings with the name MyStringArray, and give it a holding capacity of seventeen strings.  Do this with two lines of code.  1.2

String [] MyStringArray;
MyStringArray = new String[17];

//3. Create an implicitly sized string array called Beatles, with the elements John, Paul, George, and Ringo.  1.2

String [] Beatles = {"John"," Paul", "George", "Ringo"};

//4. Use Sort on your Beatles array to put the names in alphabetical order.  1.3

Array.Sort(Beatles);

//5. Call the IsSynchronized property for any of the arrays you created and check to see if they are threadsafe.  1.3

if (MyIntegerArray.IsSynchronized)
    if (MyStringArray.IsSynchronized)
        if (Beatles.IsSynchronized)


//6. Write the code for a loop that will go through an array and load elements into it.  1.3

            for (int i = 0; i < MyIntegerArray.Length; i++)
                MyIntegerArray[i] = i;

//7. Create a four dimensional rectangular array of integers.  1.4

int [,,,] FourDimensionalArray = new int[3,3,3,3];


//8. Create a two dimensional, ragged array of integers.  1.4

int [][] TwoDimensionalArray = new int[3][];
0
Comment
Question by:noam_dz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 400 total points
ID: 16918832
They all look correct to me.

As with all things the best way to check is to build them into a test app and make sure they all function as expected.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question