Please select a subject first
Advertisements
Advertisements
Name any two types of access specifiers.
Concept: undefined >> undefined
Using switch statement, write a menu-driven program for the following :
(i) To find and display the sum of the series given below :
S = x1 -x2 + x2 – x4 + x5 – x20
(where x = 2)
(ii) To display the following series :
1 11 111 1111 11111
For an incorrect option, an appropriate error message should be displayed.
Concept: undefined >> undefined
Advertisements
Give the output of the following string functions:
- "MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I')
- "CABLE".compareTo("CADET")
Concept: undefined >> undefined
Give the output of the following Math functions:
(i) Math.ceil(4.2)
(ii) Math.abs(-4)
Concept: undefined >> undefined
State the difference between while and do-while loop.
Concept: undefined >> undefined
Write down java expression for:
`"T" = sqrt("A"^2 + "B"^2 + "C"^2)`
Concept: undefined >> undefined
Rewrite the following using ternary operator:
if (x%2 == o)
System.out.print(“EVEN”);
else
System.out.print(“ODD”);
Concept: undefined >> undefined
Convert the following while loop to the corresponding for loop:
int m = 5, n = 10;
while (n >= 1)
{
System.out.println(m*n);
n--;
}Concept: undefined >> undefined
System.out.print("BEST ");
System.out.println("OF LUCK");
Choose the correct option for the output of the above statements.
Concept: undefined >> undefined
Analyze the given program segment and answer the following questions:
(i) Write the output of the program segment.
(ii) How many times does the body of the loop gets executed?
for (int m=5; m<=20;m+=5)
{ if(m%3==0)
break;
else
if(m%5==0)
System.out.println(m);
continue;
}
Concept: undefined >> undefined
Give the output of the following expression:
a+= a++ + ++a + -- a + a--; when a = 7;
Concept: undefined >> undefined
Write the return type of the following library functions:
- isLetterOrDigit(char)
- replace(char, char)
Concept: undefined >> undefined
Evaluate the value of n. if value of p = 5, q = 19
int n = (q – p) > (p – q) ? (q – p) : (p – q)
Concept: undefined >> undefined
Arrange the following primitive-data types in ascending order of their size:
(i) char (ii) byte (iii) double (iv) int
Concept: undefined >> undefined
Write a Java expression for the following :
`sqrt(3"x"+"x"^2)/"a+b"`
Concept: undefined >> undefined
What is the value of y after evaluating the expression given below?
y+= ++y + y-- + --y; when int y=8;
Concept: undefined >> undefined
What are the values of a and b after the following function is executed if the values passed are 30 and 50?
void paws(int a, int b)
{ a = a + b;
b = a - b;
a = a - b;'
System.out.println(a + "," + b);
} Concept: undefined >> undefined
State the data type and value of y after the following is executed: char x = 7; y = Character.isLetter(x);
Concept: undefined >> undefined
Give the output of the following :
(i) Math.floor (- 4.7)
(ii) Math.ceil(3.4) + Math.pow(2,3)
Concept: undefined >> undefined
Name the mathematical function which is used to find sine of an angle given in radians.
Concept: undefined >> undefined
