Please answer part 2: numbers  4, 5, 6

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please answer part 2: numbers  4, 5, 6

II. Directions: Select and underline the letter that corresponds to your answer.
I. Directions, Write TRUE if the statement is correct, otherwise, write FALSE. Write your answer
on the space provided for.
1. Which of the following statements best describes "arrays"?
a. These are data types that can accommodate more than one data.
b. Set of clearly defined rules that are applied in order to solve problems.
c. These are data structure that can store more than one data of the same type.
d. The process of coding a program using a specific programming language.
1. Arrays are data structures that contains more than one data of the same type.
2. The first element in an array is found at index 1.
2. Using the declaration given below:
int x[] = {12, 13, 14, 15, 16, 17, 18, 19 };
What does x[2] refer to?
a. 12
3. Sometimes an index is called a subscript.
|ь. 14
С. 13
|d. 15
4. Consider the code below:
3. Using the code below:
int[] num= {2, 3, 4, 5};
Console. WritelLine(num[4]);
An IndexOutOfBounds exception is thrown during run time or execution of the program.
int[] myArray = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9};
Console. Writeline(myArray,Length);
What is the value of 'Length' property of the array?
а. 10 b. 9 с. 11 d. 8
5. The last element in an array is accesses at length – 1.
4. How do you access an array element?
a. variable = i.name; c. variable = name.get():
b. variable = name.retrieve(i);
6. Array declaration is done through the syntax below:
|d. variable = name[i];
type[] arrayname = new type[length];
5. An array is a list of data items that:
7. Consider the code below:
int[] scores = {50, 70, 35, 80, 75, 90, 100, 95};
The value of Length property of the array score is 9.
a. have the same type
b. are all integers
c. have different names
d. are originally set to null ('\0')
6. For which of the following applications is an array NOT suitable:
8. Parameters are the variables passed on a method call.
9. Array elements can be identified using its subscripts.
a. Holding the scores on twelve midterm exams of a class.
b. Holding the name, social security number, age, and income of one individual.
C. Holding the temperature readings taken every hour throughout a day.
d. Holding the total sales a store made in each of twelve months.
10. Argument are the variables that receives the value(s) of the variables being
passed to a method
7. Based on the code fragment below, which of the statements would be placed on
the blank so that each item of the array is assigned twice the value of its index.
int array[10];
int index;
for (index=0;index<10;index++)
}
a. index = 2*index;
b. array[ index ] = 2*array[ index ];
c. array[ 2*index ] = 2*index;
d. array[ index ] = 2*index;
Transcribed Image Text:II. Directions: Select and underline the letter that corresponds to your answer. I. Directions, Write TRUE if the statement is correct, otherwise, write FALSE. Write your answer on the space provided for. 1. Which of the following statements best describes "arrays"? a. These are data types that can accommodate more than one data. b. Set of clearly defined rules that are applied in order to solve problems. c. These are data structure that can store more than one data of the same type. d. The process of coding a program using a specific programming language. 1. Arrays are data structures that contains more than one data of the same type. 2. The first element in an array is found at index 1. 2. Using the declaration given below: int x[] = {12, 13, 14, 15, 16, 17, 18, 19 }; What does x[2] refer to? a. 12 3. Sometimes an index is called a subscript. |ь. 14 С. 13 |d. 15 4. Consider the code below: 3. Using the code below: int[] num= {2, 3, 4, 5}; Console. WritelLine(num[4]); An IndexOutOfBounds exception is thrown during run time or execution of the program. int[] myArray = {2, 4, 6, 8, 10, 1, 3, 5, 7, 9}; Console. Writeline(myArray,Length); What is the value of 'Length' property of the array? а. 10 b. 9 с. 11 d. 8 5. The last element in an array is accesses at length – 1. 4. How do you access an array element? a. variable = i.name; c. variable = name.get(): b. variable = name.retrieve(i); 6. Array declaration is done through the syntax below: |d. variable = name[i]; type[] arrayname = new type[length]; 5. An array is a list of data items that: 7. Consider the code below: int[] scores = {50, 70, 35, 80, 75, 90, 100, 95}; The value of Length property of the array score is 9. a. have the same type b. are all integers c. have different names d. are originally set to null ('\0') 6. For which of the following applications is an array NOT suitable: 8. Parameters are the variables passed on a method call. 9. Array elements can be identified using its subscripts. a. Holding the scores on twelve midterm exams of a class. b. Holding the name, social security number, age, and income of one individual. C. Holding the temperature readings taken every hour throughout a day. d. Holding the total sales a store made in each of twelve months. 10. Argument are the variables that receives the value(s) of the variables being passed to a method 7. Based on the code fragment below, which of the statements would be placed on the blank so that each item of the array is assigned twice the value of its index. int array[10]; int index; for (index=0;index<10;index++) } a. index = 2*index; b. array[ index ] = 2*array[ index ]; c. array[ 2*index ] = 2*index; d. array[ index ] = 2*index;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY