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 :
Step 1: The base case returns “-”. Hence F(1) = “-1-1” and F(2) = “-2-2”.
Step 2: F(3) = F(0) + “3” + F(1) + “3” = “-3-1-13”.
Step 3: F(5) = F(2) + “5” + F(3) + “5” = “-2-25-3-1-135”. Concatenation proceeds from left to right because the first operand is a string.
Which of the following statement(s) is/are TRUE regarding Java Servelets?
(a) A Java Servlet is a server-side component that runs on the webserver and extends the capabilities of a server.
(b) A Servelet can use the user interface classes like AWT or Swing.
What is the output of the following JAVA program?
class Test
{
public static void main (String [ ] args)
{
Test obj = new Test ();
obj.start ();
}
void start ()
{
String stra="do”;
String strb = method (stra);
System.out.print(“:” + stra + strb);
}
String method (String stra)
{
stra=stra+”good”;
System.out.print (stra);
return “good”;
}
}
A java program that is embedded in HTML document and runs in the context of java capable browser is known as ______.
JAVA compiler translates source code into _______.
Which of the following statement(s) is/are correct regarding java programming?
I. Place a semicolon immediately after a method header
II. Define a method outside the braces of a class definition