Skill-4 - CS: Software Testinglab List of Programs

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

SKILL-4 – CS : SOFTWARE TESTINGLAB

LIST OF PROGRAMS

1. Test the C program: Finding the sum of individual digits of a 10-digit number until a single

digit is produced.

2. Test the C Program: Accept the inputs student name, marks in five subjects and declare the

result as PASS if the student gets minimum 40 in each subject; otherwise declare the result as

FAIL.

3. Test the C program: Program for generating n prime numbers

4. Test the C program: Sort and store the elements of two arrays of integers into the third list.

5. Test the C program: Experiment the operations of a stack using array implementation.

6. Test the C program: Menu-driven option for queue operations like add, remove and display.

7. Test the C++ program: Palindrome string checking program (using pointers)

Ex.No.01

SUM OF INDIVIDUAL DIGITS

AIM:

To test a C program for finding the sum of individual digit of a 10 digit number until a
single digit is produced.

ALGORITHM:

Step 1: Start the process.

Step 2: Open TC present in the program files to open the C programming environment.

Step 3:Declare the variables required inside the main function.

Step 4: Get 10 digits from the user which is stored in the variable called temp for temporary
storage.

Step 5: Performing the operations of sum of individual digits given by the user.
Step 6: Sum of individual digit is displayed finally using display function.

Step 7 : Stop the process.

SOURCE CODE:

#include <stdio.h> // preprocessor directive


#include<conio.h>
#include<math.h>
long int sumofdigits(long int n)
{
long int sum=0;
while(n>0 || sum>9)
{
if (n == 0)
{
n=sum;
sum=0;
}
sum+=n%10;
n/=10;
}
return sum;
}
int main()
{
int n;
printf(“enter the number”);
scanf(“%ld”,n);
sumofdigits(long int n);
printf(“Sum of individual digits are:%ld:”, sum);
return 0;
}

TEST CASES:

TEST- TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT
TC-01 Input case- Enter the number in Accept integer in Accepted integer in SUCCESS
Positive. respect of any number respect of any respect of any
of digits as integer. number of digits. number of digits.
TC-02 Input case- Enter the number in Kindly input the Accepted only the FAILURE
Negative. respect of any number valid data. integer part and
of digits as real. neglect the decimal
values.
TC-03 Process case- Add the digit one by Accept the correct Accepted the SUCCESS
Check whether it one until it produces a value of the single correct value of the
producing a single single digit. digit. single digit.
digit- positive.
TC-04 Process case- Add the digit one by Don’t accept the Don’t accept the SUCCESS
Check whether it one until it produces a value if it produces value if it produces
producing a single single digit. a final output more a final output more
digit- Negative. than one digit. than one digit.
TC-05 Output case- check 1. Title of the program. 1. Addition of digits 1. Addition of digits SUCCESS
for the formatted 2. Input query. in a no. in a no.
output. 3. Output query. 2. Enter the number 2. Enter the number
4. Line space. <Accept number in <Accept number in
next line>. next line>.
3. The sum of digit 3. The sum of digit
number is < result. number is < result.
TC-06 Acceptance of 10 Input 10 digit number. Accepted 10 Digit Accepted 10 Digit SUCCESS
digit input data. number. number.
TC-07 Non-acceptance of Input a character data Character X should Character data not SUCCESS
character data. ‘X’. not be accepted. accepted.
TC-08 Digit sum of 10 digit Output data. Single digit sum. Single digit sum. SUCCESS
is in single number.
TC-09 Check if Count is If it is true then Go to ADD-DIGIT. Go to ADD- SUCCESS
less than 10 process go to ADD DIGIT.
(count<10). DIGIT.
TC-10 Check if Count is If it is false then will Should not Go to Should not Go to SUCCESS
less than 10 not process goto ADD-DIGIT. ADD-DIGIT.
(count<10). ADDDIGIT .

OUTPUT:-

SUM OF INDIVIDUAL DIGITS

Enter the number:1234567897

Sum of individual digits are:7

Ex.No.02
STUDENT MARKSHEET RESULT

AIM:
To test a C program to accept the inputs student name, marks in five subjects and declare the
results as pass if the student gets minimum 40 in each subject, otherwise declare the result as
FAIL.

ALGORITHM:

Step 1: Start the process

Step 2: Declare the header file at a top of the program.

Step 3: Declare the main function under it declare the required variables such as

rollno,name,m1,m2,m3,m4,m5.

Step 4: Get the name and roll number and five subject marks from the user using get statement.

Step 5: The marks are checked using if statement and finally the result is displayed “pass” or

“Fail”.

Step 6: Stop the process.

SOURCE CODE:

#include<stdio.h>
#include<conio.h>
void main()
{
int rollno, m1,m2,m3,m4,m5;
char name[30];
printf(“enter roll no:”);
scanf(“%d”, &rollno);
printf(“enter name:”);
scanf(“%s”, &name);
printf((“enter marks for 5 subjects:”);
scanf(“%d%d%d%d%d”,&m1,&m2,&m3,&m4,&m5);
if ( (m1<40)||(m2<40)||(m3<40)||(m4<40)||(m5<40))
{
printf(“RESULT IS FAIL”);
}
else
{
printf(“RESULT IS PASS”);
}
getch();
}
TEST CASES:

TEST- TEST EXPECTED ACTUAL


TEST STEPS STATUS
ID DESCRIPTION OUTPUT OUTPUT
TC-01 Input case- 1.Enter the student name Accept name in Accepted name in SUCCESS
Positive. as characters character and character and
2. Enter marks for 5 marks in real. marks in real.
subjects as (min-0,max-
100) as real number.
TC-02 Input case- 1.Enter the student name “Kindly Input the “Kindly Input the SUCCESS
Negative. as characters valid data”. valid data”.
2.Enter marks for 5
subjects as (min-0,max-
100) as integer num.
TC-03 Process case- Check the entered marks Produce the result Produce the result SUCCESS
check for pass- with the constraint as PASS. as PASS.
positive. (all marks>=40).
TC-04 Process case- Check the entered marks Produce the result Produce the result SUCCESS
check for fail- with the constraint as FAIL. as FAIL.
negative. (all 5 marks <40).
TC-05 Output case- 1. Title of the program. 1. Produce the 1. Produce the SUCCESS
check for the 2. Input query. result of the result of the
formatted output. 3. Output query. student. student.
4. Line space. 2. Enter the name 2. Enter the name
of the student. of the student.
3. Result of the 3. Result of the
student P/F. student P/F.
TC-06 Check all the If it is true then the result The result is PASS. The result is PASS SUCCESS
subjects marks are will be PASS.
greater than 39
(marks>39).
TC-07 Check all the If it is false then the result The result is FAIL. The result is FAIL. SUCCESS
subjects marks are will be FAIL.
greater than 39
(marks>39).
TC-08 INPUT-display In Input-Para All the Data are All the Data are SUCCESS
case. get all the Inputs. Inserted. Inserted.
TC-09 OUTPUT-display In Output-Para All the Data are All the Data are SUCCESS
case. Put all the data. Displayed. Displayed.
TC-10 Condition. Check the student has got The student is pass. The student is pass. SUCCESS
PASS in all Subjects.

OUTPUT :-

STUDENT MARKLIST

Enter the Name: S.KAVITHA


75
60
95
88
78

THE RESULT IS PASS

Ex.No.03

GENERATING PRIME NUMBERS

AIM:

To test a C program for generating prime numbers to a given number as input.

ALGORITHM:

Step 1: Start the process.

Step 2: Declare the variables as integer for n, i, j, y.

Step 3: Take the integer variable i, divide the variable i with (i-1 to 2)

Step 4: If variable i is divisible by any value (i-1 to 2 ) it is not prime, otherwise it is prime.

Step 5: Get the flag value as 0 as 1 to generate the prime numbers.

Step 6:Display the prime numbers generated using print statement.

Step 7: Stop the process.

SOURCE CODE:

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j,y;
clrscr();
printf("\n\t\t\t Generating prime numbers");
printf("\n\n\tEnter the value for n:");
scanf("%d",&n);
printf("\n\n\t**Prime numbers between 1 to \%d**\n",n);
printf("\n\t1 is neither or not prime number\n");
for(i=2;i<=n;i++)
{
y=0;
for(j=2;j<i;j++)
{
if(i%j==0)
{
y=1;
break;
}
}
if(y==0)
{
printf("\n\tprime number:%d",i);
}
}
getch();
}

TEST CASES:

TEST
TEST EXPECTED ACTUAL
- TEST STEPS STATUS
DESCRIPTION OUTPUT OUTPUT
ID
TC-01 Input case- Enter the n number as Accept Input when Accepted Input is SUCCESS
Positive. integer for generating n is an integer of the type int
prime numbers.
TC-02 Input case- Enter the n number as “Kindly Input a “Kindly Input a SUCCESS
Negative. character for generating valid Data”. valid Data”.
prime numbers.
TC-03 Process case- Check Type the number in Accept the values Accepted the SUCCESS
whether it producing a integer until it generates in integers. values in integers.
list of prime numbers– the sequence
Positive.
TC-04 Process case- Check Type the number in Don’t accept the Not accepting the SUCCESS
whether it is integer until it produces value if it produce values.
prompting to enter a a prime number format. a final output as
number starts from 1- another format.
Negative.
TC-05 Output case- Check 1. Title of the program. PRIME PRIME SUCCESS
for the formatted 2. Input query. FORMAT enters FORMAT enters
output. 3. Output query. the respective no. the respective no.
Display prime no. Display prime no.
TC-06 INPUT-CASE Enter the date as Accept the date. Accepted the date. SUCCESS
DDMMYY format.
TC-07 DATE-CASE. Convert the date as Accept the Accepted the SUCCESS
character. characters. characters.
TC-09 DISP-CASE. Display the generated The prime numbers The prime number SUCCESS
number. list will be list is displayed.
displayed.

OUTPUT :-
Enter the value of n
7

**Prime numbers between 1 to5**

2357

Ex.No: 4

SORTING AND MERGING OF ARRAY ELEMENTS

AIM:

To test a C program to sort and store the elements of two arrays of type integers into the
third list.

ALGORITHM:

Step 1: Start the process.

Step 2: Declare the variables required inside the main function.

Step 3: Initialize the size for the input array variables to zero using a loop.

Step 4: Enter the size of an array and the elements in array 1 and array2 during runtime.

Step 5: Compare the elements of array1 and array 2 using decision making statement and sort the
elements.
Step 6:The sorted list of array1 and array2 are merged and stored as values in array3.

Step 7: Stop the Process.


SOURCE CODE
#include <stdio.h>
void main()
{
int array1[50], array2[50], array3[100], m, n, i, j, k = 0;
printf("\n Enter size of array Array 1: ");
scanf("%d", &m);
printf("\n Enter sorted elements of array 1: \n");
for (i = 0; i < m; i++)
{
scanf("%d", &array1[i]);
}
printf("\n Enter size of array 2: ");
scanf("%d", &n);
printf("\n Enter sorted elements of array 2: \n");
for (i = 0; i < n; i++)
{
scanf("%d", &array2[i]);
}
i = 0;
j = 0;
while (i < m && j < n)
{
if (array1[i] < array2[j])
{
array3[k] = array1[i];
i++;
}
else
{
array3[k] = array2[j];
j++;
}
k++;
}
if (i >= m)
{
while (j < n)
{
array3[k] = array2[j];
j++;
k++;
}
}
if (j >= n)
{
while (i < m)
{
array3[k] = array1[i];
i++;
k++;
}
}
printf("\n After merging: \n");
for (i = 0; i < m + n; i++)
{
printf("\n%d", array3[i]);
}
getch();
}

TEST CASES:

TEST
TEST EXPECTED ACTUAL
- TEST STEPS STATUS
DESCRIPTION OUTPUT OUTPUT
ID
Input case- Enter the Input should be an
TC-01 Valid Valid SUCCESS
size of 2 arrays. integer value.
Input case- Enter the If input is float or
TC-02 Invalid Invalid SUCCESS
size of 2 arrays. character.
Input case -Enter the Input should be an
TC-03 Valid Valid SUCCESS
elements of arrays. integer value.
Input case -Enter the If input is float or
TC-04 Invalid Invalid SUCCESS
elements of arrays. character.
Process case -First
and second array It should be in sorted
TC-05 Valid Valid SUCCESS
elements (while order.
merging).
Process case -First
and second array It should be in unsorted
TC-06 Invalid Invalid SUCCESS
elements (while order.
merging).
Array elements are
Process case -First
compared and largest
TC-07 and second array Valid Valid SUCCESS
element is added to the
elements are merged.
third array.
Array elements are
Process case -First
compared and largest
TC-08 and second array Invalid Invalid SUCCESS
element is added to the
elements are merged.
third array.
Output case –Check
Produce Third array in
TC-09 for the formatted Valid Valid SUCCESS
sorted order.
output.
Output case –Check
Produce Third array in
TC-10 for the formatted Valid Valid SUCCESS
unsorted order.
output.
OUTPUT :-
Enter the limit of first array:3
Enter the elements of first array
4
5
6
Enter the limit of second array:3
Enter the elements of second array
1
2
3
Sorted First array:
4 5 6
Sorted second array
1 2 3

The merged list:


1 2 3 4 5 6

Ex.No: 5

STACK OPERATIONS

AIM:

To test C program to experiment the operations of a stack using array implementation.

ALGORITHM:

Step 1: Start the process.

Step 2: Declare the variables as stack, top, i and choice for stack operation.

Step 3: Get the input for the size of the stack and the elements in the stack.

Step 4: Check using theif condition to validate when the maximum size of stack occursin

overflow.

Step 5: Use top=top+1 to increment the top 1, to push the elements at the top of stack, and then

check whether the stack is empty using (top==0).


Step 6: Display the elements of stack and use exit() to exit from the screen.

Step 7: Stop the Process.

SOURCE CODE:
#include<stdio.h> //preprocessor directives
#include<conio.h>
void main()
{
int stack[10],t,top=0,i,choice,item,size; //variable declaration
clrscr(); //clearing the screen
printf("Enter the size of stack:");
scanf("%d",&size); //To read size of stack
do
{
printf("\n\t\t\t Stack Operations"); // Displays menu(options)
printf("\n1.Push");
printf("\n2.Pop");
printf("\n3.Show");
printf("\n4.Exit");
printf("\n Enter your choice:");
scanf("%d",&choice); // To read the option from menu
switch(choice)
{
case 1: // To perform push operation
if(top>=size) /*Top reaches maximum size of stack
then stack overflow*/

{
printf("\n Stack Overflow");
break;
}
else
printf("Enter the item to push:");
scanf("%d",&item); // read new item to push
stack[top]=item; // push element at top of stack
top=top+1; // Incrementing top
break;
case 2: //To perform pop operation
if(top==0) // if Top equal to zero then stack is empty
{
printf("\n Stack Underflow");
break;
}
else
top--; //Decrementing top
t=stack[top]; //moving top element to temporary variable

printf("The popped item is %d",t); /* displaying the popped


element */
break;
case 3: //To Display the elements of stack
if(top==0) // if Top equal to zero then stack is empty
{
printf("Stack Under flow");
break;
}
else
{
printf("The elements in Stack are\n");
for(i=top;i>0;i--)
{
printf("%d\n",stack[i]); // Displays elements of stack
}
}
break;
case 4:
exit(0); //To exit from the screen
}
}while(1);
}

TEST CASES:

TEST
TEST EXPECTED ACTUAL
- TEST STEPS STATUS
DESCRIPTION OUTPUT OUTPUT
ID
TC-01 Input case- Enter the It should be an integer Valid Valid SUCCESS
size of stack. value.
TC-02 Input case- Enter the If input is float or Invalid Invalid SUCCESS
size of stack. character.
TC-03 Input case -Enter the It should be an integer Valid Valid SUCCESS
choice to perform the value.
specified action.
TC-04 Input case -Enter the If input is float or Invalid Invalid SUCCESS
choice to perform the character.
specified action.
TC-05 Process case – Initialize the top=0 then Valid Valid SUCCESS
INSERTION: Enter it is incremented.
the choice as push.
TC-06 Process case – Initialize the top!=0 Invalid Invalid SUCCESS
INSERTION: Enter then it is decremented.
the choice as push.
TC-07 Process case – The top decremented by Valid Valid SUCCESS
DELETION: Enter one and it displays the
the choice as pop. popped element.
TC-08 Process case – The top incremented by Invalid Invalid SUCCESS
DELETION: Enter one and it displays the
the choice as pop. popped element.
TC-09 Output case –Check If valid choice is given Valid Valid SUCCESS
for the formatted perform the specific
output. task.
TC-10 Output case –Check If valid choice is given Invalid Invalid SUCCESS
for the formatted perform the specific
output. task.

OUTPUT :-
Enter the size of stack:3
Stack Operations
1.Push
2.Pop
3.Show
4.Exit
Enter your choice:1
Enter the item to push:1

Enter your choice:1


Enter the item to push:2

Enter your choice:1


Enter the item to push:3

Enter your choice:1


Stack Overflow

Enter your choice:3


The elements in Stack are
3
2
1

Ex.No: 6

QUEUE OPERATIONS
AIM:

To test a C program to experiment the operations of a queue and to perform the


following:

1. Insertion
2. Deletion
3. Modification
4. List

ALGORITHM:

Step 1:Declare one-dimensional array and an integer pointer variable and variables for insertion,
loops, option and size.

Step 2: Read the input for the size of the queue.

Step 3: The queue operation is performed using menu driven program and the menu includes a
number of choice.

1. Insertion, 2. Deletion, 3. Modification, 4. Listing of elements

Step 4: If the choice is 1, and it checks the condition whether the rear is equal to size and if it is
false then, else part is executed, i.e., it increments the rear and the new element is added.

Step 5: If the choice is 2, and it checks the condition whether the rear is equal to zero and if it is
false then, else part is executed, i.e., it will delete an element from the front of queue and the
remaining elements are moved one position front and rear is decremented.

Step 6: If the choice is 3, and it checks the condition whether the rear is equal to zero and if it is
false then, else part is executed, i.e., it lists the elements present in the queue.

Step 7: If the choice is 4, and it checks the condition whether the rear is equal to zero and if it is
false then, else part is executed, i.e., it replaces the element in the queue by the new element.

Step 8: If the choice is Invalid, then it displays the statement choose the correct option.

Step 9: Displays the output.

SOURCE CODE:
#include<stdio.h>
#include<conio.h>//preprocessor directives
void main()
{
int *queue[15],q[15];
int n=0,i=0,opt,s=0,newval,size; //variable declaration
clrscr(); // clearing screen
printf("\n\t\t\t <=QUEUE OPERATIONS=>");
printf("\n\t\t\t ====================");
printf("\n\n Enter Size: ");
scanf("%d",&size); //To read size of queue
do
{
printf("\n\n\t MENU\n\t _______”);
printf(“\n\n\t 1.Insert"); // Displays menu
printf("\n\n\t 2.Delete\n\n\t 3.List\n\n\t 4.Modify\n\n\t 5.Exit");
printf("\n Enter your choice (1-5): ");
scanf("%d",&opt); //To read choice from menu
switch(opt)
{
case 1: // To insert an element
clrscr();
if(n==size) //If rear reaches maximum size then queue is full
printf("\n Queue Full");
else
{
n++; // Incrementing rear end
printf("\n Enter the new element: ");
scanf("%d",&q[n]); //read new element to insert
queue[n]=&q[n]; //new element is copied to queue
printf("\n The new element %d is added to queue",q[n]);
}
break;
case 2: // To delete an element
clrscr();
if(n==0) //If front is zero then queue empty
printf("\n Queue Empty");
else
{
printf("\n The Element %d is deleted",q[1]);
for(i=1;i<=n;i++)
{
*queue[i]=*queue[i+1]; //moving all elements one position front
}
queue[i]=0;
n--; // Decrementing rear end
}
break;
case 3: // To list the elements
if(n==0) //If front is zero then queue empty
printf("\n Queue is empty");
else
{
printf("\n Queue:(front)");
for(i=1;i<=n;i++) //To display the elements of queue
printf("%5d",*queue[i]);
printf(" (Rear)");
}
break;
case 4: //To modify the element of queue
if(n==0) //If front is zero then queue empty
printf("\n Queue Empty");
else
{
printf("\n Enter the position of element to be modified: ");
Re_enter:
scanf("%d",&s); //To read the position of queue
if(s>n) /*If position is greater than size of queue
it again pass the control to read valid position*/
{
printf("\n Enter position between [p1-%d]",n);
goto Re_enter;
}
printf("\n The element at %d is %d",s,*queue[s]);
printf("\n Enter new element: ");
scanf("%d",&newval); //Read the new element
*queue[s]=newval; //Insert the element in respective position
}
break;
case 5: //To exit from menu
exit(0);
default:
printf("\n Choose correct option");
}
}while(1);
}

TEST CASES:

TEST TEST DESCRIPTION TEST STEPS EXPECTED ACTUAL STATUS


-
OUTPUT OUTPUT
ID
TC-01 Input case- Enter the It should be an Valid Valid SUCCESS
size of queue. integer value.
TC-02 Input case- Enter the If input is float or Invalid Invalid SUCCESS
size of queue. character.
TC-03 Input case -Enter the It should be an Valid Valid SUCCESS
choice to perform the integer value.
specified action.
TC-04 Input case -Enter the If input is float or Invalid Invalid SUCCESS
choice to perform the character.
specified action.
TC-05 Process case – The rear is Valid Valid SUCCESS
INSERTION: If the rear incremented.
is equal to size then the
queue is full or else a
new element can be
inserted.
TC-06 Process case – The rear is Invalid Invalid SUCCESS
INSERTION: If the rear decremented.
is equal to size then the
queue is full or else a
new element can be
inserted.
TC-07 Process case – Remaining elements Valid Valid SUCCESS
DELETION: If an other than first are
element is deleted from moved to front.
the queue.
TC-08 Process case – Remaining elements Invalid Invalid SUCCESS
DELETION: If an other than first are
element is deleted from moved to front.
the queue
TC-09 Output case –Check for If valid choice is Valid Valid SUCCESS
the formatted output. given perform the
specific task.
TC-10 Output case –Check for If valid choice is Invalid Invalid SUCCESS
the formatted output. given perform the
Function.

OUTPUT :-
Enter Size: 3
MENU
1.Insert
2.Delete
3.List
4.Modify
5.Exit

Enter your choice:1


Enter the new element: 1
The new element 1 is added to queue

Enter your choice:1


Enter the new element: 2
The new element 2 is added to queue

Enter your choice:1


Enter the new element: 3
The new element 3 is added to queue

Enter your choice:1


Queue Full

Enter your choice: 3


Queue:(front) 1 2 3 (Rear)

Enter your choice : 4


Enter the position of element to be modified: 2
The element at 2 is 2
Enter new element: 77

Enter your choice :3


Queue:(front) 1 77 3 (Rear)

Enter your choice:2


The Element 1 is deleted
Enter your choice: 3

Queue:(front) 77 3 (Rear)
Enter your choice (1-5): 5

Ex.No: 7

PALINDROME STRING CHECKING


AIM:

To test the C++ program: Palindrome string checking program using pointers.

ALGORITHM:

Step 1:Declare two variables s and r and two pointer variables strt and estr of any size.

Step 2: Enter the string and store it in s.

Step 3: Copy the string s or r.

Step 4: The length of the string s

Step 5: Using for loop, swap the variable to temporary variable ch.

Step 6: The values of s is assigned to pointer variable strt. The values of r are assigned to pointer
variable rstr.

Step 7: Display the reversed string.

Step 8: Compare the pointer variable rstr and strt in if statement.

Step 9: If the condition is true, display strt is not a palindrome, else display strt is a palindrome.

Step 10: Invoke the member function using the object.

Step 11: Stop the process.

SOURCE CODE:
#include <iostream.h>
//#include <math.h>
#include <string.h>
#include <conio.h>
void main()
{
char original[20],reversed[20];
int length;
clrscr();
cout <<"Enter a string"<<endl;
cin>>original;
length=strlen(original);
strcpy(reversed,original);
for (int i=0;i<=length-1;i++)
{
reversed[length-1-i]=original[i];
}
cout <<original<<" "<<reversed<<endl;

if(strcmp(reversed,original)==0)
cout<<"It is a palindrome";
else
cout<<"It is not a palindrome";
getch();
}

TEST CASES:

TEST
TEST EXPECTED ACTUAL
- TEST STEPS STATUS
DESCRIPTION OUTPUT OUTPUT
ID
TC-01 To check the character Declare the character Character variable Character variable
SUCCESS
variable. variable. should be present. is present.
TC-02 To check the integer Declare the Integer Integer variable Integer variable is
SUCCESS
variable. variable. should be present. present.
TC-03 It should accept the
Enter the string. Accept the value. Value accepted. SUCCESS
value.
TC-04 Get the length of the String length is It should give the Produced the string
SUCCESS
string. calculated. string length. length.
TC-05 It should copy the Copied the string
Get duplicate copy of Copy the string from
string from original from original to SUCCESS
the string. original to reversed.
to reversed. reversed.
TC-06 It should produce
Check the reversed Fetch the reverse of Produce the string
the string in reverse SUCCESS
process statement. the string. in reverse order.
order.
TC-07 Check the both It should display Displayed
Both is same it is
variable original and ”IT IS ”IT IS SUCCESS
called palindrome.
reverse. PALINDROME”. PALINDROME”.
TC-08 Check the both It should display Displayed
Both is not same it is
variable original and “IT IS NOT A “IT IS NOT A SUCCESS
called palindrome.
reverse. PALINDROME”. PALINDROME”.
TC-09 Process case: Using for() loop The string Should The string is
SUCCESS
For() loop. reverse the string. be reversed. reversed.
TC-10 Check whether the if
Process case: SUCCESS
statement Both are Palindrome. Palindrome.
If condition.
not equal.
TC-11 Check whether the if
Process case:
statement Both are Not a palindrome. Not a palindrome. SUCCESS
If condition.
not equal.
OUTPUT :-

Palindrome or not using pointers


Enter The String : malayalam
The given string is a palindrome

Palindrome or not using pointers

Enter The String : GOD


The given string is not a palindrome

ENHANCEMENT:

Ex. No. 1:

DEVELOP TESTCASES FOR A C++ PROGRAM USING WHITE BOX TESTING

AIM:

To develop test cases for theC++ program using white box testing: To find the week day
from a given date.

ALGORITHM:

Step 1:Start the process.

Step 2: Enter the given number in variable n as the given date.

Step 3: Using multi-way decision making statement, check the number given in variable n.

Step 4: If the given option is true, display the corresponding day given, else if the number is
invalid, display it as Invalid number.

Step 5: For the given decision making statement, develop the multiple condition coverage testing
for all cases.

Step 6: Depending on the n values the day will displayed.

Step 7: Stop the process.

FLOW GRAPH CASE STRUCTURE:

1
SOURCE CODE:

#include<iostream>
#include<conio.h>
int main()
{
int n;
cout<<”Enter number for day: “;
cin>>n;

switch(n)
{
case 1: cout<<”Sunday”; break;

case 2:
cout<<”Monday”;
break;

case 3:
cout<<”Tuesday”;
break;

case 4:
cout<<”Wednesday”;
break;

case 5:
cout<<”Thursday”;
break;

case 6:
cout<<”Friday”;
break;

case 7:
cout<<”Saturday”;
break;

default:
cout<<”Invalid number!”;
break;
}
return 0;
}

TEST CASES:

TEST
TEST EXPECTED ACTUAL
- TEST STEPS STATUS
DESCRIPTION OUTPUT OUTPUT
ID
TC-01 To check the integer Declare the integer Integer variable Integer variable is
SUCCESS
variable. variable. should be present. present.
It should accept the
Enter the number. Accept the value. Value accepted. SUCCESS
TC-02 value.
Using Case structure Depends on the n
Process case:
TC-03 its checks the n value the day will Print the Day. SUCCESS
Case structure.
value. matched.
Using Case structure Depends on the n
Process case:
TC-04 its checks the n value the day will Invalid n value. FAILURE
Case structure.
value. matched.
TC-06 It should produce
Check the reversed Fetch the reverse of Produce the string
the string in reverse SUCCESS
process statement. the string. in reverse order.
order.
TC-07 Check the both It should display Displayed
Both is same it is
variable original and ”IT IS ”IT IS SUCCESS
called palindrome.
reverse. PALINDROME”. PALINDROME”.
TC-08 Check the both It should display Displayed
Both is not same it is
variable original and “IT IS NOT A “IT IS NOT A SUCCESS
called palindrome.
reverse. PALINDROME”. PALINDROME”.
TC-09 Process case: Using for() loop The string Should The string is
SUCCESS
For() loop. reverse the string. be reversed. reversed.
TC-10 Check whether the if
Process case: SUCCESS
statement Both are Palindrome. Palindrome.
If condition.
not equal.
TC-11 Check whether the if
Process case:
statement Both are Not a palindrome. Not a palindrome. SUCCESS
If condition.
not equal.

MULTIPLE CONDITION COVERAGE:


READ N
IF (N= =1)
PRINT “SUNDAY”
IF (N= =2)
PRINT “MONDAY”
IF (N= =3)
PRINT “TUESDAY”
IF (N= =4 )
PRINT “WEDNESDAY”
IF (N= =5)
PRINT “THURSDAY”
IF (N= =6)
PRINT “FRIDAY”
IF (N= =7)
PRINT “SATURDAY”
ELSE
PRINT “INVALID NUMBER”

OUTPUT:
Enter number for day:1
Sunday

Ex. No. 2:

DEVELOP SOFTWARE REQUIREMENT SPECIFICATION DOCUMENT IN IEEE


FORMAT FOR LIBRARY MANAGEMENT SYSTEM.

Scope:
The document only covers the requirements specifications for the Library Management
System. This document does not provide any references to the other component of the Library
Management System. All the external interfaces and the dependencies are also identified in
this document.
Feasibility study:
The overall scope of the feasibility study was to provide sufficient information to allow a
decision to be made as to whether the Library Management System project should proceed
and if so, its relative priority in the context of other existing Library Management Technology.
The feasibility study phase of this project had undergone through various steps which as
describe as under:
 Identity the origin the information at different level.
 Identity the expectation of user from computerized system.
Analyze the drawback of existing system(manual system)
Overview:
The implementation of Library Management starts with entering and updating master records
like book details, library information. Any further transaction like book issue, book return will
automatically update the current books.
Overall Description:
Product Perspective:
The proposed Library Management System will take care of the current book detail at any point
of time. The book issue, book return will update the current book details automatically so that
user will get the update current book details.

Product function:
 The main purpose of this project is to reduce the manual work.
 This software is capable of managing Book Issues, Returns, and Calculating/Managing Fine.
 Generating various Reports for Record-Keeping according to end user requirements
User characteristics:
They have 2 levels of users

 User module: In the user module, user will check the availability of the books.
 Book return
 Administration module: The following are the sub module in the administration module.
 Register user
 Entry book details
 Book issue

General Constraints:
Any update regarding the book from the library is to be recorded to have update & correct
values.
Assumption and dependencies:
All the data entered will be correct and up to date. This software package is developed using
java as front end which is supported by sun micro system. Microsoft SQL server 2005 as the
back end which is supported by Window 7.
Specific Requirement:
External Interface Requirement:
                The user should be simple and easy to understand and use. Also be an interactive
interface .The system should prompt for the user and administrator to login to the application
and for proper input criteria
User Interface:
The software provides good graphical interface for the user any administrator can operate on the
system, performing the required task such as create, update, viewing the details of the book.

 Allows user to view quick reports like Book Issues/Returned etc in between particular time.
 Stock verification and search facility based on different criteria.

Hardware interface:

 Operating system : window


 Hard disk :40 GB
 RAM : 256 MB
 Processor : Pentium(R)Dual-core CPU

Software interface :

  Java language
 Net beans IDE 7.0.1
 MS SQL server 2005

 Communication interface:
Window
Functional requirements:

 Book entry: In this module we can store the details of the books.
 Register student: in this module we can keep the details of the new student.
 Book issue: This module is used to keep a track of book issue details.
 Book return: This module enables to keep a track of return the books.

Performance requirements:
The capability of the computer depends on the performance of the software. The software can
take any number of inputs provided the database size is larger enough. This would depend on
the available memory space.
Design constraints :
Each member will be having a identity card which can be used for the library book issue, fine
payment etc. whenever library member wish to take a book, the book issued by the library
authority will be check both the book details as well as the student details and store it in library
database. In case of retrieval of book much of human intervention can be eliminated.
 System attributes :

 Maintainability: There will be no maintained requirement for the software. The database is
provided by the end user and therefore is maintained by this user.
 Portability: The system is developed for secured purpose, so it is can’t be portable.
 Availability: This system will available only until the system on which it is install, is
running.
 Scalability: Applicable.

You might also like