Tutorial Questions -Set I (1)
Tutorial Questions -Set I (1)
Sheet One
Question
Obtain the length and width of a rectangle from the user. Calculate and output the area. If the
length and width are equal, output a message indicating that the figure is a square. Make a list of
variables, draw the flowchart, and perform a desk check using the following: 4, 8, 5, 5
Question Two
Obtain three test scores from a student. Calculate their average test score and output this value. If
their average score is 75% or more output a message indicating that they may proceed to the next
class. Make a list of variables, draw the flowchart, and perform a desk check using the following:
45, 55, 75, 80, 75, 88
Question Three
Obtain a name and age from the user. If the user is 16 or older, output a message indicating they
are old enough to drive. For people under 16, output a message indicating how many years they
must wait before they can drive legally.
Question Four
Obtain from the user an hourly pay rate and the number of hours worked for the week. Calculate
and output their weekly pay according to the following:
Regular pay is the pay up to 40 hours.
Overtime pay is pay for the hours over 40. Overtime is paid at a rate of 1.5 times the
hourly rate.
Gross pay is the sum of the regular pay and the overtime pay.
Question Five
Obtain a temperature in degrees Fahrenheit from the user. If the temperature is 80 degrees or
more, display a message that says "Go play golf" otherwise display a message stating "It's too
cold to be outside." Make a variable list, flowchart, and perform a desk check using the
following values: 95, 70
Question Six
Obtain a temperature in degrees Fahrenheit from the user. If the temperature is 80 degrees or
more display the message "Go play golf" otherwise, if the temperature is 70-79 degrees display
the message "Put on a jacket", otherwise display the message "It is way too cold." Make a
variable list, flowchart, and perform a desk check using the following values: 95, 72, 50
Question Seven
Obtain three numbers from the user. We will assume that the numbers are not the same. Find the
largest of these three numbers and store that value in a variable. Output this variable with an
appropriate message. Make a variable list, flowchart, and perform a desk check using the
following values: 3, 1, 2, 1, 2, 3, 2, 3, 1
Question Eight
Draw a flowchart for a program that will compute the average of 10 exam scores entered by the
user. List the variables needed for this program. Perform a desk check using the following
values: 75, 25, 51, 49, 88, 12, 22, 23, 52, and 78.
Question Nine
Modify problem on question number eight to allow the user to input the total number of exam
scores. List the necessary variables and draw the flowchart. Perform a desk check with the
following values: 5, 23, 77, 75, and 50.
Question Ten
Draw a flowchart for a program that will obtain 10 exam scores from the user and determine
whether the score is passing (a score of 60 or above) or failing. Your algorithm should count the
number of passing and failing scores. Output the average of the scores, the number of failing
scores, and the number of passing scores. List the necessary variables for this program. Perform
a desk check with the following values: 75, 25, 51, 49, 88, 12, 22, 23, 52, and 78.
Question Eleven
Draw a flowchart for a program that will compute and output the sales tax due with a tax rate of
7% and the total purchase price of 4 items. List the necessary variables for this program. Perform
a desk check with the following values: 2.99, 3.99, 7.50, and 2.75.