Full Question
1. Correct the following code and
2. Convert the do while loop the following code to a while loop
declare integer product
declare integer number
product = 0
do while product < 100
display ""Type your number""
input number
product = number * 10
loop
display product
End While
Answer:
1. Code Correction
The errors in the code segment are:
a. The use of do while on line 4
You either use do or while product < 100
b. The use of double "" as open and end quotes for the string literal on line 5
c. The use of "loop" statement on line 7
The correction of the code segment is as follows:
declare integer product
declare integer number
product = 0
while product < 100
display "Type your number"
input number
product = number * 10
display product
End While
2. The same code segment using a do-while statement
declare integer product
declare integer number
product = 0
Do
display "Type your number"
input number
product = number * 10
display product
while product < 100
Answer:
1121.7 × 10³⁰ photons per second
Explanation:
Data provided in the question:
Power transmitted by the AM radio,P = 550 kW = 550 × 10³ W
Frequency of AM radio, f = 740 kHz = 740 × 10³ Hz
Now,
P = 
here,
N is the number of photons
t is the time
E = energy = hf
h = plank's constant = 6.626 × 10⁻³⁴ m² kg / s
Thus,
P =
=
[t = 1 s for per second]
or
550 × 10³ = 
or
550 = N × 4903.24 × 10⁻³⁴
or
N = 0.11217 × 10³⁴ = 1121.7 × 10³⁰ photons per second
Answer:
The required mechanical work is required to reduce each day by 1.05×10^8 Joules.
Explanation:
Coefficient of Performance (COP) = Q/W
Q is thermal energy absorbed by the air conditioner
W is mechanical work done
Q = 3.9×10^8 J
COP of old air conditioner = 2.3
W = Q/COP = 3.9×10^8/2.3 = 1.70×10^8 J
COP of new air conditioner = 6
W = Q/COP = 3.9×10^8/6 = 6.5×10^7 J
Reduction in mechanical work = (1.7×10^8) - (6.5×10^7) = 1.05×10^8 J