Functions and Conditionals ديسمبر 03, 2019 الحصول على الرابط Facebook X Pinterest بريد إلكتروني التطبيقات الأخرى Functions and Conditionals TOTAL POINTS 3 1.Question 1 Consider the following Java methods. 1 2 3 4 5 6 7 8 9 10 11 12 13 int func2(int w) { return w * 3; } int func1 (int a, int b) { int n = a + b; return 2 + func2(n); } int start() { int z = 4; return func1(z, 1) - 3; } What is the return value of the call start()? 1 point 2.Question 2 Consider the following method g. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 int g (int a) { if (a < 9) { return 9; } if (a < 7) { return 7; } if (a < 4) { return 4; } return 0; } What is the value returned from the call g(5)? 1 point 3.Question 3 Consider the following method k. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 int k (int a, int b) { if (a < b) { if (b > 4) { return 0 ; } else { return 1; } } else { if (a > 4) { return 2; } else { return 3; } } } For which of the values a and b would 2 be the return value? a=6, b=8 a=6, b=6 a=1, b=3 a=2, b=0 1 point I understand that submitting work that isn’t my own may result in permanent failure of this course or deactivation of my Coursera account. Learn more about Coursera’s Honor Code تعليقات
تعليقات
إرسال تعليق