✏️ Explanatory Question

(a) Write a Java expression for the following:

\[ \lvert x^2 + 2xy \rvert \]

(b) Write the return data type of the following functions:

  1. startsWith()
  2. random()

(c) If the value of basic=1500, what will be the value of tax after the following statement is executed?


tax = basic > 1200 ? 200 :100;

(d) Give the output of following code and mention how many times the loop will execute?


int i;
for( i=5; i>=1; i--)
{
    if(i%2 == 1)
        continue;
    System.out.print(i+" ");
}

(e) State a difference between call by value and call by reference.

(f) Give the output of the following:
       Math.sqrt(Math.max(9,16))

(g) Write the output for the following:


String s1 = "phoenix"; String s2 ="island";
System.out.println(s1.substring(0).concat(s2.substring(2)));
System.out.println(s2.toUpperCase());

(h) Evaluate the following expression if the value of x=2, y=3 and z=1.

  v=x + --z + y++ + y

(i) String x[] = {"Artificial intelligence", "IOT", "Machine learning", "Big data"};

Give the output of the following statements:

  1. System.out.println(x[3]);
  2. System.out.println(x.length);

(j) What is meant by a package? Give an example.

👁 148 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

Answer not available right now.