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

  Design and build a prototype data warehouse

Design and build a prototype data warehouse using the data on Spend over £500 in the Department of Energy and Climate Change for the financial year 2012-2013 (April 2012 to March 2013 inclusive).

  Implement the boyer-moore algorithm using any program

Implement the Boyer-Moore algorithm using any programming language you prefer.

  Write an algorithm to count nodes in a linked list

storage pool and that there is a special null value. Write an algorithm to count the nodes in a linked list with first node pointed to by first."

  Develop a flowchart and provide a brief explanation for it

A middle school has decided that it would like to make its students' grades available to their parents via an online parent portal. Develop a flowchart and provide a brief explanation for it

  Explain the purpose of the program as detail as possible

Count the amount of words in the file. A word can end with a --- space, EOLN character or a punctuation mark (which will be part of the word).

  Inventory tracking database

Construct a relational database of your choice. The DB should contain no more than six tables. Define three business requirements that this database will provide.

  Consider you want to demonstrate a decision treetable to

consider you want to demonstrate a decision treetable to someone who has never seen one. think of a scenario with two

  System analyst

A huge, well regarded supplier of key raw materials to your corporation's production process requires a year-end summary report of totals purchased from it.

  Test the database management system functionality

In a report that less than half of all companies validate the in their databases and test database management system's functionality. Explain your answer.

  Babylonian algorithm

Babylonian Algorithm. The Babylonian algorithm to compute the square root of a positive number n is as given:

  Create a program to calculate each income bracket

People from 3-different income levels, A, B, and C, rated each of 2-different items with a number 0 through 10. Create a file in which each line contains the income level and item rankings for one respondent.

  Explaining elementary operations used in algorithm

How many elementary operations are used in algorithm given below? The elementary operations are comparison operations (such as > and

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