Cashback Offer from 22nd to 27th July 2021. Get Flat 20% Cashback credited to your account for a minimum transaction of \$50. Post Your Question Today!

Question DetailsNormal
\$ 30.00

# Chapter 5 Written Questions (For-Loops & Strings) answers A+ 100% Satisfaction Guaranteed!

Question posted by

Chapter 5 Written Questions (For-Loops &amp; Strings)
1. Answer questions (a) through (c) based on code below.
Dim num As Integer Dim sum As Integer For num = 1 To 3 sum = sum + num Next num
Me.outLabel.Text = sum

a) How many times does the body of the loop execute?
b) What is the output (value assigned to Text property of outLabel)?
c) What is the final value of num?
2. Answer questions (a) through (c) based on code below.
Dim num As Integer
Dim sum As Integer
For num = 1 To 5 Step 2
sum = sum + num
Next
Me.outLabel.Text = sum

a) How many times does the body of the loop execute?
b) What is the output (value assigned to Text property of outLabel)?
c) What is the final value of num?
3. Answer questions (a) through (c) based on code below.
Dim num As Integer
Dim sum As Integer
For num = 1 To 3 Step -1
sum = sum + num
Next
Me.outLabel.Text = sum

a) How many times does the body of the loop execute?
b) What is the output (value assigned to Text property of outLabel)?
c) What is the final value of num?

4. Answer questions (a) through (c) based on code below.
Dim num As Integer
Dim sum As Integer
For num = 3 To 1 Step -1
sum = sum + num
Next
Me.outLabel.Text = sum

a) How many times does the body of the loop execute?
b) What is the output (value assigned to Text property of outLabel)?
c) What is the final value of num?
5. Most of the variable types we have used like Integer and Double are referred to as primitive data types. Is
the String type also primitive? If not, what is it? No. JavaScript automatically converts primitives to
String objects, so that it's possible to use String object methods for primitive strings. In contexts
where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will
automatically wrap the string primitive and call the method or perform the property lookup.
6. What operator (character) is used to combine strings? Show the character and list its name. the

concatenation operator //

7. Write the assignment statement that concatenates two strings named firstNameString and lastNames with
a space between the two. Assign the results to fullNameString.

string firstname, lastname, fullname;
cout &lt;&lt; &quot;First name: &quot;;
getline (cin, firstname);
cout &lt;&lt; &quot;Last name: &quot;;
getline (cin, lastname);
fullname = lastname + &quot;, &quot; + firstname;
cout &lt;&lt; &quot;Fullname: &quot; &lt;&lt; fullname &lt;&lt; endl;
8. Consider the statement: str1 = &quot;Code Wars&quot; What value is assigned to the variables in the
statements?
a) newl = str1.ToLower
b) new2 = str1. Substring (0, 4)
c) new3 = (str1.ToUpper).Substring(3, 4)
d) posl = str1.IndexOf(&quot;d&quot;)
e) pos2 = str1.IndexOf(&quot;WARS&quot;)
9. Determine if each of the following is true or false. (1 point each)
a) The counter in a For...Next statement is always incremented or decremented by 1.
b) The String data type is a primitive data type.
c) A string can be changed by methods of the String class.

d) vbTab is a variable that allows the programmer to control the spaces in a string.
e) The Unicode value for an uppercase letter is the same for the corresponding lowercase letter.
f) A wildcard character is a ?, * or #, which matches an unknown character or group of characters.

Exercises
Average Sequence Sum (
Use a for-next loop to average the sum of every seventh number from 3 to a final value the
user enters into a texbox (3 + 10 + 17 ...). You will need a counter variable and an
accumulator variable. Make sure you validate input to ensure entry is numeric, and that the
user enters a valid number above 3.

Exercise 12 Count Vowels pg 159
Create a CountVowel Application that counts the number of vowels in a word or phrase.
The application interface should look similar to:
Hint: Use the Chars() property of the String class within the body of a loop to access the
individual letters of the string. The counter variable of your loop will be the index of the
Chars() property. Example:
currentChar = inputString.Chars(count)
Then test currentChar in an If statements to see if it is equal to &quot;A&quot;, &quot;E&quot;, &quot;I&quot;, &quot;O&quot;, or &quot;U&quot;. If so,
increment a vowel counter.
def main():
vowels = ['a','e','i','o','u']
numberOfVowels =
phrase = raw_input(&quot;Input a word/phrase:&quot;)
print &quot;Number of Vowels:&quot;
for i in range(len(vowels)):
numberOfVowels.append(phrase.c... + phrase.count(vowels[i].upper()))
main()
---edit--don't know why that line shortened...it was the following all on one line:
numberOfVowels.append(
phrase.count(vowels[i].lower() ) +
phrase.count(vowels[i].upper() ) )

1. Explain the similarities and differences between parameters and arguments.

2. Write a line of code that:
a) calls a procedure named Contains() that has two value parameters named fullString and PartString and a
reference parameter named foundBoolean. (2 points)
b) contains the Sub procedure heading (first line) for the Call statement in part (a).
3. List the contents of the message box output in the order of execution for the following code.
Private Sub Button1_Click()
Dim intNum1 As Integer
Dim intNum2 As Integer
intNum1 = 1
intNum2 = 2
Call Proc1(intNum1, intNum2)
MessageBox.Show(&quot;In Button Event Procedure:&quot; &amp; intNum1 &quot;, &quot; &amp; intNum2)
End Sub
Private Sub Proc1(ByVal intA As Integer, ByVal intB As Integer)
intA = intA + 2
intB = intB + 5
MessageBox.Show(&quot;In Proc1: &quot; &amp; intA &amp; &quot;, &quot; &amp; intB )
End Sub

4. List the contents of the message box output in the order of execution for the following code.
Private Sub Button1_Click()
Dim intNum1 As Integer
Dim intNum2 As Integer
intNum1 = 1
intNum2 = 2
Call Proc1(intNum1, intNum2)
MessageBox.Show(&quot;In Button Event Procedure: &quot; &amp; intNum1 &quot;, &quot; &amp; intNum2)
End Sub
Private Sub Proc1(ByRef intA As Integer, ByVal intB As Integer)
intA = intA + 2
intB = intB + 5
MessageBox.Show(&quot;In Proc1: &quot; &amp; intA &amp; &quot;, &quot; &amp; intB )
End Sub

5. Determine if each of the following is true or false.
a) A Sub procedure must always be declared with parameters.
b) A procedure can call another procedure.
c) Arguments passed by value must be in the form of a constant.
d) A ByRef parameter only exists for the duration of a procedure.
e) A ByRef parameter uses the same memory location as the argument it is
passed.
f) A control object, such as a textbox or label, can be passed to a
procedure as an argument.
g) The parameters sender and e are optional in an event handler procedure.
h) A Click event procedure can be coded to handle multiple events for more than one control object.
i) Only the Button control has a Tag property.
j) A Call statement must be used in order to execute any type of procedure.

Exercises
String Sort (not in text)
Create a program that obtains two strings within text boxes entered by a user and stores
them to variables. Send the two variables as arguments to a Sub Procedure called
SortStrings() that compares the strings and orders them so the first variable always contains
the &quot;lower&quot; string. After the Sub completes, from the event-procedure that called the
SortStrings() procedure, display the two variables in a label on the form in the correct order.
The event-procedure should do input, calling of SortString(), and output, and the
SortStrings() Sub Procedure should do the sorting, but not the input or output.
Submit a listing of the code and a working form that displays input and output.
Exercises
Phone Bill Exercise
Create a PhoneBill application that determines a phone bill by propting the user for calling
options (call waiting, call forwarding, and caller ID). The monthly basic service charge is
25.00 and each additional calling option is \$3.50. The application interface should look
similar to the following after selecting options and clicking Calculate:
Perform the problem as described, but assign costs to options as follows:
Call Waiting: \$2.50
Call Forwarding: \$3.00
Caller ID: \$5.00
Do not use a button. Have the Total label update whenever the user clicks one of the check
boxes. This is not a looping problem, but stresses accumulator variable concepts. The

accumulator variable will need to be declared module-level. You may use either the
CheckChanged event or the Click event of each CheckBox control to test if each CheckBox
is checked or not checked.
The CheckChanged or Clik event occurs regardless of whether the CheckBox goes from
checked to unchecked, or from unchecked to checked. When the CheckBox is checked, the
associated charge is added to the total. When unchecked, the associated charge is to be
deducted from the total.
Average Sequence Sum
Use a do-while loop to average the sum of every seventh number from 3 to a final value the
user enters into a texbox (3 + 10 + 17 ...). You will need a counter variable and an
accumulator variable.
Make sure you validate input to ensure entry is numeric, and that the user enters a
valid number above 3.

\$ 30.00

## [Solved] Chapter 5 Written Questions (For-Loops & Strings) answers A+ 100% Satisfaction Guaranteed!

• This solution is not purchased yet.
• Submitted On 30 Aug, 2015 04:29:30
1 a.3 b.6 c.4 2. a.3 b.9 c.7 3. a.1 b.0 c.1 4. a.3 b.6 c.0 5. No…. It automatically converts primitives to String objects, so that it's possible to use String object methods for primitive strin...
Buy now to view the complete solution
Attachment
Other Similar Questions
Exper...

### HIEU 201 Chapter 5 Quiz Liberty University | Complete Solution

Alexander's invasion of the Near East was motivated primarily by 2. Which of the following is NOT an example of the ways in which the world changed after Alexander's conquests? 3. The Hellenistic kingdoms were rule...

Exper...

### Premiere Products Exercise Chapter 5 | Complete Solution

The following exercises are based on the Premiere Products database.
1. Using your knowledge of Premiere Products, determine the functional dependencies that exist in the following table. After determining the functio...

QUIZL...

### ATI RN Fundamentals Exam / ATI Fundamentals Exam (280 Q & A, From Chapter 1 to Chapter 58): (Latest)

ATI RN Fundamentals Exam / ATI Fundamentals Exam (280 Q & A, From Chapter 1 to Chapter 58): (Latest) Chapter 1 1.  A nurse is discussing restorative health care with a newly licensed nurse. Which of the following exa...
termp...

### Week 2 Lesson Objectives and Outline.docx Week 2 Lesson Objectives and Outline Chapter 5

Week 2 Lesson Objectives and Outline.docx Week 2 Lesson Objectives and Outline Chapter 5 Chapter 5 Objectives: 1. Identify epidemiological models used to explain disease and health patterns in populations. 2. Use epi...
maste...

### HIEU 201 Chapter 5 Quiz Latest/HIEU 201 Chapter 5 Quiz Latest

HIEU 201 Chapter 5 Quiz Latest/HIEU 201 Chapter 5 Quiz Latest HIEU 201 Chapter 5 Quiz Latest/HIEU 201 Chapter 5 Quiz Latest HIEU 201 Chapter 5 Quiz Latest/HIEU 201 Chapter 5 Quiz Latest HIEU 201 Chapter 5 Quiz Latest/HIEU ...

#### The benefits of buying study notes from CourseMerit

##### Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
##### Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.