Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Homework help on Arrays for visual logic course 1 start 2 Declarations 3 num SIZ

ID: 3810386 • Letter: H

Question

Homework help on Arrays for visual logic course

1 start
2    Declarations
3        num SIZE = 5
4        string names[SIZE] = "Pocahantas", "Wendy", "Snow White",
5                             "Cinderella", "Tinker Bell"
6    output names[3.5]
7 stop

In the space provided, enter the line number (a number between 1-7) that contains a syntax error.

Given the following pseudocode:

1 start
2    Declarations
3        num SIZE = 5
4        string names[SIZE] = "Pocahantas", "Wendy", 1.8,
5                             "Cinderella", "Tinker Bell"
6    output names[2]
7 stop

In the space provided, enter the line number (a number between 1- 7) that contains a syntax error.

Given the following pseudocode:

1 start
2    Declarations
3        num index
4        num SIZE = 5
5        string names[SIZE] = "Pocahantas", "Wendy", "Snow White",
6                             "Cinderella","Tinker Bell"    

7    for index = 0 to SIZE step 1
8        output names[index]
9    endfor
10 stop

In the space provided, enter the line number (a number between 1-10) that has a logical error.

Given the following pseudocode segment,

start
    Declarations
        num SIZE = 5
        string names[SIZE] = "Pocahantas", "Wendy", "Snow White", "Cinderella", "Tinker Bell"

    ...
stop

In the space provided, enter the index (a number) into the array names that accesses the value Tinker Bell.

Explanation / Answer

1 start
2    Declarations
3        num SIZE = 5
4        string names[SIZE] = "Pocahantas", "Wendy", "Snow White",
5                             "Cinderella", "Tinker Bell"
6    output names[3.5] . //Error because index needs to be integer and not floating point , So Line 6 has error
7 stop

============

1 start
2    Declarations
3        num SIZE = 5
4        string names[SIZE] = "Pocahantas", "Wendy", 1.8, //

Inplace of string we are storing 1.8 which is an error, So LINE 4 IS THE ANSWER
5                             "Cinderella", "Tinker Bell"
6    output names[2]
7 stop

============

1 start
2    Declarations
3        num index
4        num SIZE = 5
5        string names[SIZE] = "Pocahantas", "Wendy", "Snow White",
6                             "Cinderella","Tinker Bell"    

7    for index = 0 to SIZE step 1 . //Index will start from 1 , so Line 7 has logical error
8        output names[index]
9    endfor
10 stop

-=========
start
    Declarations
        num SIZE = 5
        string names[SIZE] = "Pocahantas", "Wendy", "Snow White", "Cinderella", "Tinker Bell"

    ...
stop

Index 5 will give us Tinker Bell