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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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