You are on page 1of 13

EXPERIMENT 07

Date of Performance: 17th Sept 2020

Date of Submission: 20 th Sept 2020

Name: sharayu kshirsagar

Roll No & Div: 01 [A]


1. Even odd Program
: #include <stdio.h> int
main() { int num;
printf("Enter an integer:
"); scanf("%d", &num);

// True if num is perfectly divisible by 2


if(num % 2 == 0) printf("%d is even.",
num); else printf("%d is odd.", num);

return 0; }

Test cases:
Test priority: High Test Designed Date: 2/8/2020

Module Name: Odd even Test Executed By: XYZ

Test Title: To test odd even program Test Execution Date: 1/8/2020

Description : To test odd even program in


C
Pre-conditions:

Sr. Test Test data Test steps Expected Actual Result Status
description Result

1. To enter a Input To enter the String should not As Expected Pass


string number : wrong input be accepted

2. To enter a Input To enter the Special As expected Pass


number: @ wrong input character should
special
not be accepted
character

3. To enter even Input To enter “2 is even” As expected Pass


number number : 2 a
number
To check if
it’s even or
odd by
dividing it by
2
4. To enter odd Input To enter “3 is odd” As expected Pass
number number : 3 a
number
To check if
it’s even or
odd by
dividing it by
2

2. Even odd testing

Test priority: High Test Designed Date: 2/8/2020


Module Name: Odd even Test Executed By: XYZ
Test Title: To test odd even program Test Execution Date: 1/8/2020
Description : To test odd even program in
C
Pre-conditions:
Sr. Test Test data Test steps Expected Actual Result Status
description Result

1. To enter Input To enter “4 is even” As Expected Pass


number 4 number : 4 a
number
To check if
it’s even or
odd by
dividing it by
2
2. To enter Input To enter “7 is odd” As expected Pass
number: 7 a
number 7
number
To check if
it’s even or
odd by
dividing it by
2
3. To enter Input To enter “2.5 is odd” As expected Pass
number 2.5 number : a
2.5 number
To check if
it’s even or
odd by
dividing it by
2
4. To enter Input To enter “8.1 is odd” As expected Pass
number 8.1 number : a
8.1 number
To check if
it’s even or
odd by
dividing it by
2

3. Program:
#include <stdio.h>

int main () {

/* local variable definition


*/ char day; printf"Enter a
char”); scanf(“%c",&day);
switch(grade) { case 'A' :
printf(“Monday \n" );
break; case 'B' :

printf(“Tuesday”);
break; case 'C' :
printf(“Wednesday”);
break; case ‘D' :
printf("Thrusday \n" );
break; case 'D' :
printf("Friday \n" );
break; case 'F' :
printf("Saturday \n" );
break; case ‘G' :
printf(“Sunday");
break; default :
printf("Invalid \n" );
}
return 0;
}
Test priority: High Test Designed Date: 2/8/2020

Module Name: Days Test Executed By: XYZ

Test Title: To print the days Test Execution Date: 1/8/2020

Description : Using switch case

Pre-conditions: User should enter valid data

Sr. Test Test data Test steps Expected Actual Result Status
description Result

1. To enter input Input char: To enter a Monday As Expected Pass


as ‘A' A character
Check the
validity and
print the day

2. To enter input Input char: To enter a Tuesday As Expected Pass


as ‘B' B character
Check the
validity and
print the day

3. To enter input Input char: To enter a Wednesday As Expected Pass


as ‘C' C character
Check the
validity and
print the day

4. To enter input Input char: To enter Thursday As Expected Pass


as ‘D' D a
character
Check the
validity and
print the day
5. To enter input Input char: To enter a Friday As Expected Pass
as ‘E' E character
Check the
validity and
print the day
6. To enter input Input char: To enter a Saturday As Expected Pass
as ‘F' F character
Check the
validity and
print the day

7. To enter input Input char: To enter a Sunday As Expected Pass


as ‘G' G character
Check the
validity and
print the day

8. To enter input Input char: To enter a Invalid As Expected Pass


as some special 2 character
character or Check the
different than validity and
print the day
the valid
options

4. Expected outcome

Test priority: High Test Designed Date: 2/8/2020


Module Name: Test Executed By: XYZ
Test Title: Test case for a given program Test Execution Date: 1/8/2020
Description : To test the given program
Preconditions: user enters valid data
Sr. Test Test data Test steps Expected Actual Result Status
description Result

1. Check if the Compile - Program gets As Expected Pass


program runs. the executed
program. successfully
without error.
Run the
program.

2. Enter count and Run the 5 3030 As expected Pass


length as program
101
5 , 101 Enter
length and
count.

3. Enter count and Run the 5 606 As expected Pass.


length as program
99
, 99 Enter
length and
count.

4. Enter count and Run the 6 101 As Expected Pass.


length as program
99
, 99 Enter
length and
count.

5. Enter count and Run the 0 0 As Expected Pass.


length as program
0
0,0 Enter
length and
count.
1. A control statement is a statement that determines whether other statements will be
executed.
➢ An if statement decides whether to execute another statement, or decides which of
two statements to execute.
➢ A loop decides how many times to execute another statement. There are three kinds
of loops:
• while loops test whether a condition is true before executing the controlled
statement.
• do-while loops test whether a condition is true after executing the controlled
statement.
• for loops are (typically) used to execute the controlled statement a given number
of times.
• A switch statement decides which of several statements to execute.

2. Decision coverage covers all possible outcomes of each and every Boolean condition
of the code by using control flow graph or chart. ... Generally, a decision point has
two decision values one is true, and another is false that's why most of the times the
total number of outcomes is two.

3. Relation operator testing is stronger than branch testing. For a compound predicate C,
relational operator testing for each relational expression in C does not guarantee the
detection of boolean operator faults. The binary relational and equality operators
compare their first operand to their second operand to test the validity of the specified
relationship. The result of a relational expression is 1 if the tested relationship is true
and 0 if it is false. The type of the result is int .

You might also like