CS ouestions
CS ouestions
CS ouestions
General Questions:
2. Explain the flow of the project. How does it work from start to finish?
2. How do you add a product to the database? Explain the add_product() function.
o The view_products() function fetches all the products from the products
table. It executes an SQL SELECT * FROM products query to retrieve all rows.
The function then loops through the results and prints out each product's ID,
name, price, and stock quantity.
SQL Queries:
3. What is the role of the ENUM data type in the bills table?
o The ENUM data type in the bills table is used for the payment_status column,
which stores the payment status of a bill. It restricts the values of this column
to either 'Paid' or 'Pending', providing a simple way to manage and track the
payment status.
4. Why is the bills table linked to the customers table with a foreign key?
o The bills table is linked to the customers table to associate each bill with a
specific customer. By using the customer_id foreign key, we can track which
customer made the purchase and manage customer-related information
(such as name and contact details) for each bill.
Miscellaneous:
1. What will happen if a customer tries to buy more products than are available in
stock?
o If a customer tries to purchase more products than are available in stock, the
system will check the stock quantity and display a message saying that there
is not enough stock. The bill creation process will be stopped, and the
purchase will not be completed.
2. How do you handle errors such as invalid product IDs in the system?
1. How can you make this system more secure (e.g., password handling)?
2. What changes would you make to optimize the performance of this billing system?
o To optimize performance:
By understanding these answers and being able to explain them clearly, you'll be well-
prepared for your viva!