1)Write programs in C language to demonstrate the working of the following constructs a) b) c) d) e)
Do while While done If else Switch For
a)do while: AIM: To demonstrate theworking and various test cases on do while construct. DESCRIPTION: A do while is a loop control flow structure that executes a set of instructions over and over again until the condition becomes false. Here, condition is not checked while entering the loop, condition is checked while leaving the loop. So, in first iteration is free from condition checking. Condition variable is incremented to change condition in every check else it goes to infinite loop. PROGRAM: #include<stdio.h> #include void main(){ inta,b=6; clrscr(); printf("enter a number:"); scanf("%d",&a); do{ if(a%2==0){ printf("%d even",a); } else{ printf("%d odd",a); } printf("\n"); a++;b--; }while(b>0); getch(); }
b)while done: AIM: To demonstrate the working and various test cases on while construct.
DESCRIPTION: A while is a loop control flow structure that executes a set of instructions over and over again until the condition becomes false. Here, condition is checked while entering the loop, So, in first iteration is also checked with condition. Condition variable is incremented to change condition in every check else it goes to infinite loop.
PROGRAM: #include<stdio.h> #include void main(){ inta,b=6; clrscr(); printf("enter a number:"); scanf("%d",&a); while(b>0){ if(a%2==0){ printf("%d even",a); } else{ printf("%d odd",a); } printf("\n"); a++;b--; } getch(); }
c)SWITCH:
AIM: To demonstrate the working of switch case and show different possibilities of errors.
DESCRIPTION: A switch is a control flow structure that has n number of cases and executes particular case based on parameter passed. Here, condition checking doesn’t exist, it just takes a parameter and straightly executes the case which matches the parameter. Generally switch is implemented inside an infinite while loop to make it execute with many cases. And exit(0) function is used to quit from program.
PROGRAM: #include<stdio.h> #include #include<stdlib.h> void main(){ inta,b,op; clrscr(); while(1){ printf("enter two numbers:"); scanf("%d%d",&a,&b); printf("1.addition\t2.subtraction\n3.multiplication\t4.division\n5.exit\n"); scanf("%d",&op); switch(op){ case 1: printf("%d\n",a+b); break; case 2: printf("%d\n",a-b); break; case 3: printf("%d\n",a*b); break; case 4: printf("%d\n",a/b); break; case 5: exit(0); default: printf("enter valid option\n"); }
}
getch(); }
d)FOR:
AIM: To demonstrate the working of for construct and show different possibilities of errors.
DESCRIPTION: A for is a loop control flow structure that executes a set of instructions over and over again until the condition becomes false. Here, condition is checked while entering the loop, So, in first iteration is also checked with condition. With the condition, Condition variable is also given and incremented at the beginning(with the condition).
PROGRAM: #include<stdio.h> #include void main(){ inta,b; clrscr(); printf("enter a number:"); scanf("%d",&a); for(b=0;b<6;b++){ if(a%2==0){ printf("%d even",a); } else{ printf("%d odd",a); } printf("\n"); a++; } getch(); }
2) A program written in c language for matrix multiplication failure cases. Introspect the causes of these cases for their failure and write down the possible reasons for the failure. AIM: To write a matrix multiplication program in c language and test it with multiple cases and check the causes for its errors. DESCRIPTION: The matrix multiplication is possible and done only when the number of columns of first matrix are equal to number of rows of second matrix. Programmatically we can achieve this condition by taking matrices in the form of arrays(2 dimensional arrays for rows and columns). PROGRAM: #include<stdio.h> #include #include<stdlib.h> void main(){ int a[3][3],b[3][3],c[3][3],r1,r2,c1,c2,i,j,k; clrscr(); printf("enter rows and columns of matrix 1:"); scanf("%d%d",&r1,&c1); printf("enter rows and columns of matrix 2:"); scanf("%d%d",&r2,&c2); if(c1!=r2){ printf("matrix multiplication is not valid\n"); exit(0); } printf("enter values of matrix 1:"); for(i=0;i
for(i=0;i
printf("%d ",a[i][j]); } printf("\n"); } printf("matrix 2:\n"); for(i=0;i
3) Take any system (e.g. ATM SYSTEM) and study its system specifications and report the various bugs. AIM: To take a ATM SYSTEM and study its system specifications and report the various bugs that arise. DESCRIPTION: In any system, we write multiple programs and integrate them together to make fully functional software. While integrating together, there might be many errors and incompatibility bugs. All these are needed to be tested. EXPLAINATION: FEATURES TO BE TESTED: 1.Validity of card. 2.Withdraw transaction flow of ATM. 3.Authentication of users. 4. Dispense the cash from the account. 5. Verify the balance enquiry. 6. Change the pin number.
BUGS IDENTIFIED:
BUG ID
BUG NAME
ATM_001
Invalid card
ATM_002
Invalid pin
ATM_003
Invalid account type
ATM_004
Insufficient balance
ATM_005
Transaction balance limit
ATM_006
Day limit
ATM_007
Invalid money denomination
ATM_008
Receipt not printed
ATM_009
Pin mismatch
BUGS REPORTS: BUG ID
DESCRIPTION
STEPS TO PRODUCE
EXPECTED RESULT
ACTUAL RESULT
STATUS
ATM_001
Invalid card
1.keep an valid card.
Welcome screen
Invalid card
PASS/FAIL
ATM_002
Invalid pin
1.keep an valid card. 2. Enter valid pin.
Menu screen
Invalid pin
PASS/FAIL
ATM_003
Invalid account 1.keep an valid type card.
Enter amount screen
Invalid account type
PASS/FAIL
Collect the cash screen
Insufficient error
PASS/FAIL
Collect the cash screen
Insufficient transaction amount left message
PASS/FAIL
2. Enter valid pin. 3.select withdraw option. 4. Select account type. ATM_004
Insufficient balance
1.keep an valid card. 2. Enter valid pin. 3.select withdraw option. 4. Select account type. 5. enter amount
ATM_005
Transaction balance limit
1.keep an valid card. 2. Enter valid pin. 3.select withdraw option. 4. Select account type. 5. enter amount
ATM_006
Day limit
1.keep an valid card.
Collect the cash screen
Maximum transaction limit is reached message
PASS/FAIL
Collect the cash screen
Invalid amount type message
PASS/FAIL
2. Enter valid pin. 3.select withdraw option. 4. Select account type. 5. enter amount
ATM_007
Invalid money denomination
1.keep an valid card. 2. Enter valid pin. 3.select withdraw option. 4. Select account type. 5. enter amount
ATM_008
Receipt not printed
1.keep an valid card. 2. Enter valid pin. 3. select mini statement option 4.select account type
Collect receipt message
Receipt cannot be printed message
PASS/FAIL
ATM_009
Pin mismatch
1.keep an valid card.
Pin changed successfully
Pin mismatch error message
PASS/FAIL
2. Enter valid pin. 3. select change pin option. 4. enter old pin and new pin twice
TEST CASES: APPLICATION NAME
TESTCASE ID
TESTCASE SENARIO
TESTCASE
EXPECTED RESULT
ACTUAL RESULT
STATUS
TEST DATA
SBI ONLINE BANKING APPLICATION
1
Validate the login page with invalid username and valid password.
Enter invalid username and valid password in SBI online banking page
System should not allow user to login into the SBI online banking page.
Customer is not able to login into SBI online banking page.
PASS
Ex: Actual: abc 123 Entered: Aabc 123
SBI ONLINE BANKING APPLICATION
2
Validate the login page with invalid username and invalid password.
Enter invalid username and invalid password in SBI online banking page
System should not allow user to login into the SBI online banking page.
Customer is not able to login into SBI online banking page.
PASS
Ex: Actual: abc 123 Entered: Aabc 1234
SBI ONLINE BANKING APPLICATION
3
Validate the login page with valid username and invalid password.
Enter valid username and invalid password in SBI online banking page
System should not allow user to login into the SBI online banking page.
Customer is not able to login into SBI online banking page.
PASS
Ex: Actual: abc 123 Entered: abc 1234
SBI ONLINE BANKING APPLICATION
4
Validate the login page with valid username and valid password.
Enter valid username and valid password in SBI online banking page
System should allow user to login into the SBI online banking page.
Customer is able to login into SBI online banking page.
PASS
Ex: Actual: abc 123 Entered: abc 123
SBI ONLINE BANKING APPLICATION
5
Validate the user information by clicking on the profile picture.
Login into the system and by clicking on the profile photo, user should be able to access his information
Customer should be able to login into his account on SBI online page and user should be able to click on the profile picture and access his information.
Customer can login into his account and click on his profile picture, but user cannot find the info in it.
FAIL