8.13. Mixed-up Code Questions

Loading a dynamic question ...
Selecting from: file_write_line_pp, file_write_line_ac

Loading a dynamic question ...
Selecting from: file_read_n_lines_pp, file_read_n_lines_ac

Loading a dynamic question ...
Selecting from: file_count_words_pp, file_count_words_ac

Loading a dynamic question ...
Selecting from: file_count_lines_starting_with_pp, file_count_lines_starting_with_ac

Loading a dynamic question ...
Selecting from: file_write_squares_pp, file_write_squares_ac

The following program should split the lines of “olympics.txt”, then print the name, team, and event of each athlete in a sentence. Unfortunately the code is mixed up. Drag the blocks of statements from the left column to the right column and put them in the right order. Watch out for extra pieces of code and indentation!

The next 5 questions refer to pollution data in the US from the following file. It contains a city, state :PM10 :PM2.5 where PM is the particulate matter and PM10 is particulate matter that is course and 2.5 to 10 micrometers in diameter such as dust from vehicles on the road. PM2.5 is particulate matter that is 2.5 micrometers in diameter or smaller which are produced by combustion from things like gas-powered vehicles or forest fires. If you want to see all of the data click on the Show button below. Once it appears, you can hide it again by clicking on the Hide button.

The following program prints the pollution information for all cities that start with a D, but the code is mixed up. Drag the blocks of statements from the left column to the right column and put them in the right order. Watch your indentation.

PM 2.5 is an air pollutant that is harmful at high levels. The following program prints the maximum PM 2.5 pollution found, but the code is mixed up. Drag the blocks of statements from the left column to the right column and put them in the right order. Watch your indentation.

The following program prints the minimum PM 2.5 pollution found, but the code is mixed up. Drag the blocks of statements from the left column to the right column and put them in the right order. Watch your indentation.

The following program prints the average PM 2.5 pollution found, but the code is mixed up. Drag the blocks of statements from the left column to the right column and put them in the right order. Watch your indentation.

The following program prints the average PM 2.5 pollution for a state, but the code is mixed up. Drag the blocks of statements from the left column to the right column and put them in the right order. Watch your indentation.

You have attempted of activities on this page