Professional Documents
Culture Documents
Assignment 1 21102022 063500pm
Assignment 1 21102022 063500pm
(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)
Page 2 of 2