Questions With Complete Solutions
/. algorithm - Answer-A set of steps designed to generate the desired output
/.A complete algorithm typically includes - Answer-A. input steps
B. processing steps
C. output steps
/.processing steps - Answer-Steps that perform calculations and logical processing are
called
/.an input item - Answer-A program asks the user to enter the unit price of a chair and
the quantity he is buying. It calculates and displays the total price. The unit price is
/.an output item - Answer-A program asks the user to enter the unit price of a chair and
the quantity he is buying. It calculates and displays the total price. The total price is
/.missing output step - Answer-The following algorithm is designed to calculate and
display the area of a rectangle:
Step 1: Input length and width
Step 2: Calculate area = length * width
Anything wrong with this algorithm?
/.missing input step - Answer-Hotdog is $3 each and soda is $0.75 each in a hotdog
stand. The following algorithm is designed to calculate the total price for a customer's
order:
Step 1: Calculate total price = number of hotdogs * 3 + number of sodas * 0.75
Step 2: Display total price
Anything wrong with this algorithm?
/.incomplete processing step - Answer-Students in a course need to take an exam and
complete a project. When the course grade is calculated, the exam is 70% while the
prject is 30%. The following algorithm is designed to calculate course grade
Step 1: Input exam score and project score
Step 2: Calcuate exam score * 0.7 + project score * 0.3
Step 3: Display course grade
, Anything wrong with this algorithm?
/.incorrect processing step - Answer-A music store is having a clearance sale. All CDs
are 30% off. The following algorithm is desgined to calculate sale price:
Step 1: Input original price
Step 2: Calcuate sale price = original price * 0.30
Step 3: Display sale price
Anything wrong with this algorithm?
/.3 - Answer-The following algorithm is designed to calculate the total cost of buying
chairs:
Step 1: Input unit price
Step 2: Input quantity
Step 3: Calcuate total price = unit price * quantity
Step 4: Display total price
How many variables will there be if we execute this algorithm?
/.first_exam - Answer-Which of the following Python variable name is valid?
/.unitprice
unitPrice
unit_price - Answer-Which of the following Python variable names are valid?
/.store data in computer memory - Answer-In Python, assignment statements are used
to
/.A. retrieves the value of y
B. calculates the total of 5 and the value of y
C. stores the result of the calculation in the variable x - Answer-What does the computer
do when it executes the following statement:
x=y+5
/.20 - Answer-What is the output of the following Python program?
x = 10
x = 20
print(x)
/.2 - Answer-What is the output of the following Python program?