Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
#include<stdio.h>intmain()
{
long int num;int sum=0,rem;clrscr();
printf("enter a number:");scanf("%ld",&num);while(num/10!=0)
{
sum=0;while(num!=0)
{
rem=num%10;sum+=rem;num=num/10;
}
num=sum;
}
printf("%d",sum);getch();
return0;
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUAL OUTPUT
STATUS
TC-01
Inputcase-Positive.
Enter thenumber inrespect ofany numberof digits asinteger.
Acceptintegerinrespectofanynumberofdigits.
Acceptedinteger inrespect ofany numberof digits.
SUCCESS
TC-02
Inputcase-Negative.
Enter thenumber inrespect ofanynumber
of digits asreal.
Kindly input thevaliddata.
Acceptedonly theinteger partandneglect
thedecimalvalues.
FAILURE
TC-03
Process case-Check whether itproducing a singledigit-positive.
Add thedigit one byone until itproduces asingledigit.
Accept thecorrectvalueofthe singledigit.
Acceptedthecorrect valueof the singledigit.
SUCCESS
TC-04
Process case-Check whether itproducing a singledigit-Negative.
Add thedigit one byone until itproduces asingledigit.
Don’tacceptthevalue if itproduces a finaloutputmorethan onedigit.
Don’t acceptthevalueifitproduces afinal outputmorethan
onedigit.
SUCCESS
TC-05
Outputcase-checkfor the formattedoutput.
Title ofthe
program.
Inputquery.
Outputquery.
Linespace.
Addition ofdigitsin ano.
Enter thenumber
<Acceptnumberinnextline>.
The sum ofdigitnumberis
<result.
Additionofdigitsina
no.
Enter thenumber
<Acceptnumber innextline>.
Thesumof digit
number is <result.
SUCCESS
TC-06
Acceptanceof10digitinput data.
Input 10digitnumber.
Accepted 10Digitnumber.
Accepted10Digitnumber.
SUCCESS
TC-07
Non-acceptanceofcharacterdata.
Input acharacterdata‘X’.
Character Xshould not beaccepted.
Characterdata notaccepted.
SUCCESS
TC-08
Digit sum of 10digit is in singlenumber.
Outputdata.
Single digitsum.
Single digitsum.
SUCCESS
TC-09
Check if Count isless than 10(count<10).
If it is truethenprocessgoto ADDDIGIT.
Go to ADD-DIGIT.
Go to ADD-DIGIT.
SUCCESS
TC-10
Check if Count isless than 10(count<10).
Ifitisfalsethen willnotprocessgoto
ADDDIGIT.
Should not GotoADD-DIGIT.
Should notGo to ADD-DIGIT.
SUCCESS
2.
SOURCECODE :
#include<stdio.h>#include<conio.h>voidmain()
{
int rollno,m1,m2,m3,m4,m5;charname[30];
clrscr();
printf("enter rollno:");scanf("%d",&rollno);printf("enter name:");scanf("%s",&name);
printf("entermarks for 5subjects:");scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5);if((m1<40)||(m2<40)||(m3<40)||(m4<40)||(m5<40))
{
printf("RESULTISFAIL");
}
else
{
printf("RESULTISPASS");
}
getch();
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUAL OUTPUT
STATUS
TC-01
Inputcase-Positive.
Enter thestudentnameascharacters
Entermarksfor5subjects
as (min-0,max-100)as
realnumber.
Acceptnamein characterand marks inreal.
Acceptedname incharacterandmarksinreal.
SUCCESS
TC-02
Inputcase-Negative.
1.Enter thestudentnameas characters2.Enter marksfor 5 subjectsas (min-0,max-100)asintegernum.
“Kindly Inputthe validdata”.
“KindlyInput thevaliddata”.
SUCCESS
TC-03
Processcase-checkforpass-positive.
Check theenteredmarkswith theconstraint
(allmarks>=40).
Producetheresult asPASS.
Producethe resultasPASS.
SUCCESS
TC-04
Processcase-checkforfail-negative.
Check theenteredmarkswith theconstraint
(all5marks
<40).
Producetheresult asFAIL.
Producethe resultasFAIL.
SUCCESS
TC-05
Outputcase-checkfor the formattedoutput.
Title of theprogram.
Inputquery.
Outputquery.
Linespace.
Producethe result ofthestudent.
Enter thenameofthe
student.
Result ofthestudent
P/F.
Producetheresult
of thestudent.
Enterthename
of thestudent.
Resultof thestudent
P/F.
SUCCESS
TC-06
Check all thesubjectsmarksaregreater than 39(marks>39).
If it is truethentheresultwillbePASS.
TheresultisPASS.
Theresultis PASS
SUCCESS
TC-07
Check all thesubjectsmarksaregreater than 39(marks>39).
If it is falsethentheresultwillbeFAIL.
TheresultisFAIL.
TheresultisFAIL.
SUCCESS
TC-08
INPUT-displaycase.
InInput-Entermarks for 5subjects
All the Dataareaccepted.
All theData areaccepted.
SUCCESS
TC-09
OUTPUT-displaycase.
In Output-Print theresult.
All the DataareDisplayed.
All theData areDisplayed.
SUCCESS
TC-10
Condition.
Check thestudent hasgotPASSin
allSubjects.
The student ispass.
Thestudent ispass.
SUCCESS
3.
SOURCECODE :
#include<stdio.h>#include<conio.h>voidmain(){
int n,i,j,y;
clrscr();
printf("ntttGenerating prime numbers");printf("nntenter the value for n:");scanf("%d",&n);
printf("nnt**prime numbers between 1to%d**n",n);printf("nt1 is neither or not prime numbern");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("ntprimenumber:%d",i);
}
}
getch();
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUALOUTPUT
STATUS
TC-01
Inputcase-
Enterthen
AcceptInput
Accepted
SUCCESS
Positive.
numberas
whennisan
Inputisof
integerfor
integer
the typeint
generating
prime
numbers.
TC-02
Inputcase-
Enterthen
“KindlyInputa
“Kindly
SUCCESS
Negative.
numberas
validData”.
Inputa
characterfor
validData”.
generating
prime
numbers.
TC-03
Processcase-
Typethe
Acceptthe
Accepted
SUCCESS
Checkwhetherit
numberin
valuesin
thevalues
producinga listof
integeruntil
integers.
inintegers.
primenumbers–
itgenerates
Positive.
thesequence
TC-04
Processcase-
Typethe
Don’taccept
Not
SUCCESS
Checkwhetheritis
numberin
thevalue ifit
accepting
promptingto enter
integeruntil
producea final
thevalues.
anumberstarts
itproducesa
outputas
from1-Negative.
prime
anotherformat.
number
format.
TC-05
Outputcase-Check
1. Title of
PRIME
PRIME
SUCCESS
fortheformatted
theprogram.
FORMAT
FORMAT
output.
2.Input
entersthe
entersthe
query.
respectiveno.
respective
3. Output
Displayprime
no.Display
query.
no.
primeno.
4.
SOURCECODE :
#include<stdio.h>#defineMAX20
voidbubble_sort(intarr[],intsize)
{
int i,j,temp;for(i=0;i<size;i++)
{
for(j=0;j<size-1;j++)
{
if(arr[j]>arr[j+1])
{
temp=arr[j];arr[j]=arr[j+1];arr[j+1]=temp;
}
}
}}
voidmerge(intarr1[],intsize1,intarr2[],intsize2,intarr3[])
{
int i=0;int j=0;intk=0;
while((i<size1)&&(j<size2))
{
if(arr1[i]<arr2[j])arr3[k++]=arr1[i++];
elsearr3[k++]=arr2[j++];
}
while(i<size1)arr3[k++]=arr1[i++];while(j<size2)arr3[k++]=arr2[j++];
}
main()
{
int arr1[MAX],arr2[MAX],arr3[40];int i,j,k;
int size1,size2;clrscr();
printf("enter the number of element in list1:");scanf("%d",&size1);
printf("take the elements:n");for(i=0;i<size1;i++)
{
printf("enter element %d:",i+1);scanf("%d",&arr1[i]);
}
bubble_sort(arr1,size1);
printf("enter the number of elements in list 2:");scanf("%d",&size2);
printf("take the element");for(i=0;i<size2;i++)
{
printf("enterelement%d:",i+1);
scanf("%d",&arr2[i]);
}
bubble_sort(arr2,size2);
merge (arr1,size1,arr2,size2,arr3);printf("nMerged list:");for(i=0;i<size1+size2;i++)printf("%d",arr3[i]);
printf("n");getch();return0;
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUAL OUTPUT
STATUS
TC-01
Input case- Enter thesizeofarrays.
Inputshouldbean integervalue.
Valid
Valid
SUCCESS
TC-02
Input case- Enter thesizeofarrays.
If input is floatorcharacter.
Invalid
Invalid
SUCCESS
TC-03
Input case -Enter theelementsofarrays.
Inputshouldbean integervalue.
Valid
Valid
SUCCESS
TC-04
Input case -Enter theelementsofarrays.
If input is floatorcharacter.
Invalid
Invalid
SUCCESS
TC-05
Process case -Firstand second arrayelements (whilemerging).
Itshouldbeinsortedorder.
Valid
Valid
SUCCESS
TC-06
Process case -Firstand second arrayelements(while
merging).
Itshouldbeinsortedorder.
valid
valid
SUCCESS
TC-07
Process case -Firstand second arrayelementsaremerged.
Arrayelementsare comparedand largestelement isadded to thethirdarray.
Valid
Valid
SUCCESS
TC-08
Process case -Firstand second arrayelementsaremerged.
Arrayelementsare comparedand largestelement isadded to thethirdarray.
Invalid
Invalid
SUCCESS
TC-09
Outputcase–Checkfor the formattedoutput.
Produce Thirdarrayinsortedorder.
Valid
Valid
SUCCESS
TC-10
Outputcase–Checkfor the formattedoutput.
Produce Thirdarray inunsortedorder.
InValid
InValid
SUCCESS
5.
SOURCECODE :
#include<stdio.h>#include<conio.h>voidmain()
{
int stack[10],t,top=0,i,choice,item,size;clrscr();
printf("enter the size of stack:");scanf("%d",&size);
do {
printf("nttstack operations:");printf("n1.push");
printf("n2.pop");
printf("n3.show");
printf("n4.exit");
printf("n enter your choice:");scanf("%d",&choice);switch(choice) {
case 1:if(top>=size) {
printf("n Stack overflow");break;
}
else
printf("enter the item to push:");scanf("%d",&item);stack[top]=item;
top=top+1;
break;case2:
if(top==0){
printf("n Stack underflow");break;
}
elsetop--;
t=stack[top];
printf("the popped item is%d",t);break;
case3:
if(top==0) {printf("stack underflow");break;
}
else{
printf("the elements inn stack aren");for(i=top;i>0;i--) {
printf("%dn",stack[i]);
}
}
break;case 4:exit(0);
} }
while(1);
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUALOUTPUT
STATUS
TC-01
Input case- Enterthesizeofstack.
Itshouldbeanintegervalue.
Valid
Valid
SUCCESS
TC-02
Input case- Enterthesizeofstack.
If input is float orcharacter.
Invalid
Invalid
SUCCESS
TC-03
Inputcase-Enterthe choice toperform thespecifiedaction.
Itshouldbeanintegervalue.
Valid
Valid
SUCCESS
TC-04
Inputcase-Enterthechoiceto
perform thespecifiedaction.
If input is float orcharacter.
Invalid
Invalid
SUCCESS
TC-05
Process case –INSERTION:Enter
thechoiceaspush.
Initialize thetop=0 then it isincremented.
Valid
Valid
SUCCESS
TC-06
Process case –INSERTION:Enter
thechoiceaspush.
Initialize thetop!=0 then it isdecremented.
Invalid
Invalid
SUCCESS
TC-07
Process case –DELETION:Enter
thechoiceaspop.
The topdecrementedbyone and itdisplaysthe
poppedelement.
Valid
Valid
SUCCESS
TC-08
Process case –DELETION:Enter
thechoiceaspop.
The topincremented byone and itdisplays thepoppedelement.
Invalid
Invalid
SUCCESS
TC-09
Outputcase–Checkfor the formattedoutput.
If valid choice isgivenperformthespecifictask.
Valid
Valid
SUCCESS
TC-10
Outputcase–Checkfor the formattedoutput.
If valid choice isgivenperformthespecifictask.
Invalid
Invalid
SUCCESS
6.
SOURCECODE :
#include<stdio.h>#include<conio.h>voidmain()
{
int*queue[15],q[15];
int n=0,i=0,opt,s=0,newval,size;clrscr();
printf("ntt<=QUEUE OPERATIONS=>");printf("nt=================");printf("nnentersize:");
scanf("%d",&size);do
{
printf("nntMENUnt ");
printf("nn1.Insert");printf("nnt2.deletennt3.Listnnt4.Modifynnt5.exit");printf("enteryourchoice(1-5):");
scanf("%d",&opt);switch(opt)
{
case1:
clrscr();if(n==size)
printf("n Queue full");else
{n++;
printf("n enter the new element:");scanf("%d",&q[n]);queue[n]=&q[n];
printf("nthenewelement%d isaddedtoqueue",q[n]);
}
break;case2:
clrscr();if(n==0)
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];
}
queue[i]=0;n--;
}
break;case3:
if(n==0)
printf("n Queue is empty");else
{
printf("n queue:(front)");for(i=1;i<=n;i++)printf("%5d",*queue[i]);
printf("(rear)");
}
break;case4:
if(n==0)
printf("nqueue empty");else
{
printf("n empty the position of element to be modified:");Re_enter:
scanf("%d",&s);if(s>n)
{
printf("n enter position between [p1-%d]",n);gotoRe_enter;
}
printf("n the element at%dis %d",s,*queue[s]);printf("n enter new element:");scanf("%d",&newval);
*queue[s]=newval;
}
break;case5:
exit(0);default:
printf("nchoosecorrectoption");
} }
while(1);
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUAL OUTPUT
STATUS
TC-01
Input case- Enter thesizeof queue.
It should be anintegervalue.
Valid
Valid
SUCCESS
TC-02
Input case- Enter thesizeof queue.
If input is floatorcharacter.
Invalid
Invalid
SUCCESS
TC-03
Input case -Enter thechoicetoperformthespecifiedaction.
It should be anintegervalue.
Valid
Valid
SUCCESS
TC-04
Input case -Enter thechoicetoperformthespecifiedaction.
If input is floatorcharacter.
Invalid
Invalid
SUCCESS
TC-05
Process case –INSERTION:Ifthe
rear is equal to sizethen the queue is fullorelseanewelementcanbeinserted.
The rear isincremented.
Valid
Valid
SUCCESS
TC-06
Process case –INSERTION:Ifthe
rear is equal to sizethenthequeueis full
orelseanewelementcanbeinserted.
The rear isdecremented.
Invalid
Invalid
SUCCESS
TC-07
Process case –DELETION:Ifan
elementisdeletedfromthequeue.
Remainingelementsotherthan first aremoved tofront.
Valid
Valid
SUCCESS
TC-08
Process case –DELETION:Ifan
elementisdeletedfromthequeue
Remainingelementsotherthan first aremoved tofront.
Invalid
Invalid
SUCCESS
TC-09
Outputcase–Checkfor the formattedoutput.
If valid choiceis givenperform thespecifictask.
Valid
Valid
SUCCESS
TC-10
Outputcase–Checkfor the formattedoutput.
If valid choiceis givenperform theFunction.
Invalid
Invalid
SUCCESS
7.
SOURCECODE:
#include <iostream>#include<string.h>
intmain(){
char string1[20];inti, length;
intflag =0;
cout<<"Enterastring: "; cin >>string1;
length=strlen(string1);
for(i=0;i<length;i++){
if(string1[i] != string1[length-i-1]){flag=1;
break;
}
}
if(flag){
cout<<string1<<" isnot apalindrome"<< endl;
}
else{
cout<<string1<<" isapalindrome"<< endl;
}
return0;
}
TESTCASES:
TEST-ID
TESTDESCRIPTION
TESTSTEPS
EXPECTEDOUTPUT
ACTUAL OUTPUT
STATUS
TC-01
To check thecharactervariable.
Declare thecharactervariable.
Charactervariableshouldbepresent.
Charactervariable ispresent.
SUCCESS
TC-02
Tochecktheintegervariable.
Declare theIntegervariable.
Integer variableshouldbepresent.
Integervariableispresent.
SUCCESS
TC-03
Enterthestring.
Acceptthevalue.
Itshouldacceptthevalue.
Valueaccepted.
SUCCESS
TC-04
Get the length of thestring.
String length iscalculated.
Itshouldgivethestringlength.
Produced thestringlength.
SUCCESS
TC-05
Getduplicatecopyof thestring.
Copy the stringfrom original toreversed.
Itshouldcopythestring fromoriginal toreversed.
Copiedthestringfrom original toreversed.
SUCCESS
TC-06
Checkthereversedprocessstatement.
Fetchthereverseof thestring.
Itshouldproducethe string inreverseorder.
Produce the stringinreverseorder.
SUCCESS
TC-07
Check the bothvariableoriginalandreverse.
Both is same it iscalledpalindrome.
It should display”ITISPALINDROME”.
Displayed”ITIS
PALINDROME”.
SUCCESS
TC-08
Checktheboth
variableoriginalandreverse.
Bothis not same it
is calledpalindrome.
Itshoulddisplay
“IT IS NOT APALINDROME”.
Displayed“ITISNOTA
PALINDROME”.
SUCCESS
TC-09
Process case:For()loop.
Using for() loopreversethestring.
The string Shouldbereversed.
The string isreversed.
SUCCESS
TC-10
Process case:Ifcondition.
Checkwhethertheif statement Botharenot equal.
Palindrome.
Palindrome.
SUCCESS
TC-11
Process case:Ifcondition.
Checkwhethertheif statement Botharenot equal.
Notapalindrome.
Notapalindrome.
SUCCESS
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team