Define the data structure array

Assignment Help Data Structure & Algorithms
Reference no: EM13760437

1. Assume the instruction: boolean [] myBoolean = new boolean[10];

a. What is the name of the array variable?
b. What type of values the above array is for?
c. What is the range of valid indexes values for the above array?
d. What will be the value of myBoolean.length?
2. Using the following segment code

for(int i = 1; i <= 5; i++)

{

System.out.println(i * 5);

}

a) What is the output for this code?
b) Augment the code to output also the squares of each of the numbers 1-5.
c) Modify the code to print only the when i is even

3. Write a segment of code to traverse (go through each element of) an array of intergers, or size 10, called int_array and print out each element to the console

4. Write a segment code to sum and print the average of 100 random numbers between 1 and 6.

5. Write a segment of code to traverse (go through each element of) an array of integers, or size 10, called int_array and print out each element to the console.

6. Explain the difference between the control variables in a while loop and a for loop

7. a. What is the name of the variable controlling the while loop?

b. In which line is updated the variable controlling the loop?

c. What is the initial value of the variable controlling the while loop?

d. What is the value of the variable controlling the loop in line 18?

8. If a variable controlling a while loop is not updated inside of the loop then, the loop goes for ever (infinite loop)

Example:
int control = 1;
While (control != 10){
System.out.println( "control " + (control + 2));
}
a. This is an infinite loop; fix it
b. Modify the above code to print only 1 3 5 7 9

9. Write a segment code for the following:( do not worry for the syntax) Set a loop to request a phrase from the keyboard. If the phrase contains the word "loop",  the boolean variable myFlag is set to false to stop the loop.

10. From the given loop answer the following questions:

a. What is the value of the variable controlling the loop?
b. How is the variable mutated or modified to reach the value to end the loop?
c. Is the statement mutating or modifying the variable inside of the body of the loop?
d. When the loops end; What is the value of the variable controlling the loop:

11. Define the data structure array. Include uses; what represent the name of the array; importance of the index value; naming of the variables bundle within the array.

12. Describe how do you declare an array

13. How the arrays in java are initialized?

14. Describe how do you print the content of an array

15. Describe how do you traverse an array

16. Explain the code below: what is the input?;output? Transformed data?

17. What is the problem in this segment code?

18. Write a segment code to request the user a number from 1 to 15; then print a pyramid to that number. Example if the user input 8, the output is the following
1
12
123
1234
12345
123456
1234567
12345678

19. Using the following code answer the questions:

for (int i = 0; i < n; i++)

{ a[i] = Math.random(); }

a. What is the name of the array?

b. What is the variable indexing the array?

c. What is the range of the indexing variable?

20. Using the following code answer the questions:

for (int i = 0; i < n; i++)

{ System.out.println("a "+ i + ", " + a[i]); }

a. What ‘the statement in the loop' is printing?

Reference no: EM13760437

Questions Cloud

The classification is revealed by analyzing the information : The classified information is contained in the existing document and has been paraphrased in the new document. The SCG identifies the test firing dates as Secret information. No additional interpretation was needed to identify this information's c..
What does emerson believe about being true to oneself : What does Emerson believe about being true to oneself?
Write an essay about medical marijuana in canada : Write an essay about Medical Marijuana in Canada. Particularly British Columbia province. I want you to take a look at what I have done and your task is to add in "Industry Research Report".
Explain velma sue bates and dura automotive systems : Explain Velma Sue Bates and Dura Automotive Systems. Is termination of nondisabled employees permissible when they have a prescription for the medication for which they tested positive?
Define the data structure array : Define the data structure array. Include uses; what represent the name of the array; importance of the index value; naming of the variables bundle within the array.
Write a paper on improves cultural awareness : Write a paper on Improves Cultural awareness. Complete a peer review of at least two Case Study Analysis Papers from members of your Learning Team. Use the Case Study Analysis Peer Review.
Agesim : Example of Agesim that you have witnessed in healthcare
Internet of things : This is one of the current topic worth discussing. It describes the attempt of social media to use Internet to obtain much information from people than accepted by the privacy and confidential laws. If the principle or idea of Internet of Things i..
Apply graphical user interface design principles : Apply graphical user interface design principles - Design conditional and iteration constructs appropriate to a given programming task and design well-written and readable programs using a disciplined coding style, including documentation and indenta..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Ways in which soa reduces the total cost of ownership

Analyze five (5) ways in which SOA reduces the total cost of ownership (TCO). Examine five (5) ways in which using XML enables data and information exchange between clients and servers using Web Services in an SOA environment

  Write a function that accepts an array of integers

Write a function that accepts an array of integers and the size of the array and prints out a table listing how many values in the array fall in each of the following ranges:

  Opens an output file with the external name

Design an algorithm that does the following: opens an output file with the external name number_list.dat, uses a loop to write the numbers 1 through 100 to the file and then closes the file.

  Write algorithm that allows the customer to enter amount

An ATM allows a customer to withdraw a maximum of $500 per day. If a customer withdraws more than $300, the service charge is 4% of the amount over $300.

  Determine minimum number of total nodes tree can have

If binary tree has height 4, determine minimum number of total nodes tree can have? c. If binary tree has height 4, determine the maximum number of total nodes tree can have?

  Irected graph g = (v,e) in which edges that leave the source

Suppose that we are given a weighted, directed graph G = (V,E) in which edges that leave the source vertex s may have negative weights, all weights are nonnegative, and there are no negative-weight cycles. Argue that Dijkstra's algorithm correctly fi..

  Processor sharing to worse performance than fcfs

Create a second experiment answering the question "Is it possible for processor sharing to have worse performance than FCFS? "

  Graph theory

Let  A  be a graph that has an Euler circuit. Prove (or disprove) that all graphs that are isomorphic to  A  have at least on Euler circuit.

  What are the characteristics of a good algorithm

What is an algorithm? What are the characteristics of a good algorithm and what do you mean by complexity of an algorithm? Explain the meaning of worst case analysis and best case analysis with an example.

  Hardware platform of the target embedded systems

An embedded system is a computer system performing dedicated functions within a larger mechanical or electrical system. Embedded systems range from portable devices such as Google Glasses, to large stationary installations like traffic lights, fa..

  Prepare the initial linked list of students and grades

Write a C program which initially presents menu of choices for the user. Menu must consist of the following choices: Prepare the initial linked list of students and grades.

  Find minimum number of storage required for bfs and dfs

Assume we have problem space where there is uniform branching factor b and there is single goal node at depth m. Determine the minimum number of nodes expanded and storage required for BFS and DFS?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd