True / False
- Array is a data structure that is made up of a number of variables all of which have the same data type
- Ease of understanding is one of the benefit of using the modular design
- Efficiency of maintenance means each module should be depend on other module
- Diagram that represents modules graphically is called organization chart
- One of the most common modules is an initial processing module
Complete the following pseudocode
- Program_1
____ smallest_element to array(1)
____ largest_element to array (1)
Do ________ = 2 to number_of_elements
IF array (index) ____ smallest_element THEN
Smallest _ element = array(index)
ELSE
___ array(index) > largest_element THEN
Largest_element = array(index)
ENDIF
ENDIF
______
Print the range as smallest_element followed by largest_element
_______
- Program_2
Set ________________ to false
Set low_element to 1
Set ____________________ to max_num_elements
DOWHILE (NOT element_found) _____ (low_element <= high_element)
Index = (low_element + high_element) /2
IF input_value = array (index) THEN
Set ________________ to true
ELSE
IF Input_value < array(index) THEN
high_element = _________ – 1
ELSE
low_element = _________ + 1
ENDIF
ENDIF
ENDDO
IF element_found THEN
Print array(index)
ELSE
Print ‘value not found’, input_value
ENDIF
END
- Program_3
Set max_num to 24
Set ____________ to zero
Read input file
DOWHILE (input values exist) AND (row_index< 6)
row_index = row_index + 1
DO column_index = 1 to 4
Freight_charges (row_index, ____________ ) = input value
___________ input file
ENDDO
IF (input values exist) AND row_index = 6 THEN
Print ‘array size too small’
ENDIF
END
Complete the following pseudocode, write the result , and construct the hierarch chart
- Input Data :
Customer number | Name | Address | Gas usage |
1122 | Cassandra Castello | Blue Sky River 5 | 40 |
1221 | Stefano Salland | Blue Sky River 6 | 80 |
1331 | Jessica James | Red River 1 | 100 |
1335 | Manthis Markew | Red River 4 | 50 |
EOF |
Bill_Gas_Customers
Perform_initial_processing
Read customer record
_____________ more records
Calculate_amount_owing
Print_customer_details
Read customer record
ENDDO
Print_Gas_totals
END
_______________________
Print ‘Customer Usage Figures’ heading
Set ________________ to zero
Set total_amount_owing to zero
END
__________________________
IF usage <= 60 THEN
________________ = usage * $2.00
ELSE
______________ = (60 * 1.75) + ((usage – 60) * $1.50)
ENDIF
Add amount_owing to total_amount_owing
END
_______________________
Print customer_number, name, address, gas_usage, __________
Add 1 to total_customers
END
__________________________
Print total_customers
Print total_amount_owing
END
- Input file
Record | Prod_no | Prod_desc | No_of_units | Retail_price | Freight_charge | Packaging_charge |
1 | 100 | Rubber | 10 | $1.00 | $0.20 | $0.50 |
2 | 200 | Pipe | 20 | $2.00 | $0.10 | $0.20 |
3 | 300 | Bolt | 100 | $3.00 | $0.10 | $0.20 |
EOF |
Produce_orders_report
Set page_count to_____
Print_page_headings
Read_order details
DOWHILE more records
IF line_count > 45 THEN
_____________________
ENDIF
Calculate_total_ampunt_due
Print_order_details
Read_order_Details
ENDDO
END
_______________________________
Add 1 to page_count
Print main heading ‘ACME SPARE PARTS’
Print heading ‘ORDERS REPORT’
Print ‘Page’, ___________
Print ‘Product No Product Description Units Ordered Total Amount Due’
Print blank line
Set line_count to ______
END
_____________________
Read product order record
END
_____________________
amount_due = no_of_units * retail_price
IF ______________ > $100.00 THEN
Discount = ____________ * 0.1
ELSE
_______ = zero
ENDIF
amount_due = _____________ – discount
freight_due = freight_charge * ______________
packaging_due = packaging_charge * __________-
total_amount_due = amount_due + _________________ + ________________
END
__________________
Print prod_no, ______________-, ____________________,__________
Add ____ to line_count
END