Question

What is the cyclomatic complexity of the following pseudo code program segment? Use line numbers in...

What is the cyclomatic complexity of the following pseudo code program segment? Use line numbers in the left column to indicate independent paths. Hint: Draw a flowchart and draw execution lines through the flowchart.

1) Read (A, B)

2) If (A>B)

3)       Print A

4) Else

5)       Print B

6) While (A>B)

7)       A = A-1

8) End

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1) Read (A, B)
O(1)
2) If (A>B)
3)       Print A
O(1)
4) Else
5)       Print B
O(1)
6) While (A>B)
7)       A = A-1
O(Infinity)
8) End
===============================
6) While (A>B)
7)       A = A-1
If A < B then the loop never ends.
So, the loop is an infinite loop.

So, complexity = O(Infinity)

Please up vote the solution if it helped. Thanks!

Add a comment
Know the answer?
Add Answer to:
What is the cyclomatic complexity of the following pseudo code program segment? Use line numbers in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What will be left in a and b after the execution of the pseudo code below? Draw a flowchart for the code. a=4 b=10 while (a is less than b) do if (b is less than 12) then b=b+3 else a a +1 b b+2 e...

    What will be left in a and b after the execution of the pseudo code below? Draw a flowchart for the code. a=4 b=10 while (a is less than b) do if (b is less than 12) then b=b+3 else a a +1 b b+2 endif a=a+1 while (b is greater than or equal to 14) do b=b-1 endwhile endwhile b=b+ 100 What will be left in a and b after the execution of the pseudo code below? Draw a...

  • What is the output of the following pseudo-code segment? A, B, C, or None of the...

    What is the output of the following pseudo-code segment? A, B, C, or None of the above ** In pseudo-code, you ignore syntax errors and focus on the logic ** score = 60 if (score >= 70) print "C" else if (score >= 80) print "B" else if (score >= 90) print "A" and score = 105 if (score >= 90 && score <= 100) print "A" else if (score >= 80) print "B" else print "C"

  • Given the following pseudo-code, please show what the outputs will be at LINE A, B, C...

    Given the following pseudo-code, please show what the outputs will be at LINE A, B, C and D. please put down “inconclusive” if you think the CPU process scheduling could potentially result in multiple values for integer i. You will receive partial credit if you draw the process tree. int i = 0; int main(){                         if (fork() == 0) {                         i++;                         if (fork() == 0){                                     if (fork() == 0){                                                 i++;                                                 print value...

  • guys can you please help me to to write a pseudo code for this program and...

    guys can you please help me to to write a pseudo code for this program and write the code of the program in visual studio in.cpp. compile the program and run and take screenshot of the output and upload it. please help is really appreciated. UTF-8"CPP Instruction SU2019 LA X 119SU-COSC-1436- C Get Homework Help With Che X Facebook -1.amazonaws.com/blackboard.learn.xythos.prod/584b1d8497c84/98796290? response-content-dis 100% School of Engineering and Technology COSC1436-LAB1 Note: in the instruction of the lab change "yourLastName" to your last...

  • Write a PYTHON program that allows the user to navigate the lines of text in a...

    Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...

  • Consider the following pseudo-code fragment. What is the value of mystery(2, 3)? BEGIN PROGRAM mystery(int a,...

    Consider the following pseudo-code fragment. What is the value of mystery(2, 3)? BEGIN PROGRAM mystery(int a, int b) IF (b==1) RETURN a END IF ELSE RETURN a + mystery(a, b - 1) END ELSE END PROGRAM mystery 2 4 6 8 the program generates a run time error (infinite recursion) I have no idea

  • What is the output of the program segment? Assume there are no syntax errors and the...

    What is the output of the program segment? Assume there are no syntax errors and the code will compile. int i = 1; int n = 0; do { cout << i; i++; } while (i <= n); b) What are the values of i and n after execution? Assume there are no syntax errors and the code will compile. int i = 1; int n = 0; do { cout << i; i++; } while (i <= n);

  • Draw the flowchart of the code: Write code that opens an Excel file named area.xlsx, writes...

    Draw the flowchart of the code: Write code that opens an Excel file named area.xlsx, writes 'Radius' in cell A1, writes 'Area' in cell B1, and then using the while command populates the next 10 rows of column A (A2-A11) with the numbers 1, 2, ..., 10 and the next 10 rows of column B with the circle areas that correspond to the radii on the left. A while loop should be used.

  • Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline()...

    Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline() print(line) _____________________ print("Error") What should be placed in the blank so that the program will print Error instead of crashing if an exception occurs while opening or reading from the file? Group of answer choices a- except RuntimeError : b- except EnvironmentError : c- except IOError : d- except IndexError : 2) Consider the following code segment: line = "hello world!" parts = line.split()...

  • 31. The following code segment is syntactically correct:              int number{20};          cout << number <<...

    31. The following code segment is syntactically correct:              int number{20};          cout << number << setbase(16) << " " << number                               << setbase(10) << " " << number                                 << showpos << " " << number << endl;                 T__   F__       32. The following statement wants to determine if ‘count’ is outside the     range of 0 through 100:             if (count < 0 && count > 100)                                             T__   F__ 33. There is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT