Please select a subject first
Advertisements
Advertisements
Rewrite the following code using the if-else statement:
int m = 400;
double cl). = (m>300) ? (m/10.0) * 2:(m/20.0)−2;Concept: undefined >> undefined
Give the output of the following program segment:
int n = 4279; int d;
while(n>0)
(d=n%10;
System.out.println(d);
n=n/100;
}Concept: undefined >> undefined
Advertisements
Name the following:
The method which has same name as that of the class name.
Concept: undefined >> undefined
The access specifier that gives least accessibility is ______.
Concept: undefined >> undefined
What is the output of Math.ceil(5.4) + Math.ceil(4.5)?
Concept: undefined >> undefined
The extension of a Java source code file is ______.
Concept: undefined >> undefined
Which of the following data type cannot be used with switch case construct?
Concept: undefined >> undefined
Which of the following mathematical methods returns only an integer?
Concept: undefined >> undefined
Define a class to overload the method perform as follows:
| double perform (double r, double h) | to calculate and return the value of Curved surface area of cone CSA π rl `l = sqrt(r^2 + h^2)` |
| void perform (int r, int c) | Use NESTED FOR LOOP to generate the following format r = 4, c = 5 output - 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 |
| void perform (int m, int n, char ch) | to print the quotient of the division of m and n if ch is Q else print the remainder of the division of m and n if ch is R |
Concept: undefined >> undefined
"Java compiled code (byte code) can run on all operating systems" - Name the feature.
Concept: undefined >> undefined
Which of the following is not true with regards to a switch statement?
Concept: undefined >> undefined
Method prototype for the method compute which accepts two integer arguments and returns true/false.
Concept: undefined >> undefined
Assertion(A): An argument is a value that is passed to a method when it is called.
Reason(R): Variables which are declared in a method prototype to receive values are called actual parameters.
Concept: undefined >> undefined
Rewrite the following code using single if statement.
if(code=='g')
System.out.println("GREEN");
else if(code=='G')
System.out.println("GREEN");Concept: undefined >> undefined
A student executes the following program segment and gets an error. Identify the statement which has an error, correct the same to get the output as WIN.
boolean x=true;
switch(x)
{ case 1:System.out.println("WIN");break;
case 2;System.out.println("LOOSE");
}Concept: undefined >> undefined
Write the java expression for `root3x + sqrty`
Concept: undefined >> undefined
Define a class to accept a number and check whether it is a SUPERSPY number or not. A number is called SUPERSPY if the sum of the digits equals the number of the digits.
Example1:
Input: 1021
Output: SUPERSPY number [SUM OF THE DIGITS = 1+0+2+1 = 4, NUMBER OF DIGITS = 4]
Example2:
Input: 125
Output: Not an SUPERSPY number [1+2+5 is not equal to 3]
Concept: undefined >> undefined
Write a program to input integer elements into an array of size 20 and perform the following operations:
(i) Display largest number from the array.
(ii) Display smallest number’ from the array.
(iii) Display sum of all the elements of the array.
Concept: undefined >> undefined
Write the return data type of the following function:
endsWith( )
Concept: undefined >> undefined
Write two characteristics of a constructor.
Concept: undefined >> undefined
