# Java Programming Solving Problems with Software Answer

Apr 23, 2021

## Offered By ”Duke University”

Enroll Now

N.B. We attempted our best to keep this site refreshed for our clients for nothing. You can likewise contribute by refreshing new inquiries or existing inquiry answer(s). There are numerous inquiries on our site, it is difficult for us to check them consistently. It will be extraordinary on the off chance that you can assist us with updating the site. Just let us know if you find any new questions through mail or comment . We will attempt to refresh the inquiry/answer ASAP.

## Week- 1

### Calculating the Perimeter of a Shape

1.
Question 1
What is the perimeter of the shape made from the file datatest4.txt whose contents are shown below (just give to two decimal places)?

-3, 9

-8, 7

-12, 4

-6, -2

-4, -6

2, -8

6, -5

10, -3

8, 5

4, 8

1 point

 30.64

2.
Question 2
What is the average length of a side in the shape made from the file datatest1.txt whose contents are shown below (just give to two decimal places)?

-3,3

-4,-3

4,-2

6,5

1 point

 5.94

3.
Question 3
What is the longest side in the shape made from the file datatest4.txt whose contents are shown below (just give to two decimal places)?

-3, 9

-8, 7

-12, 4

-6, -2

-4, -6

2, -8

6, -5

10, -3

8, 5

4, 8

1 point

 8.48

4.
Question 4
What is the largest perimeter of a shape made from the shapes in files dataset1.txt, dataset2.txt, dataset3.txt, dataset4.txt, dataset5.txt, and dataset6.txt (just give to two decimal places)?

1 point

 62.65

5.
Question 5
What is the name of the file that has the shape with the largest perimeter from the four files example1.txt, example2.txt, example3.txt and example4.txt?

1 point

• example1.txt
• example2.txt
• example3.txt
• example4.txt

6.
Question 6
The method getNumPoints returns the number of points in a Shape s.

Which one of the following is NOT a correct implementation of getNumPoints?

1 point

1 public int getNumPoints (Shape s) {

2     int count = 0;

3     for (Point p : s.getpoints())  {

4        count = count + count;

5     }

6     return count;

7 }

7.
Question 7
Consider the following code for the function mysteryShape that has one parameter a Shape s and calls the function getNumPoints from the assignment.

Which one of the following best describes the purpose of this function?

1 point

• The function computes the percentage of those points from the Shape s that have a positive X or a negative Y.
• The function computes the sum of those points from the Shape s that have a positive X and a negative Y.
• The function computes the sum of those points from the Shape s that have a positive X or a negative Y.
• The function computes the percentage of those points from the Shape s that have a positive X and a negative Y.

Extra Q

1. Consider the following code for the function mysteryShape that has one parameter a Shape s and calls the function getNumPoints from the assignment.
 The function computes the percentage of those points from the Shape s that have a positive X and a negative Y.

2.

What is the perimeter of the shape made from the file database4.txt whose contents are shown below (just give to two decimal places)?

-3,9

-8,7

-12,4

-6,-2

-4,-6

2,-8

6,-5

10,-3

8,5

4,8

 59.45

3. What is the name of the file that has the shape with the largest perimeter from the six files database1.txt, database2.txt, database3.txt, database4.txt, database5.txt and database6.txt?

 database5.txt

## Week- 2

### Strings in Java

1.
Question 1
Consider finding all the YouTube links on a web page. What is the video for the second YouTube link on the web page http://www.dukelearntoprogram.com/course2/data/manylinks.html about?

1 point

Potatoes

Walt Disney cartoons

Turkeys, Ducks and Quails

STEM

2.
Question 2
Consider the following mystery method.

Which of the following best describes what it does?

1 point

The method mystery is given a string and it returns a string which is the same string but with the first three T’s each replaced with two T’s.

The method mystery is given a string and it returns a string which is three copies of the original string.

The method mystery is given a string and it returns a string which is the same string but with the each T each replaced with two T’s.

The method mystery is given a string and it returns a string which is the same string but with all the T’s removed.

The method mystery is given a string and it returns a string which is the same string but with the first three T’s removed.

3.
Question 3
Use the following data file to answer this question: http://www.cs.duke.edu/~rodger/GRch38dnapart.fa. How many genes are in this file?

1 point

 69

4.
Question 4
Use the following data file to answer this question: http://www.cs.duke.edu/~rodger/GRch38dnapart.fa. How many genes in this file are longer than 60?

1 point

 23

5.
Question 5
Use the following data file to answer this question: http://www.cs.duke.edu/~rodger/GRch38dnapart.fa. How many genes in this file have cgRatio greater than 0.35?

1 point

 40

6.
Question 6
Use the following data file to answer this question which represents one long strand of DNA: http://www.cs.duke.edu/~rodger/GRch38dnapart.fa. How many times does the codon CTG appear in this strand of DNA?

1 point

 224

7.
Question 7
Use the following data file to answer this question: http://www.cs.duke.edu/~rodger/GRch38dnapart.fa. What is the length of the longest gene in the collection of genes found in this file?

1 point

 489

## Week- 3

### CSV Files and Basic Statistics in Java

1.
Question 1
Questions 1–3 refer to the data file exportdata.csv, available in the .zip download here.

Run your program from the first lesson programming exercise Parsing Export Data on the file exportdata.csv.

What is the name of the country that is listed as the second country that exports both cotton and flowers?

1 point

 Zambia

2.
Question 2
Run your program from the first lesson programming exercise Parsing Export Data on the file exportdata.csv.

How many countries export cocoa?

Note: You should only enter a one- or two-digit number representing the number of countries, with no other information included.

1 point

 17

3.
Question 3
Run your program from the first lesson programming exercise Parsing Export Data on the file exportdata.csv.

What is the name of the third country (on the third line of the output) listed whose exports are valued at one trillion US dollars or more?

(Hint: Their value in the CSV file should be greater than \$999,999,999,999.)

1 point

 Germany

4.
Question 4
Questions 4–11 refer to weather data in the folder nc_weather, available as a .zip download here.

Run your program developed in Parsing Weather Data to determine the lowest humidity in the file for June 29th, 2014 (weather-2014-06-29.csv).

What was the lowest humidity reading on that day?

Note: You should only enter your two-digit number result, with no other additional information included.

1 point

 40

5.
Question 5
Run your program from programming exercise Parsing Weather Data to determine the lowest humidity in the file for July 22nd, 2014 (weather-2014-07-22.csv).

At what time of day did that humidity occur?

(Refer to the time from the DateUTC column.)

1 point

11:51:00

13:51:00

16:51:00

18:51:00

20:51:00

6.
Question 6
Run your program from programming exercise Parsing Weather Data to determine the lowest humidity reading in the entire year of 2013.

What was the lowest humidity reading?

Note: You should only enter your two-digit number result, with no other additional information included.

1 point

 16

7.
Question 7
Run your program from programming exercise Parsing Weather Data to determine the lowest humidity reading in 2013.

At what time of day did that lowest humidity occur?

(Refer to the time from the DateUTC column.)

1 point

16:51:00

18:51:00

20:51:00

21:51:00

23:51:00

8.
Question 8
Run your program from programming exercise Parsing Weather Data to determine the average temperature in Fahrenheit on August 10, 2013 (weather-2013-08-10.csv).

Give your answer with four decimal digits and truncate the rest.

1 point

 80.1964

9.
Question 9
Run your program from programming exercise Parsing Weather Data to determine the average temperature in Fahrenheit for those temperature readings when the humidity is greater than or equal to 80 on September 2, 2013 (weather-2013-09-02.csv).

Give your answer with three decimal digits and truncate the rest.

1 point

 72.593

10.
Question 10
Run your program from programming exercise Parsing Weather Data to determine which day of the year had the coldest temperature in 2013.

1 point

December 25, 2013

December 30, 2013

January 8, 2013

January 23, 2013

February 1, 2013

11.
Question 11
Run your program from programming exercise Parsing Weather Data on 2013 data.

What was the coldest temperature recorded in 2013?

Give your answer with one decimal digit. (For example: 10.0)

1 point

 19

## Week- 4

### Baby Names

1.
Question 1
All questions in this quiz refer to the complete baby name data that you can download by clicking here. You should ignore the short fake data files for testing in the preceding MiniProject Exercise Guide.

What is the number of girls’ names in the file yob1900.csv?

1 point

 2225

2.
Question 2
What is the number of boys’ names in the file yob1905.csv?

1 point

 1421

3.
Question 3
What is the rank of the girl’s name “Emily” in 1960?

1 point

 251

4.
Question 4
What is the rank of the boy’s name “Frank” in 1971?

1 point

 54

5.
Question 5
What is the girl’s name of rank 350 in 1980?

1 point

 Mia

6.
Question 6
What is the boy’s name of rank 450 in 1982?

1 point

 Forrest

7.
Question 7
Suppose Susan was born in 1972. Based on her name’s rank in 1972, what would her name be if she were born in 2014 (that is, what name in 2014 had the same rank that “Susan” had in 1972)?

1 point

8.
Question 8
Suppose Owen was born in 1974. Based on his name’s rank in 1974, what would his name be if he were born in 2014 (that is, what name in 2014 had the same rank that “Owen” had in 1974)?

1 point

 Leonel

9.
Question 9
In which year from 1880 to 2014 does the girl’s name “Genevieve” have the highest rank (over all the data files)?

If there is more than one year with the highest rank, choose the earliest one.

1 point

 1914

10.
Question 10
In which year from 1880 to 2014 does the boy’s name “Mich” have the highest rank (over all the data files)?

If there is more than one year with the highest rank, choose the earliest one.

1 point

 1960

11.
Question 11
What is the average rank of the girl’s name “Susan” over all the data files?

Give the answer to two decimal places.

1 point

 173.51

12.
Question 12
What is the average rank of the boy’s name “Robert” over all the data files?

Give the answer to two decimal places.

1 point

 10.75

13.
Question 13
What is the total number of girls born in 1990 with names ranked higher than the girl’s name “Emily” in 1990?

Give the answer without any commas or decimal points.

1 point

 323200

14.
Question 14
What is the total number of boys born in 1990 with names ranked higher than the boy’s name “Drew” in 1990?

Give the answer without any commas or decimal points.

1 point

 1498074

#### By JAMD Bokhtier

This is JAMD Bokhtier's website.He is a passionate Marketer who dreams,talks,learns and teaches all about Marketing,the owner & the founder of "Life Style Consultant", a specialist in "Digital Marketing" and a Sophophilic.

#### You missed

error: Content is protected !!