Monday, 6 November 2017

java important problems



Question 09
What is the output of the following
System.out.println("toLowerrCase(B) is " + Character.toLowerCase('B'));
Output
Output is
toLowerrCase(B) is b

Question 10
What is the output of the following
System.out.println("toUpperrCase(a) is " + Character.toUpperCase('a'));
Output
Output is
toUpperrCase(a) is A
Question 11
What is the output of the following
char x = 'w';
char y = 'p';
System.out.println(++x);
System.out.println(y++);
System.out.println(x + y);
Output
Output is:
x
p
233
Question 12
What is the output of the following
char x = 'w';
char y = 'p';
y++;
x+=2;
System.out.println(Character.toUpperCase(y));
System.out.println(Character.toUpperCase(x));
System.out.println(x * y);
Output
Output is
Q
Y
13673
Question 13
What is the output of the following
char x = 'w';
char y = 'D';
y++;
x+=2;
if(Character.isUpperCase(y))  {
System.out.println(Character.toUpperCase(y));
System.out.println(Character.toUpperCase(x)); }
else
System.out.println(x * y);
Output
Output is
E
Y
Question 14
What is the output of the following
System.out.println('H' <= 'P');
System.out.println('a' == 'd');
System.out.println('O' >= 's');
System.out.println('d' >= 'A');
System.out.println('a' == 'a');
System.out.println('V' != 'b');
Output
Output is
true
false
false
true
true
true

jav important problems for exams



Question 03
What is the output of the following
System.out.println("isDigit('r') is " + Character.isDigit('r'));
Output
Output is
isDigit('r') is false

Question 04
What is the output of the following:
System.out.println("isDigit(3) is " + Character.isDigit('3'));
Output
Output is
isDigit(3) is true
Question 05
What is the output of the following:
System.out.println("isupperCase(w) is " + Character.isUpperCase('w'));
Output
Output is
isupperCase(w) is false
Question 06
What is the output of the following:
System.out.println("isupperCase(P) is " + Character.isUpperCase('P'));
Output
Output is
isupperCase(P) is true
Question 07
What is the output of the following:
System.out.println("isLowerrCase(P) is " + Character.isLowerCase('P'));
Output
Output is
isLowerrCase(P) is false
Question 08
What is the output of the following
System.out.println("isLowerrCase(z) is " + Character.isLowerCase('z'));
Output
Output is
isLowerrCase(z) is true

java important input output problems



Question 01
What is the output of the following:
System.out.println("1" + 1);
System.out.println('1' + 1);
System.out.println("1" + 1 + 1);
System.out.println("1" + (1 + 1));
System.out.println('1' + 1 + 1);
Output
Output is 11
                  50
                   111
                    12
                   51


Question 02
What is the output of the following:
System.out.println("1" + 1+3);
System.out.println('1' + 1*3);
System.out.println("1" + 1 *4+4+ 1);
System.out.println("1" + 4+(1 + 1));
System.out.println('1' + (1+3) + 1);
 }
Output
Output is
113
52
1441
142
54

java methods



Question 30
What is equals()
 Ans
It compare two strings and it is case sensitive
Question 31
What is equalsIgnoreCase()
 Ans
This function compare two strings but it is not case sensitive.
Question 32
Give example of equals()
 Ans
String s1="this4is4my4book";
String s2="this4is4my4book";
String s3="lkajfslagj;fklgja";
System.out.println(s1.equals(s2));  //true
 System.out.println(s3.equals(s2));  //false
Question 33
Give example of equalsIgnoreCase()
 Ans
String s1="thIs4is4My4book";
String s2="This4is4my4Book";
String s3="lkajfslagj;fklgja";
System.out.println(s1.equalsIgnoreCase(s2));  //true
 System.out.println(s3.equals(s2));               // false