Skip to content

Programming for Business Analytics

BA · Midterm · Fall 26

Section 72-C · Batch 262

This browser can’t show the PDF here

Open it, and your phone’s PDF viewer takes it, or download it.

Read the questions as text

Read off the PDF by AI, so it may have mistakes. The PDF is the original.

Daffodil International University Department of Business Administration Course Code: 0613-114 Course Title: Programming for Business Analytics Semester: Fall 2026 Examination: Mid Term Time: 1.5 Hours Full Marks: 25 Section: A, B, C, D, E, F, G, H Teachers' Initial: Asfaqur/Sagar/Sadman/Rabbi Answer ALL Questions [The figures in the right margin indicate the full marks and the corresponding Course Learning Outcome. All portions of each question must be answered sequentially.] 1. A bank wants to show a customer how a deposit of Tk 50,000 grows at 13% interest per year. The program must keep adding the yearly interest until the balance reaches at least Tk 120,000. The number of years is not known in advance. [3+2=5, CLO-1] (a) Explain the three parts of every loop: initialization, condition and update. Identify each part for this savings problem, and state whether a for loop or a while loop suits it better. (b) Demonstrate which of the following variable names are valid and which are invalid in Python. For each invalid name, state the naming rule it breaks. net_profit 3rd_quarter unit cost sales-tax _count if 2. A loyalty program assigns a membership tier to each bill. Study the following code segment. [4+1=5, CLO-2] price = 250 qty = 4 discount = 10 subtotal = price * qty total = subtotal - subtotal * discount / 100 points = int(total) // 100 code = "BDT" + str(points) print(total) print(points, total % 300) print(code * 2) if total >= 900 and points > 8: print("Gold") elif total >= 900: print("Silver") else: print("Regular") (a) Apply the rules of Python operators and if-elif-else statements to work out the exact output the program prints. (b) Distinguish between the value and data type of points with and without int(), and examine whether the printed tier would change. 3. The program below should read a customer's name, the quantity, the unit price and the membership status, then print the amount payable after a 10% member discount. It contains FIVE errors. [5, CLO-2] name = input("Customer name: ") qty = input("Quantity: ") price = float(input("Unit price: ")) member = input("Member (y/n): ") subtotal = qty * price if member = "y": discount = subtotal * 10 / 100 else discount = 0 payable = subtotal - discount print("Customer: " + name) print("Amount payable: " + payable) Analyze the program to distinguish each of the five errors. For each one, state the line, give the reason it is wrong and write the corrected line. (1 mark for each error) 4. A courier company in Dhaka calculates the delivery charge of a parcel using the rates below. [8+2=10, CLO-2] Location | Up to 1 kg | Above 1 kg Inside Dhaka | Tk 60 | Tk 60 + Tk 20 per kg above 1 kg Outside Dhaka | Tk 120 | Tk 120 + Tk 30 per kg above 1 kg Premium customers receive a 10% discount on the final charge, wherever the parcel goes. Sample input and output: Sample input | Sample output Location (inside/outside): outside, Weight in kg: 2.5, Premium customer (y/n): y | Delivery charge: 148.5 Location (inside/outside): inside, Weight in kg: 0.8, Premium customer (y/n): n | Delivery charge: 60 (a) Apply nested if-else statements to write a complete Python program that reads the delivery location ("inside" or "outside"), the parcel weight in kg (decimal) and whether the customer is premium ("y" or "n"), then calculates the charge and prints it. (b) Apply your program to the following two cases and show the charge it prints for (i) inside Dhaka, 3 kg, premium customer and (ii) outside Dhaka, 0.5 kg, regular customer. Show your calculation.