...
Question 8909 – Structure
March 19, 2024
Question 16253 – UGC NET Dec-2020 and June-2021 Paper-2
March 19, 2024
Question 8909 – Structure
March 19, 2024
Question 16253 – UGC NET Dec-2020 and June-2021 Paper-2
March 19, 2024

Question 16248 – UGC NET Dec-2020 and June-2021 Paper-2

Consider the following recursive function F() in Java that takes an integer value and returns a string value:
public static String F( int N ) {
if ( N < = 0) return “-“;
return F(N – 3) + N + F(N – 2) + N;
}
The value of F(5) is:

Correct Answer: C

Question 28 Explanation: 
F(1) return the value -1-1
F(2) return the value -2-2
F(3) return the value -3-1-13
F(4) return the value -1-14-2-24
F(5) return the value -2-25-3-1-135
A
-1-145-2-245
B
-2-25-1-3-135
C
-2-25-3-1-135
D
-2-25-3-135
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!