X2324HY
X2324HY
[2] P.T.O
Question 2
(i) Evaluate the expression: [2]
a + = a++ + -- b + ++a + --b ;
what will be value of y when a =10, b = 5, c = 10.
(v) What will be the output of the following code segment? [2]
public class A {
public static void main(String[] args)
{
System.out.println('j' + 'a' + 'v' + 'a');
}
}
(vi) Find the output:
String ob = "Matrix";
String ob2 = new String(ob);
System.out.println((ob==ob2) + " "+ (ob.equals(ob2))); [2]
(vii) Find the output : [2]
public class Code {
public static void main(String[] args) {
for(int i = 0; i < 1; i++) {
System.out.println(i+' ');
}
}
}
(viii) Why ½ *12.0 will return 0.0? how to get the correct output? [2]
(ix) What is System.exit()? write difference between System.exit(0) and System.exit(1). [2]
(x) How can you find length of a given array m? [2]
[3] P.T.O
Question 4 15
Write a program to input a number and swap its maximum digit/digits with minimum digit/digits.
Input: 1153867
output: 8853167
Question 5 15
Write a program to input a multidigit number and check if it is prime-palindrome number or not. Make the number
palindrome by concatenating the reverse of it in case the number is not palindrome and then check if it is prime-
palindrome
[A number which remain same after reversing it, is known as a palindrome number. 121, 232 etc]
Input :131
output: prime palindrome.
Question 6 15
Write a program in java which will input a sentence from user and print frequency of all the character.
Question 7 15
Write a program in java to create an array of n names and sort them as per their size in descending order.
Input: Life is Knowledge
Output: Knowledge Life is
Question 8 15
Write a program to display all the numbers between 100 and 200 which don’t contain zeros at any position.
[4]
|-----END----|