Scilab Practice Problems

Enhance your skills with real-world coding challenges and comprehensive word problem solutions for effective learning.

Practice Problems

1. Retail Store: Discount Calculator

A retail store offers a discount based on the total purchase amount:

  • 10% if the amount is between ₹500 and ₹1000.

  • 20% if the amount is above ₹1000.

Write a Scilab script to calculate the final amount after discount for a given purchase amount.

2. Factory Production: Matrix Analysis

A factory produces 3 types of products (A, B, C) in 3 shifts (morning, afternoon, evening).
The production quantities are as follows:
Morning: [50, 60, 70], Afternoon: [40, 50, 60], Evening: [30, 20, 10].

Find:

  • Total production for each product.

  • Total production for each shift.

3. Finance: Compound Interest Calculation

You invest ₹10,000 in a savings account that offers an annual interest rate of 5%.

Write a Scilab script to compute the amount after 10 years, assuming the interest compounds annually.

4. Data Science: Exam Analysis

The scores of 5 students in a Math exam are: [78, 85, 62, 90, 88].

Calculate:

  • The average score.

  • The highest and lowest scores.

  • Whether the average score qualifies as "pass" (cutoff: 50).

5. Engineering: Voltage-Current Relationship

In a circuit, the voltage V across a resistor is related to the current I by Ohm's law:

V = IR

If R = 10 Ω, and the current varies as [1, 2, 3, 4, 5] amperes, compute the corresponding voltage values.

6. Environment: Rainfall Statistics

A city records the monthly rainfall (in mm) for 6 months as: [120, 85, 95, 110, 140, 75].

  • Find the total rainfall over 6 months.

  • Compute the average monthly rainfall.

  • Determine which month had the highest and lowest rainfall.

7. Physics: Projectile Motion

A ball is thrown with an initial velocity u = 20 m/s at an angle of 45°.

Write a Scilab script to compute and plot the trajectory of the ball. Use g = 9.81