# Exam coming up, I have questions I need help answering.

I have an upcoming exam and I don't have access to my professor and I have questions that the book is not clarifying for me.  The book that the class is using is Murach's Visual Basic 2008.

iI will list the questions will by numbers.  I understand that there are alot of questions here but I really need a good grade on this exam and these are the areas that I am still unsure of.  Some of the questions, I have tried to answer and I posted a comment in (), it my guess is correct could you annotate so.  If not could you help me get on base.

I am taking the exam tomorrow at 11.  I have been buried in this book for a couple of days now and I need help.  I am using this site as a last resort.  I figured individuals on here are much more proficient than myself so I mine as well ask the experts.

I want to thank anyone in advance that is willing to answer any of these questions for me.  God Bless and Happy Veterans Day.  I myself am an "Iraq Veteran" in 2003.

10.  A Sub procedure that converts an array of inches to an array of centimeters
Private Sub ConvertToEven( _
ByRef measurements() As Double)
For i As Integer = 0 To measurements.Length - 1
measurements(i) *= 2
Next
End Sub

' Statements that declare an array and call the procedure
Dim measurements() As Double = {1, 2, 3}
Me.ConvertToEven(measurements)

What are the values of measurements()???

-  Again, I have no idea how to work this?

10.  Code that uses an index to access a character in a string
Dim chars As String = "abcdefg"
Dim a As Char = chars(0)               ' a = "a"
Dim b As Char = chars(1)               ' b = "b"
Dim c As Char = chars (4)               c = ??? (2)  Is this correct, 4 would be "e"?
String must be an array??? Yes or NO, why?
-  I don't understand the question.

11. Code that uses a For Each loop to access each character in the string
Dim chars As String = "abcdefg"

Dim charsAndSpaces As String = ""
For Each c As Char in chars                      (WHAT DOES THE "c" MEAN IN THIS STATEMENT?)
charsAndSpaces &= c & " "
Next
MessageBox.Show(charsAndSpaces, "String Test")

12. Insert(startindex, string)
Returns a string with the specified string inserted beginning at the specified position.

-  There isn't an example of this, can someone code an example?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Project managerCommented:
10. Sub-procedure. In this procedure, we'll loop the array. For each value in the array, we will multiply it with 2 (*= 2). The result will look like this
measurements(0) = 2
measurements(1) = 4
measurements(2) = 6

10.  Code that uses an index to access a character in a string
Dim chars As String = "abcdefg"
Dim a As Char = chars(0)               ' a = "a"
Dim b As Char = chars(1)               ' b = "b"
Dim c As Char = chars (4)   --> this will contain e
--> the character at the 5th position of the string (because an array starts from 0)
chars(0) --> a
chars(1) --> b
chars(2) --> c
chars(3) --> d
chars(4) --> e
chars(5) --> f
chars(6) --> g

11. Code that uses an index to access a character in a string
Output will be: "a b c d e f g "
charsAndSpaces &= c & " " --> each time when we have a char (a, b, ...), we will add it together with a space to the string
When we break the loop in pieces we will see the string growing like this:
""
"a "
"a b "
"a b c "
...
Author Commented:
so what i am understanding in 11 is that the code is just saying create a string with abcdefg and put a space in between each character?  That's it?  Dang that was too easy.

I am still unsure of 12 though.  Any help?  You have rocked every section so far.  You would ace this test!  Heck, you probably could teach the class.
Project managerCommented:
>> so what i am understanding in 11 is that the code is just saying create a string with abcdefg and put a space in between each character?  That's it?  Dang that was too easy.
Correct

>> 12. Insert(startindex, string)
Returns a string with the specified string inserted beginning at the specified position.
Examples: see http://msdn.microsoft.com/en-us/library/system.string.insert.aspx

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.