Test Corrections (64/70)

Q1 Multiply x by 3 inside a loop

1.D 0/1 MC pointIncorrect answer Consider the following program.

The figure presents two blocks of code that consist of 3 lines. The second block of code contains a nested block of code. Line 1: [begin block] x ← 2 [end block] [Begin Block] Line 2: Repeat 4 times [Begin Block] Line 3: [begin block] x ← x * 3 [end block] [End Block] [End Block] Which of the following expressions represents the value stored in the variable x as a result of executing the program?

Q6 Correctness of robot programs

1.D 0/1 MC pointIncorrect answer The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom left square of the grid and facing right.

The figure presents a robot in a grid of squares with 5 rows and 4 columns. The robot is represented by a triangle which is initially in the lower left square of the grid, facing right. The grid contains a gray square in the first row and third column of the grid. The following programs are each intended to move the robot to the gray square. Program II uses the procedure GoalReached, which returns true if the robot is in the gray square and returns false otherwise.

The figure presents two programs, labeled Program 1 and Program 2. Program 1 has a block of code that consists of six lines. Throughout the code there are nested blocks of code. [Begin Block] Line 1: REPEAT 2 TIMES [Begin Block] Line 2: [begin block] MOVE_FORWARD [end block] Line 3: [begin block] ROTATE_LEFT [end block] Line 4: [begin block] MOVE_FORWARD [end block] Line 5: [begin block] MOVE_FORWARD [end block] Line 6: [begin block] ROTATE_RIGHT [end block] [End Block] [End Block]. Program 2 has a block of code that consists of 5 lines. Throughout the code there are nested blocks of code. [Begin Block] Line 1: REPEAT UNTIL [begin block] GoalReached [end block] [Begin Block] [Begin Block] Line 2: IF [begin block] CAN_MOVE [begin block] forward [end block] [end block] [Begin Block] Line 3: [begin block] MOVE_FORWARD] [end block] [End Block] Line 4: ELSE [Begin Block] Line 5: [begin block] ROTATE_LEFT [end block] [End Block] [End Block] [End Block] [End Block] Which of the following statements best describes the correctness of the programs?

A Program I correctly moves the robot to the gray square, but program II does not.

B Program II correctly moves the robot to the gray square, but program I does not.

C Both program I and program II correctly move the robot to the gray square.

D Neither program I nor program II correctly moves the robot to the gray square.

Answer A Incorrect. Program II correctly moves the robot to the gray square by moving the robot forward to the bottom right corner of the grid, rotating left, moving the robot forward to the upper right corner of the grid, rotating left, and moving forward to the gray square.

Q19 Observe user growth

5.B 0/1 MC pointIncorrect answer A file storage application allows users to save their files on cloud servers. A group of researchers gathered user data for the first eight years of the application’s existence. Some of the data are summarized in the following graphs. The line graph on the left shows the number of registered users each year. The line graph on the right shows the total amount of data stored by all users each year. The circle graph shows the distribution of file sizes currently stored by all users.

The figure presents two line graphs and a circle graph titled Registered Users By Year, Total Amount of Data Stored, and File Size Distribution, respectively. The graph titled Registered Users By Year contains 8 data points. The horizontal axis is labeled Year, and the numbers 0 through 8, in increments of 1, are indicated. The vertical axis is labeled Number of Registered Users, in millions, and the numbers 0 through 800, in increments of 100, are indicated. The line begins at the point Year 1 comma 26 million users and trends upwards and to the right, passing through the following data points. Year 2 comma 53 million users; Year 3 comma 105 million users; Year 4 comma 202 million users; Year 5 comma 403 million users; Year 6 comma 504 million users; Year 7 comma 601 million users; and Year 8 comma 701 million users. The graph titled Total Amount of Data Stored contains 8 data points. The horizontal axis is labeled Year, and the numbers 0 through 8, in increments of 1, are indicated. The vertical axis is labeled Total Amount of Data Stored, in millions of gigabytes, and the numbers 0 through 8,000, in increments of 1,000, are indicated. The line begins at the point Year 1 comma 262 million gigabytes and trends upwards and to the right, passing through the following data points. Year 2 comma 505 million gigabytes; Year 3 comma 1,014 million gigabytes; Year 4 comma 2,208 million gigabytes; Year 5 comma 3,885 million gigabytes; Year 6 comma 5,110 million gigabytes; Year 7 comma 5,890 million gigabytes; and Year 8 comma 6,986 million gigabytes. The circle graph contains 6 wedges of data, as follows. Less than 10 kilobytes, 17%; 10 kilobytes to 100 kilobytes, 24%; 100 kilobytes to 1 megabyte, 25%; 1 megabyte to 10 megabytes, 10%; 10 megabytes to 100 megabytes, 22%, more than 100 megabytes, 2%. (note: 1 MB = 1,000 KB)

Which of the following best describes the growth in the number of registered users for the first eight years of the application’s existence?

A The number of registered users increased at about a constant rate each year for all eight years.

B The number of registered users increased at about a constant rate for years 1 to 5 and then about doubled each year after that.

C The number of registered users about doubled each year for years 1 to 5 and then increased at about a constant rate after that.

D The number of registered users about doubled each year for all eight years.

Answer A Incorrect. While the number of registered users appears to have grown at a constant rate for years 5 to 8, the number of registered users roughly doubled each year for years 1 to 5.

Q21 File size distribution

5.B 0/1 MC pointIncorrect answer A file storage application allows users to save their files on cloud servers. A group of researchers gathered user data for the first eight years of the application’s existence. Some of the data are summarized in the following graphs. The line graph on the left shows the number of registered users each year. The line graph on the right shows the total amount of data stored by all users each year. The circle graph shows the distribution of file sizes currently stored by all users.

The figure presents two line graphs and a circle graph titled Registered Users By Year, Total Amount of Data Stored, and File Size Distribution, respectively. The graph titled Registered Users By Year contains 8 data points. The horizontal axis is labeled Year, and the numbers 0 through 8, in increments of 1, are indicated. The vertical axis is labeled Number of Registered Users, in millions, and the numbers 0 through 800, in increments of 100, are indicated. The line begins at the point Year 1 comma 26 million users and trends upwards and to the right, passing through the following data points. Year 2 comma 53 million users; Year 3 comma 105 million users; Year 4 comma 202 million users; Year 5 comma 403 million users; Year 6 comma 504 million users; Year 7 comma 601 million users; and Year 8 comma 701 million users. The graph titled Total Amount of Data Stored contains 8 data points. The horizontal axis is labeled Year, and the numbers 0 through 8, in increments of 1, are indicated. The vertical axis is labeled Total Amount of Data Stored, in millions of gigabytes, and the numbers 0 through 8,000, in increments of 1,000, are indicated. The line begins at the point Year 1 comma 262 million gigabytes and trends upwards and to the right, passing through the following data points. Year 2 comma 505 million gigabytes; Year 3 comma 1,014 million gigabytes; Year 4 comma 2,208 million gigabytes; Year 5 comma 3,885 million gigabytes; Year 6 comma 5,110 million gigabytes; Year 7 comma 5,890 million gigabytes; and Year 8 comma 6,986 million gigabytes. The circle graph contains 6 wedges of data, as follows. Less than 10 kilobytes, 17%; 10 kilobytes to 100 kilobytes, 24%; 100 kilobytes to 1 megabyte, 25%; 1 megabyte to 10 megabytes, 10%; 10 megabytes to 100 megabytes, 22%, more than 100 megabytes, 2%. (note: 1 MB = 1,000 KB)

Which of the following observations is most consistent with the information in the circle graph?

A Over 75% of the files stored are 1 MB in size or less.

B Over 75% of the files stored are 10 MB in size or less.

C Over 75% of the files stored are at least 100 KB in size.

D Over 75% of the files stored are at least 1 MB in size.

Answer C Incorrect. The files that are 100 KB and up represent 25% + 10% + 22% + 2%, or 59%.

Q44 Remove connections in network configuration

1.D 0/1 MC pointIncorrect answer The figure below shows two possible network configurations for devices P through V. A line between two devices indicates a connection. Devices can communicate only through the connections shown.

The figure presents two possible network configurations, labeled Configuration 1 and Configuration 2, for devices P through V. A line between two devices indicates a connection. The network for Configuration 1 is as follows. P is connected to U, V, T, and Q. Q is connected to P, T, R, and S. R is connected to Q, T, and S. S is connected to Q, R, T, and V. T is connected to P, Q, R, S, and V. U is connected to P and V. V is connected to P, S, T, and U. The network for Configuration 2 is as follows. P is connected to Q, T, and U. Q is connected to P, R, and S. R is connected to Q and T. S is connected to Q, T, and V. T is connected to P, R, S, U, and V. U is connected to P and T. V is connected to S and T. In configuration I, what is the minimum number of connections that must be broken or removed before device T can no longer communicate with device U?

A One

B Two

C Three

D Four

Answer C Incorrect. While it is possible to disconnect computers U and T by removing three connections, it can be done by removing only two connections.

Q65 Calls to concat and substring

4.B 0/1 MC pointIncorrect answer A program contains the following procedures for string manipulation.

Procedure Call Explanation Concat (str1, str2) Returns a single string consisting of str1 followed by str2. For example, Concat (“key”, “board”) returns “keyboard”. Substring (str, start, length) Returns a substring of consecutive characters from str, starting with the character at position start and containing length characters. The first character of str is located at position 1. For example, Substring (“delivery”, 3, 4) returns “live”. Which of the following can be used to store the string “jackalope” in the string variable animal ?

Select two answers.

A animal ← Substring (“antelope”, 5, 4)

animal ← Concat (animal, “a”)

animal ← Concat (Substring (“jackrabbit”, 1, 4), animal)

B animal ← Substring (“antelope”, 5, 4)

animal ← Concat (“a”, animal)

animal ← Concat (Substring (“jackrabbit”, 1, 4), animal)

C animal ← Substring (“jackrabbit”, 1, 4)

animal ← Concat (animal, “a”)

animal ← Concat (animal, Substring (“antelope”, 5, 4))

D animal ← Substring (“jackrabbit”, 1, 4)

animal ← Concat (animal, “a”)

animal ← Concat (Substring (“antelope”, 5, 4), animal)

Answer A Incorrect. This code segment stores the substring “lope” in animal. It then concatenates “lope” and “a”, storing the result “lopea” in animal. Lastly, it concatenates the substring “jack” and “lopea”, storing the result “jacklopea” in animal.