Question

What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set...

What is wrong with the following pseudocode?

Declare Count As Integer

Declare TheNumber As Integer

Set TheNumber = 12

For (Count = 10; Count>TheNumber; Count--)

Write TheNumber + Count

End For

A) The limit condition in a For loop cannot be a variable

B) The loop will never be entered since the initial value of Count is less than the test condition

C) The loop will never end since the test condition will never be met

D) A counter must start at 0 or 1

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: Option B

Explanation: TheNum=12 and Count=10. For entering the loop the condition is Count>TheNumber and 10>12 is false and the loop will never be entered.

Please give a like

Add a comment
Know the answer?
Add Answer to:
What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set...
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
  • In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum...

    In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + count End While Return sum End Function Function Integer perfect_sum(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + perfect(count) End While Return sum End Function Module main() Display perfect_sum(5)...

  • Convert the following pseudocode into C++ language. Declare X, Y, Z As Integer For (X =...

    Convert the following pseudocode into C++ language. Declare X, Y, Z As Integer For (X = 1; X < 4; X++) Write “Pass Number “ + X For (Y = 1; Y < 10; Y+3) Set Z = X + Y Write X + “ + “ + Y + “ = “+ Z End For(Y) End For(X)

  • 1. True/False: An infinite loop occurs in a pre-test loop when a test condition can never...

    1. True/False: An infinite loop occurs in a pre-test loop when a test condition can never be met.      2. True/False: An infinite loop occurs in a post-test loop when a test condition can never be met. 3. True/False: The following statement will generate a loop with four iterations:                            for(count = 4; count > 0; count--) 4. True/False: The problem with a do...while loop is that the test condition cannot be a compound condition. 5. True/False: The following test...

  • MULTIPLE ANSWERS: Consider the following pseudocode snippet: Declare String springClasses[5] = “csc115”, “mat295”, “phy200”, “eng200”, “the120”  ...

    MULTIPLE ANSWERS: Consider the following pseudocode snippet: Declare String springClasses[5] = “csc115”, “mat295”, “phy200”, “eng200”, “the120”   Declare Integer index = 0   Display “displaying all classes” For index = 0 To 5 Display springClasses[index]   End For Where is the syntax error in the following pseudocode? (If you are not sure here is a hint: go back and read up on For loops carefully. When do they stop looping?) Infinite loop We initialize the array with the wrong datatype Array out of...

  • loops a.Create a For loop with a variable i that is type integer. It is equal...

    loops a.Create a For loop with a variable i that is type integer. It is equal to 0 . Evaluate if i is less than three, then increment i. Statement should be to trace b. Create a For Loop with a variable i equal to 3. If I is greater than 0, decrement i. The statement should be to trace i c. Declare a variable for i to be an integer with a value of 0. While it is less...

  • // Group Names: // Date: // Program Description: //   Import required packages //--> //   Declare class...

    // Group Names: // Date: // Program Description: //   Import required packages //--> //   Declare class (SwitchDoLab) //--> {    //   Declare the main method    //-->    {        //   Declare Constant integers SUM = 1, FACTORIAL = 2, QUIT = 3.        //-->        //-->        //-->        //   Create an integer variable named choice to store user's option.        //-->        //   Create a Scanner object        //   Create...

  • Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...

    Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...

  • Assume the following declarations have been made in main(): int howmany; Scanner kb = new Scanner(System.in);...

    Assume the following declarations have been made in main(): int howmany; Scanner kb = new Scanner(System.in); Random r = new Random(); Write code to do the following: Use a while loop to prompt the user for how many numbers are to be entered. If the user does not enter a positive number (a number greater than 0), display a message saying the number must be positive and to try again. Store this value in the howmany variable. Declare an integer...

  • java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code...

    java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code I'll tell you what to do. Use other code as a guide.  Start with a for loop with a start of int i = 0  Set the ending point of when i is less than the length of the arr array.  Set the incrementation to increase i by 1 using the unary operator ++.  Within the loop set the arr...

  • ALGORITHM RecS(n) // Input: A nonnegative integer n ifn=0 return 0 else return RecS(n+ n n...

    ALGORITHM RecS(n) // Input: A nonnegative integer n ifn=0 return 0 else return RecS(n+ n n n Determine what this algorithm computes. You must justify your answer. made by this algorithm and solve it. You must justify your answer. same thing using for/while loop(s) developed in (3). You must justify your answer. 1) 2) Set up the initial condition and recurrence relation for the number of multiplications 3) Write the pseudocode for the non-recursive version of this algorithm, i.e., compute...

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