which of the following can be used in a Java program as iden

which of the following can be used in a Java program as identifiers? double 42 is The Answer for first-name AnnualSalary hello sum of data average Name the six errors in the following program. There could be two on one line 1 public class secret Message 1. Can nave 2 public static main (string t] args f 2. No rerum TYPe 3 system. out.println (\"Speak friend 3. stva is not ca Pira fized 4 Systems out.println (\"and enter); 5. and enhtr docs nor Have 6. braces no in C What is the output of the following program? l public class Strange 2 public static void first 0 system (\"Inside first method\"). 6 public static void secondo 7 System out.println (\"Inside second method\"): first 11 public static void third 13 System out println (\"Inside third method y; first 14 econd 15 17 public static void main (Stringti args) 18 first 19 third 20 second 21 third 22 231 Evaluate. Remember the order of operations. I4 2 3 4 (18 7) (43 10) 6/2 7/3 total number: race the following code. What is the output? Output int total 25; for (int number 1; number total 2) number total total number; System. out.println (total number);

Solution

1)

AnnualSalary
ABC
sum_of_data
average
B4

______________________

2)

1)The should\'nt be space in the class name.
2)we have to write mention the return type.( public static void main(String args[]) )
3)In the word String \'S\' must be capital letter.
4)In the word System \'S\' must be capital letter.
5)We have to write the data to print inside the double quotes
System.out.println(\"and enter\");
6) The program should have balanced closing curly braces for the opened braces.

__________________________

3)

Output:

Inside first method
Inside third method
Inside second method
Inside third method

_________________________

4)

order of precedence is
multiplication
division
modulas
addition
subtraction

a) 2 + 3 * 4 - 6 = 2 + (3 * 4) - 6 = 2+12-6=(2+12) - 6=14 - 6 = 8

b)(18-7) * (43%10)

As we already having curly braces.So the priority is more for contents inside it.

(18-7) * (43%10) = 11 * 3 = 33

c)

6 / 2 + 7 / 3 = 3+2=5

______________

5)

24 1
22 2
19 3
15 4
10 5

___________________

6)

The immediate line after the for loop line will be executed for 3 times as we didnt proved the flower brackets

So the Output is:

How many lines
How many lines
How many lines
are printed

______________________

7)

Output:

1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
5 10 15 20 25 30 35 40 45 50

8)

Output:

for(int i=0;i<10;i++)
{
  
   System.out.print((1+3*i)+\" \");
  
}

______________________

9)

for(int i=1;i<=7;i++)
{
  
   for(int j=1;j<=i;j++)
   {
   System.out.print(i);
   }
   System.out.println();
}

____________________

10)

package org.students;

import java.util.Scanner;

public class Test {

   public static void main(String[] args) {
       String str;
       int num;
Scanner sc=new Scanner(System.in);
System.out.print(\"Enter the String :\");
str=sc.next();
System.out.print(\"Enter the no of repetitions :\");
num=sc.nextInt();
printStrings(str,num);

}

   private static void printStrings(String str, int num) {
       for(int i=0;i<num;i++)
       {
           System.out.print(str);
       }
      
   }

}

______________

Output:

Enter the String :hello
Enter the no of repetitions :6
hellohellohellohellohellohello

_______________________

11)

a)1.6

b)2

c)36

d)64

e)8

f)10+7-8+5=14

_______________________

I will do remaining also

 which of the following can be used in a Java program as identifiers? double 42 is The Answer for first-name AnnualSalary hello sum of data average Name the six
 which of the following can be used in a Java program as identifiers? double 42 is The Answer for first-name AnnualSalary hello sum of data average Name the six
 which of the following can be used in a Java program as identifiers? double 42 is The Answer for first-name AnnualSalary hello sum of data average Name the six

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site