Tuesday, 9 September 2025

Print addition symbol in polynomials


#include <stdio.h>

int main() {

    int n; // Degree of the polynomial + 1

    printf("Enter the number of terms in the polynomial: ");

    scanf("%d", &n);


    int poly1[100]; // Array for polynomial coefficients


    // Input for the polynomial

    printf("Enter the coefficients of the polynomial:\n");

    for (int i = 0; i < n; i++) {

        printf("Coefficient of x^%d: ", i);

        scanf("%d", &poly1[i]);

    }


    // Print polynomial

    printf("\nPolynomial is: ");

      for (int i = 0; i < n; i++) {

        printf("%d", poly1[i]);

        if (i != 0) {

            printf("x^%d", i); // Display power of x

        }

        if (i != n - 1) {

            printf(" + "); // Display '+' between terms in result

        }

    }   

    return 0;

}


Accept Coefficient value

 

#include<stdio.h>

int main() {

    int n; // Degree of the polynomial + 1

    printf("Enter the number of terms in the polynomials: ");

    scanf("%d", &n);

 

    int poly1[100]; // Arrays for the two polynomials and the result

 

    // Input for the first polynomial

    printf("Enter the coefficients of the first polynomial:\n");

    for (int i = 0; i < n; i++) {

        printf("Coefficient of x^%d: ", i);

        scanf("%d", &poly1[i]);

    }

  

    return 0;

}

 

Accept Array and display array

#include <stdio.h>

 

int main() {

    int n, i;

 

    printf("Enter size of array: ");

    scanf("%d", &n);   // accept size

 

    int arr[n];   // declare array of size n

 

    // Input elements

    printf("Enter %d elements:\n", n);

    for(i = 0; i < n; i++) {

        scanf("%d", &arr[i]);

    }

 

    // Output elements

    printf("Array elements are:\n");

    for(i = 0; i < n; i++) {

        printf("%d ", arr[i]);

    }

 

    return 0;

}



 

Monday, 12 May 2025

Write four test cases for payment through a debit card option for an interactive web app, considering various positive and negative scenarios

 

  • Write four test cases for payment through a debit card option for an interactive web app, considering various positive and negative scenarios 
                                                                             
    Test Case 1: Valid Debit Card Details (Positive Scenario)
  • Test Case ID: TC001
  • Scenario: Successful payment with valid card details.
  • Test Steps:

1.      Navigate to the payment page.

2.      Select the "Debit Card" payment option.

3.      Enter valid debit card details:

§  Card Number: 16 digits

§  Expiry Date: Future date

§  CVV: 3 digits

4.      Click "Pay Now."

  • Expected Result:-Payment is processed successfully, and the user is redirected to the order confirmation page. A success message is displayed, and a confirmation email is sent to the user.

 

Test Case 2: Invalid Card Number (Negative Scenario)

  • Test Case ID: TC002
  • Scenario: Payment with an invalid card number.
  • Test Steps:

1.      Navigate to the payment page.

2.      Select the "Debit Card" payment option.

3.      Enter invalid debit card details:

§  Card Number: Less than 16 digits or contains alphabets/special characters

§  Expiry Date: Future date

§  CVV: 3 digits

4.      Click "Pay Now."

  • Expected Result:-Payment is not processed. An error message such as "Invalid card number. Please check and try again" is displayed.









Test Case 3: Expired Card (Negative Scenario)

  • Test Case ID: TC_DebitCard_003
  • Scenario: Payment with an expired debit card.
  • Test Steps:

1.      Navigate to the payment page.

2.      Select the "Debit Card" payment option.

3.      Enter debit card details:

§  Card Number: 16 digits

§  Expiry Date: Past date

§  CVV: 3 digits

4.      Click "Pay Now."

  • Expected Result:-Payment is not processed. An error message such as "Card has expired. Please use a valid card" is displayed.

 

Test Case 4: Insufficient Funds (Negative Scenario)

  • Test Case ID: TC_DebitCard_004
  • Scenario: Payment with a valid card but insufficient account balance.
  • Test Steps:

1.      Navigate to the payment page.

2.      Select the "Debit Card" payment option.

3.      Enter valid debit card details:

§  Card Number: 16 digits

§  Expiry Date: Future date

§  CVV: 3 digits

4.      Ensure the account associated with the card has insufficient funds.

5.      Click "Pay Now."

  • Expected Result:-Payment is not processed. An error message such as "Transaction declined due to insufficient funds" is displayed.

 

Write 4 test cases for ATMs.

 

Write 4 test cases for ATMs.


 Test Case 1: Valid Cash Withdrawal

Test Case ID: ATM_TC_001
Description: Verify that a user can withdraw cash successfully if they have sufficient balance.
Preconditions: The ATM has sufficient cash, and the user has a valid ATM card with a sufficient account balance.
Test Steps:

1.      Insert the ATM card.

2.      Enter the correct PIN.

3.      Select "Withdraw Cash."

4.      Enter an amount within the account balance limit.

5.      Confirm the transaction.
Expected Result: The ATM dispenses the correct amount, deducts it from the account, and prints a receipt (if requested).
Actual Result: The ATM successfully dispensed the cash, updated the account balance, and provided a receipt.

 Test Case Status: Pass

Test Case 2: Insufficient Balance for Withdrawal

Test Case ID: ATM_TC_002
Description: Verify that a withdrawal request is declined if the balance is insufficient.
Preconditions: The ATM is operational, and the user has an ATM card with a balance lower than the requested withdrawal amount.
Test Steps:

1.      Insert the ATM card.

2.      Enter the correct PIN.

3.      Select "Withdraw Cash."

4.      Enter an amount greater than the available balance.

5.      Confirm the transaction.
Expected Result: The ATM displays an error message: "Insufficient Balance," does not dispense cash, and does not deduct the amount.
Actual Result: The ATM displayed an error message and did not dispense cash.
Test Case Status: Pass

 

Test Case 3: Incorrect PIN Entry

Test Case ID: ATM_TC_003
Description: Verify that the system denies access if the wrong PIN is entered multiple times.
Preconditions: The ATM is operational, and the user has a valid ATM card.
Test Steps:

1.      Insert the ATM card.

2.      Enter an incorrect PIN.

3.      Repeat steps 1-2 for three consecutive incorrect attempts.
Expected Result: The ATM locks the account or temporarily blocks further attempts after three incorrect PIN entries.
Actual Result: The ATM displayed a "Card Blocked" message after three incorrect attempts and denied further access.
Test Case Status: Pass

Test Case 4: Card Retention Due to Expired Card

Test Case ID: ATM_TC_004
Description: Verify that the ATM retains an expired card.
Preconditions: The ATM is operational, and the user has an expired ATM card.
Test Steps:

1.      Insert the expired ATM card.

2.      The ATM system checks the card’s expiration date.
Expected Result: The ATM does not proceed with transactions, displays a message ("Card Expired"), and retains the card if applicable.
Actual Result: The ATM displayed a "Card Expired" message but returned the card instead of retaining it.
 Test Case Status: Fail