QUESTION 8 What is the value of x after the call to m1 in line 8 of the following code? public static void main(String[] args) { int x = 5 ; m1(x); 50 6 8. 9 10 } public static void m1 (int x) { 110 12 13 if ( x > 0 || x < 3) x = x++ + (x + 2); else 14 15 16 17 x--; 18 19 m2(x); 20 21 } 22 public static void m2 (int x) { while (x > 0) { 230 24 25 26 x -- 3; } } 27 28 29 O Compiler error none of the above

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question

java

QUESTION 8
What is the value of x after the call to m1 in line 8 of the following code?
50
public static void main(String[] args)
{
int x = 5 ;
6
7
m1(x);
9.
10
}
public static void m1 (int x)
{
110
12
13
if ( x > 0 || x < 3)
x = x++ + (x + 2);
else
14
15
16
17
x--;
18
19
m2 (x);
20
21
}
22
230
public static void m2 (int x)
{
while (x > 0) {
24
25
26
x -- 3;
}
}
27
28
29
O 5
O-1
1
Compiler error
none of the above
Transcribed Image Text:QUESTION 8 What is the value of x after the call to m1 in line 8 of the following code? 50 public static void main(String[] args) { int x = 5 ; 6 7 m1(x); 9. 10 } public static void m1 (int x) { 110 12 13 if ( x > 0 || x < 3) x = x++ + (x + 2); else 14 15 16 17 x--; 18 19 m2 (x); 20 21 } 22 230 public static void m2 (int x) { while (x > 0) { 24 25 26 x -- 3; } } 27 28 29 O 5 O-1 1 Compiler error none of the above
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning