Loading...
North West Power Generation Company Limited (NWPGCL)

Post: Assistant Manager (ICT)
Exam Date: 12.01.2024, Exam Taker: BUET
  1. Salary Range and tax calculation are given
Salary RangeTax
0-2500000
250001-50000010%
500001-100000020%
>10,00,00030%
1(a) Write a program using any language to the calculate the total tax of employee salary
#include <stdio.h>
int main() {
    // Constants for tax ranges
    const int range1 = 250000;
    const int range2 = 500000;
    const int range3 = 1000000;
    // Constants for tax rates
    const float rate1 = 0.0;
    const float rate2 = 0.10;
    const float rate3 = 0.20;
    const float rate4 = 0.30;
    // Number of employees
    int numEmployees;
    printf("Enter the number of employees: ");
    scanf("%d", &numEmployees);
    // Array to store employee salaries
    float salaries[numEmployees];
    // Input employee salaries
    printf("Enter the salaries of employees:\n");
    for (int i = 0; i < numEmployees; i++) {
        printf("Employee %d: ", i + 1);
        scanf("%f", &salaries[i]);
    }
    // Calculate tax and total tax
    float totalTax = 0.0;
    for (int i = 0; i < numEmployees; i++) {
        float tax = 0.0;
        if (salaries[i] <= range1) {
            tax = salaries[i] * rate1;
        } 
        else if (salaries[i] <= range2) {
            tax = (salaries[i] - range1) * rate2;
        } 
        else if (salaries[i] <= range3) {
            tax = (range2 - range1) * rate2 
                + (salaries[i] - range2) * rate3;
        } 
        else {
            tax = (range2 - range1) * rate2 
                + (range3 - range2) * rate3 
                + (salaries[i] - range3) * rate4;
        }
        totalTax += tax;

        printf("Employee %d: Salary = %.2f, Tax = %.2f\n",
               i + 1, salaries[i], tax);
    }
    printf("Total Tax for all employees: %.2f\n", totalTax);
    return 0;
}
Sample I/O:
Enter the number of employees: 5
Enter the salaries of employees:
Employee 1: 250000
Employee 2: 500000
Employee 3: 185000
Employee 4: 550000
Employee 5: 255000
Employee 1: Salary = 250000.00, Tax = 0.00
Employee 2: Salary = 500000.00, Tax = 25000.00
Employee 3: Salary = 185000.00, Tax = 0.00
Employee 4: Salary = 550000.00, Tax = 35000.00
Employee 5: Salary = 255000.00, Tax = 500.00
Total Tax for all employees: 60500.00
== Code Execution Successful ===
1(b) From the three employee salary find the highest tax paying employee
#include  <stdio.h>

int main() {
    // Constants for tax ranges
    const int range1 = 250000;
    const int range2 = 500000;
    const int range3 = 1000000;

    // Constants for tax rates
    const float rate1 = 0.0;
    const float rate2 = 0.10;
    const float rate3 = 0.20;
    const float rate4 = 0.30;

    // Number of employees (Fixed at 3)
    const int numEmployees = 3;

    // Array to store employee salaries
    float salaries[numEmployees];

    // Input employee salaries
    printf("Enter the salaries of three employees:\n");
    for (int i = 0; i < numEmployees; i++) {
        printf("Employee %d: ", i + 1);
        scanf("%f", &salaries[i]);
    }

    // Calculate tax and find the highest tax-paying employee
    float maxTax = 0.0;
    int highestTaxEmployee = 1;

    for (int i = 0; i < numEmployees; i++) {
        float tax = 0.0;

        if (salaries[i] <= range1) {
            tax = salaries[i] * rate1;
        }
        else if (salaries[i] <= range2) {
            tax = (salaries[i] - range1) * rate2;
        }
        else if (salaries[i]  maxTax) {
            maxTax = tax;
            highestTaxEmployee = i + 1;
        }
    }

    // Print the employee who paid the highest tax
    printf("Highest tax-paying employee: Employee %d with Tax = %.2f\n",
           highestTaxEmployee, maxTax);

    return 0;}
Sample I/O:
Enter the salaries of three employees:
Employee 1: 250000
Employee 2: 120000
Employee 3: 1000000
Employee 1: Salary = 250000.00, Tax = 0.00
Employee 2: Salary = 120000.00, Tax = 0.00
Employee 3: Salary = 1000000.00, Tax = 125000.00
Highest tax-paying employee: Employee 3 with Tax = 125000.00

2. Product (pname,price,category,maker)
Purchase (buyer,seller,stock)
Company(cname,country)
Person(per-name, address, phone)
Here in Product table make is similar to cname, here buyer and seller in Purchase
table is similar to per-name in Person table,

2(a) Select person name who bought American category product

SELECT per_name
FROM Person
WHERE EXISTS (
    SELECT 1
    FROM Purchase
    WHERE Purchase.buyer = Person.per_name
      AND Purchase.stock IN (
          SELECT pname
          FROM Product
          WHERE category = 'American'
      )
);
2(b) Find Sum of all product and Sum of All sales product according to country of origin.

SELECT Company.country,
       SUM(Product.price) AS total_product_value,
       SUM(Product.price * Purchase.stock) AS total_sales_value
FROM Product
INNER JOIN Purchase 
        ON Product.pname = Purchase.stock
INNER JOIN Company 
        ON Product.maker = Company.cname
GROUP BY Company.country;

You must subscribe & Login to view more.

Don’t have an account? Register

Or your subscription is under review by admin. Please message on WhatsApp / Telegram.

Leave a Comment

Latest Post
Field Based Job Question & Solution
Bank IT Job Solution

MCQ + Written from Bangladesh Bank, Sonali, Combined Bank IT recruitment.

BPSC IT Job Solution

BPSC Computer/IT cadre & non-cadre post Question papers with full solutions.

Gas Field IT Job Solution

Gas field like TGTDCL, BGDCL, JGTDSL, KGDCL, SGCL, RPGCL, GTCL etc. question solution

Power Sector IT Job Solution

Power sector such as NESCO, DESCO, DPDC, WZPDCL, BPDB, PGCB, BREB etc

Other IT Job Solution

Other Govt. Semi govt. organization like BCC, BTCL, CAAB, NSI etc.

NTRCA IT Job Solution (upcoming)

NTRCA ICT-related posts such as Assistant Teacher, Demonstrator, Lecturer.

IT MCQ Job Solution

Collected MCQ Job solution of BANK, BPSC, POWER SECTOR, GAS Field and Others.

Topic Based Q&S
WhatsApp Telegram Messenger