Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Enrollment No: _____________________ Name: _______________________________

Bahria University, Islamabad Campus


Department of Computer Science
Assignment#1
Course: Software Testing Date: 21-10-2022
Submission: 01-11-2022 Course Code: SEN-411 Max Marks: 10

(3)
i. Dra w Control Flow Graph of t he bel ow me nt io ned code and calculate the
Cycl omat ic Complexit y.
(A)
Procedure Validate_Pin (Valid_Pin, Return_Code)
Valid_Pin = FALSE
Return_Code = GOOD
Pin_Count = 0
do until Valid_Pin = TRUE or Pin_Count > 2 or
Return_Code = CANCEL
begin
get Pin_Number (Pin_Number, Return_Code)
if (Return_Code ¹ CANCEL)
begin
call Validate Pin_Number (Pin_Number, Valid_Pin)
if (Valid_Pin = FALSE) then
begin
output “Invalid PIN, please re-enter PIN”
Pin_Count = Pin_Count + 1
end
end
end
return (Valid_Pin, Return_Code)
(4)
(B)

Bi nary S earch A lgori thm / Code a nd d raw its program f lowgra ph and Calcul ate
Cycl omat ic Complexit y

(C) (3)

1. d o while records re main


read record ;
2. i f record f ield 1 = 0
3. then proces s r ecord;
st ore in buff er;
increment counter;
4. elsif record fi eld 2 = 0
5. then res et re cord ;
6. else pro cess r eco rd;
st ore in fil e;
Page 1 of 2
7. endif;
end if;
8. end do;
9 . end ;

Page 2 of 2

You might also like