Identify an error in the following pseudocode: (2)
sum = 0
for x = 1 to 10
if y MOD 2 = 0
display y
sum = sum + y
Melokuhle is a very young intelligent and adventurous individual. He has recently
bought 4 quantums (taxi) to transport people around the country. As a result, he is
planning a trip to Upington.
Therefore, he has hired you to write a program in pseudocode as well as in C++ to
evaluate the fuel consumption on his 4 cars during the planned trip. The kilometers
and fuel level in the tank at the start and end of the journey should be entered by the
end-user.
Calculate for each car, the fuel used, kilometers traveled, and the overall fuel
consumption in kilometers traveled per litre of fuel
Rewrite the following for-loop as a post-test do-loop. (5)
for x = 20 to -20 step -3
display "x = ", x
next x
Rewrite the following for-loop as a pre-test while-loop. (6)
for x = 1 to 10
for y = 10 to x
if y MOD 2 = 0 then
display "*"
else
display "#"
endif
display " " ~newline
Determine the exact output that is produced when the following code is executed.
for x = 1 to 10 step 1
for y = 1 to x step 1
if y MOD 2 = 0 AND x MOD 2 <> 0 || y MOD 2 <> 0 AND x MOD 2 = 0 then
display "*"
else
display "#"
endif
next y
display " " ~newline
next x
The Gaussian distribution also known as the Normal distribution, is given by the following
equation:
𝑦(𝑥) = 𝑒𝑥𝑝 −(𝑥−𝜇)^2/2𝜎^2
where parameter 𝝁 is the mean and 𝝈 the standard deviation.
(i) Write a MATLAB code to create a 1000 point Gaussian distribution of random numbers
having 𝜇 = 0 and 𝜎 = 1. (20)
(ii) Plot this distribution. (10)
Compare the Go-back N protocol with the rest of the protocols for effective frame transmission in Data link Layer detailed summary?
An organization is granted a block of addresses with the beginning address 150.25.0.0/24. The organization needs to have 3 subblocks of addresses to use in its three subnets: one subblock of 11 addresses, one subblock of 40 addresses, and one subblock of 125 addresses. Design the network and plot it completely with respective subnets, IP range, Network IDs.
Discuss the IPv4 Datagram with the help of suitable example.
need aa brief summary
Input:
staff name, the amount of loan, Year of Installment = 2 Process:
Do the decision
if (amount of loan < 5 000)
interest = 2
else if ( 10 000 < amount of loan >= 5 000)
interest = 2.5 else
Display “Invalid input. The maximum amount is RM10000”
interest = 0 Calculate Total of Interest
= (interest/100) * amount of loan
Calculate the Total Loan with Interest = amount of loan + Total of Interest
Calculate the monthly installment
= Total Loan with Interest / (Year of Installment * 12)
Output:
staff name, the amount of loan, monthly installment.