Ask Question
6 July, 18:25

What is the output of the code corresponding to the following pseudocode? (In the answer options, new lines are separated by commas.) Declare X As Integer Declare Y As Integer For (X = 1; X <=2; X++) For (Y = 3; Y < = 4; Y++) Write X * Y End For (Y) End For (X)

+2
Answers (1)
  1. 6 July, 21:44
    0
    Following are the output of the given question

    3 4 6 8

    Explanation:

    In the following code, firstly, we have declare two integer data type "X" and "Y".

    Then, set two for loop in which first one is outer loop and the second one is the inner loop, inner loop starts from 1 and end at 2 and outer loop starts from 3 and end at 4. Then, when the variable X=1 then the condition of the outer loop become true and the check the condition of the inner loop, when Y=3, than the multiplication of X and Y occur and output should be 1*3=3. Then, the value of the X will remain same at time when the value of Y become false. Thrn, second time X=1 and Y=4 and output should be 4. Then, X=2 because Y turns 5 so the inner loop will terminate and than outer loop will execute. Then again Y=3 but X=2 and output should be 6. Then, the value of the X will remain same at time when the value of Y become false. Thrn, second time X=2 and Y=4 and output should be 8.

    Finally, all the conditions of the loop become false and the program will terminate.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is the output of the code corresponding to the following pseudocode? (In the answer options, new lines are separated by commas.) ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers