0% found this document useful (0 votes)
70 views

COMP 200 - Assignment #5

Uploaded by

ramirez.mv.1994
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

COMP 200 - Assignment #5

Uploaded by

ramirez.mv.1994
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment #5 – Chapter 13 (pg.

650)

12. Assume our model requires 1014 computations to simulate one hour of activity.

a. We run the program on a desktop computer with a computation speed of 800


MIPS. How long will it take to simulate one day of activity in the model?
If 1 hrs of activity = 10 1 4 computations
Then 1 day of activity = 24 × 10 1 4 computations

If 1 MIPS = 10 6 MIPS
Then 800 MIPS = 800 × 10 6 MIPS

If 1 day of activity = (24 × 10 1 4 ) ÷ (800 × 10 6 )


= 3 × 10 6 seconds
Then 1 day of activity = (3 × 10 6 ) ÷ (60 × 60 × 24)
= 34.722… ≈ 35 hours

Thus, it takes 35 days (3 × 10 6 seconds) to simulate 1 day of activity.

b. How fast a computer (in terms of MIPS) do we need to use if we want to


complete the simulation of one day in five minutes of computing time?
If 1 hrs of activity = 10 1 4 computations
Then 1 day of activity = 24 × 10 1 4 computations

If 1 mins = 60 seconds
Then 5 mins = 60 × 5 seconds

(300 seconds) = (24 × 10 1 4 ) ÷ (x)


(300)(x) = x [(24 × 10 1 4 ) ÷ (x )]
[(300 )(x)] ÷ (300 ) = (24 × 10 1 4 ) ÷ (300)
x = 8 × 10 1 2 MIPS

Thus, to simulate 1 day of activity in 5 mins, the computer needs 8 × 10 1 2 MIPS.

Schneider, G. M., & Gersting, J. L. (2012). Invitation to Computer Science (6th ed.). Cengage Learning.
Assignment #5 – Chapter 14 (pg. 684)

7. Using the Employees table of Figure 14.6 and the InsurancePolicies table of Figure 14.7,
write an SQL query that retrieves first and last names, hours worked, and insurance
plan types for all employees who have worked fewer than 100 hours.

Figure 14.6 – Employees


ID LastName FirstName Birthdate PayRate HoursWorked
116 Kay Janet 03/29/1976 $16.60 94
123 Perreira Francine 08/15/1989 $8.50 185
149 Takasano Frederick 05/23/1986 $12.35 250
171 Kay John 11/17/1974 $17.80 245
165 Honou Morris 06/09/1993 $6.70 53

Figure 14.7 – InsurancePolicies


EmployeeID PlanType DateIssued
171 B2 10/18/1994
171 C1 06/21/2002
149 B2 08/16/2008
149 A1 05/23/2006
149 C2 12/18/2011

The primary key in Employees (ID), and the foreign key in InsurancePolicies (EmployeeID)
relates the two tables. This allows the SQL query below to retrieve the required information
found in both tables about employees who have worked fewer than 100 hours:

SELECT LastName, FirstName, HoursWorked, PlanType


FROM Employees, InsurancePolicies
WHERE HoursWorked < 100.00
AND ID = EmployeeID;

However, the query would not yield any results, because the two employees who have
worked fewer than 100 hours (according to the table Employees) are not on the
InsurancePolicies table (highlighted). The two employees are Kay, Janet (ID 116) who has
worked 94 hours, and Honou, Morris (ID 165) who has worked 53 hours.

Schneider, G. M., & Gersting, J. L. (2012). Invitation to Computer Science (6th ed.). Cengage Learning.
Assignment #5 – Chapter 15 (pg. 723)

1. Suppose that in a formal logic, green(x) means that x has the attribute of being green,
frog(x) means that x has the attribute of being a bullfrog, and J stands for the specific
entity Jeremiah. Translate the following formal statements into English:

a. frog(J) Jeremiah is a bullfrog.

frog(x) = x has the attribute of being a bullfrog

J = specific entity Jeremiah

b. (∀x)(frog (x) → green (x)) Every bullfrog is green.

(∀x) = universal quantifier, “for every x”

frog(x) = x has the attribute of being a bullfrog

→ = cause and effect relationship; if–then

green(x) = x has the attribute of being green

Schneider, G. M., & Gersting, J. L. (2012). Invitation to Computer Science (6th ed.). Cengage Learning.
Assignment #5 – Chapter 16 (pg. 755)

5. Below is the vertex list for a two–dimensional wireframe triangular model. Draw the
two–dimensional figure modelled by the vertex list.

Vertex x y Connected to
(origin) v1 0 0 v2, v3, v4
v2 0 1 v1, v4
v3 1 0 v1, v4, v5
v4 1 1 v1, v2, v3, v5
v5 1.6 0.5 v3, v4

1.5

V2 V4
1

V5
0.5

V1 V3
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8

Schneider, G. M., & Gersting, J. L. (2012). Invitation to Computer Science (6th ed.). Cengage Learning.

You might also like