Written test fucntion prints given 2d array in spiral fashion. give all test cases to test it
Software QA/Tests Interview Questions from Microsoft
(Continued from previous question...)
Written test
fucntion prints given 2d array in spiral fashion. give all test cases to test it
Q:
Microsoft Interview Question for Software Engineer in Tests about Testing
Written test
fucntion prints given 2d array in spiral fashion. give all test cases to test it
A;
void printSpiral( )
{
int A[3][3]={{1,3,4},{2,5,8},{6,7,9}};
int n =3; // array size
int i=0,j=0;
while( i+j < 2*n1 )
{
if( i > j )
{
while( i>=0 && j
{
printf("%d\t",A[i][j]);
i;
j++;
}
i++;
if(j > = n)
{
i++;
j = n1;
}
}
else if( i <= j )
{
while( j> =0 && i < n)
{
printf("%d\t",A[i][j]);
j;
i++;
}
j++ ;
if(i >= n)
{
i = n1;
j = j+1;
}
}
}
return;
}
Test cases:
Let us say array size A[m][n]
1) m==n
2) m != n
3) m very bigger than n i.e m>> n
4) n very bigger than n i.e n>> m
(Continued on next question...)
Other Interview Questions
