What will be the output of the following Pseudocode?1. int p=4, q=7, r=102. p=q mod r3. q=q+p4. r=r+q5. print p, q and r7 11 174 11 177 14 217 14 24
Question
What will be the output of the following Pseudocode?1. int p=4, q=7, r=102. p=q mod r3. q=q+p4. r=r+q5. print p, q and r7 11 174 11 177 14 217 14 24
Solution
The pseudocode provided is not complete, as it does not specify the question to be answered. However, I can explain what each line of the pseudocode does:
-
int p=4, q=7, r=10: This line declares three integer variables p, q, and r, and assigns them the values 4, 7, and 10 respectively.
-
p=q mod r: This line assigns the value of the modulus of q divided by r to p. The modulus operation gives the remainder of the division. So, p will be 7 mod 10, which is 7.
-
q=q+p: This line adds the current values of q and p, and assigns the result to q. So, q will be 7 + 7, which is 14.
-
r=r+q: This line adds the current values of r and q, and assigns the result to r. So, r will be 10 + 14, which is 24.
-
print p, q and r: This line prints the current values of p, q, and r, which are 7, 14, and 24 respectively.
So, the output of the pseudocode will be 7, 14, 24.
Similar Questions
What will be the output of the following pseudocode?Integer pp, qq, rrset pp=5, qq= 1, rr= 4if ( pp > rr)if (qq > rr )rr = 1qq = rr + 1pp = rr + 2end if qq = pp+ 1elsepp = pp + 1end if printf pp + qq + rr
What will be the output of the following pseudocode?Integer p, q, r Set p = 0, q = 4, r = 3 If(p || r) If(p && r) p = p &r End If p = p ^ r End If Print p + q + rQuestion 90AnswerA.20B.10C.12D.7
What will be the output of the following pseudocodeInteger p, q, rset p=1, q=4, r=1if (q > r )if ( q ^ q>1)if ( r ^ r > 1)p = 1q = 1r = 2end if q = 111end if printf p + q + r
What will be the output of the following pseudocode?Integer p, q, r, s Set p=1, q = 1for (each r from 0 to 2 ) for (each s from -4 to -2 ) p = p + 2if(p > r) Continue End if p = 1if(p > s) Jump out of the loop End if End for End for Print p + qQuestion 83AnswerA.13B.24C.35D.20
What will be the output of Pseudocode?Integer n, rev, rem, origSet n = 61206, rev = 0Set orig = nWhile n NOT EQUALS 0 rem = n MOD 10 rev = rev * 10 + rem n = n / 10End whileIf (orig IS EQUAL TO rev) Print revElse Print (orig – rev) / 6End If
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.