Question

In: Computer Science

In Python A child is required to use a booster seat in a car until the...

In Python

A child is required to use a booster seat in a car until the child is 9 years old, unless the child reaches the height of 59 inches before age 9. Which expression can be used to decide if a child requires a car seat or not?

a.

if age < 9 or height < 59:

b.

if age >= 9 or height >= 59:

c.

if age >= 9 and height >= 59:

d.

if age <= 9 and height <=59:

e.

None of the above

What conditions have to be true to make the following code display "B"?

if color == 'red':
    if style < 3:
        print('A')
    elif style < 5:
        print('B')
    else:
        print('C')
elif color == 'blue':
    print('D')

a.

color is 'blue' and style is 3

b.

color is 'red' and style is 6

c.

color is 'red' and style is 5

d.

color is 'red' and style is 4

e.

None of the above

What conditions have to be true to make the following code display "B"?

if color == 'red':
    if style < 3:
        print('A')
    elif style < 5:
        print('B')
    else:
        print('C')
elif color == 'blue':
    print('D')

a.

color is 'blue' and style is 3

b.

color is 'red' and style is 6

c.

color is 'red' and style is 5

d.

color is 'red' and style is 4

e.

None of the above

Which statement is equivalent to the following assignment?

x -= 2 + y

a.

x = 2 + y - x

b.

x = -(2 + y)

c.

x = x - (2 + y)

d.

x = x - 2 + y

e.

None of the above

Which of the following data values is best represented with a floating point variable?

a.

The speed of a snail.

b.

None of the other options

c.

The number of children in a classroom.

d.

The number of acorns in a tree.

e.

The number of pets in a house.

Solutions

Expert Solution

1) A child requires a car seat when he attains a age of atleast age greater than or equal to 9 and height greater than or equal to 59 .

Answer :

b.

if age >= 9 and height >= 59:

2) and  3)  

if color == 'red':
    if style < 3:
        print('A')
    elif style < 5:
        print('B')
    else:
        print('C')
elif color == 'blue':
    print('D')

In the above code the contents of  if statement contains the print('B') which would be executed only when the inner elif condition is reached and style < 5 is true i.e, (style = 4)

style < 5 is true

If the color = 'red' and style = 4 then the above if-else statements prints B to output.

Answer :

d.

color is 'red' and style is 4

4) x -= 2 + y

This statement is decrementing the value of x by (2+y) which is equivalent to x = x - (2+y)

Answer :

c.

x = x - (2 + y)

5) floating point Variable is used to store decimal values . Remember that a number is always is a integer.

Answer :

a.

The speed of a snail.

speed = distance / time , which means we get a fraction which is a decimal value or floating point


Related Solutions

Tests of Child Booster Seats The National Highway Traffic Safety Administration conducted crash tests of child...
Tests of Child Booster Seats The National Highway Traffic Safety Administration conducted crash tests of child booster seats for cars. Listed below are results from those tests, with the measurements given in HIC (standard head injury condition units). The safety requirement is that the HIC measurement should be less than 1000 HIC. Use a 0.01 significance level to test the claim that the sample is from a population with a mean less than 1000 HIC. Write the hypothesis find test...
An agency conducted a car crash test of booster seats for cars. The results of the...
An agency conducted a car crash test of booster seats for cars. The results of the tests are given, with the units being hic (standard head injury condition units). Calculate and interpret 95% confidence interval for the true mean measurement. You can assume its a normal population of measurements. Please show work. 774 649 1210 546 431 612
A safety administration conducted crash tests of child booster seats for cars. Listed below are results...
A safety administration conducted crash tests of child booster seats for cars. Listed below are results from those​ tests, with the measurements given in hic​ (standard head injury condition​ units). The safety requirement is that the hic measurement should be less than 1000 hic. Use a 0.01 significance level to test the claim that the sample is from a population with a mean less than 1000 hic. Do the results suggest that all of the child booster seats meet the...
A study was made of seat belt use among children who were involved in car crashes...
A study was made of seat belt use among children who were involved in car crashes that caused them to be hospitalized. It was found that children not wearing any restraints had hospital stays with a mean of 7.37 days and a standard deviation of 0.75 days with an approximately normal distribution. (a) Find the probability that their hospital stay is from 5 to 6 days, rounded to five decimal places. (b) Find the probability that their hospital stay is...
A study was made of seat belt use among children who were involved in car crashes...
A study was made of seat belt use among children who were involved in car crashes that caused them to be hospitalized. It was found that children not wearing any restraints had hospital stays with a mean of 7.37 days and a standard deviation of 2.75 days with an approximately normal distribution. (a) Find the probability that their hospital stay is from 5 to 6 days, rounded to five decimal places. (b) Find the probability that their hospital stay is...
A study was made of seat belt use among children who were involved in car crashes...
A study was made of seat belt use among children who were involved in car crashes that caused them to be hospitalized. It was found that children not wearing any restraints had hospital stays with a mean of 7.37 days and a standard deviation of 2.75 days with an approximately normal distribution. (a) Find the probability that their hospital stay is from 5 to 6 days, rounded to five decimal places. (b) Find the probability that their hospital stay is...
A study was made of seat belt use among children who were involved in car crashes...
A study was made of seat belt use among children who were involved in car crashes that caused them to be hospitalized. It was found that children not wearing any restraints had hospital stays with a mean of 7.37 days and a standard deviation of 1.50 days with an approximately normal distribution. (a) Find the probability that their hospital stay is from 5 to 6 days, rounded to five decimal places. (b) Find the probability that their hospital stay is...
A 24.5 kg child sits on a bathroom scale which is placed on the seat of...
A 24.5 kg child sits on a bathroom scale which is placed on the seat of a swing. What does the scale read when the swing is at rest? The child begins to swing back and forth until she reaches a maximum height of 0.85 meters (measured vertically) above the low point. What will the scale read as she passes the low point? The swing rope is 3.0 meters long.
Bharat Seat Ltd. manufactures and sells one product an infant car seat called Baby comfort at...
Bharat Seat Ltd. manufactures and sells one product an infant car seat called Baby comfort at a price of Rs. 500. Variable costs equal Rs. 200 per car seat. Fixed costs are Rs. 49,50,000. Bharat Seats Ltd. Manufactures Baby comfort upon the receipt of orders from its customers. In Year 1, It sold 30,000 units of Baby comfort. One of Bharat Seats Ltd. Customers, Hyundai Motor Co. has asked if in year 2 Bharat Seats will manufacture a different style...
6. Seat Belts A simple random sample of front-seat occupants involved in car crashes is obtained....
6. Seat Belts A simple random sample of front-seat occupants involved in car crashes is obtained. Among 2823 occupants not wearing seat belts, 31 were killed. Among 7765 occupants wearing seat belts, 16 were killed. The claim is that the fatality rate is higher for those not wearing seat belts. Are Seat Belts Effective? Use alpha=0.01 Hint: We are testing for difference between two proportions. Let P1 indicate the proportion of occupants not wearing seat belts, P2 indicate the proportion...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT