QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A ICSE2017-03H #7246

Question:

Give the output of the following code:
String A =”26″, B=”100″;
String D=A+B+”200″;
int x= Integer.parseInt(A);
int y = Integer.parseInt(B);
int d = x+y;
System.out.println(“Result 1 = “+D);
System.out.println(“Result 2 = ” +d);

Answer:

String A= g26, B= g100 ;
A = g26, B = g100
String D=A+B+ g200;
D = g26 + g100 + g200 = 26100200
int x= Integer.parseInt(A);
x = Integer.parseInt(g26) = 26
int y=Integer.parseInt(B);
y= Integer.parseInt(B) = Integer.parseInt(g100); = 100
int d=x+y;
d = 26 + 100 = 126
System.out.println(gResult 1=h +D);
Result 1=26100200
1 for(int i=5, d=5; i<=5; i++) { 2 d = d * 2; 3 System.out.println(d); 4 } 1 String s= "Today is Test"; 2 System.out.println(s.indexOf('T')); 3 System.out.println(s.substring(0,7)+ " "+ "Holiday"); 1 String A= "26", B= "100" ; 2 String D=A+B+ "200"; 3 int x= Integer.parseInt(A); 4 int y=Integer.parseInt(B); 5 int d=x+y; 6 System.out.println("Result 1=" +D); 7 System.out.println("Result 2="+d); System.out.println(gResult 2=h+d); Result 2=126 Ans. 1 Result 1=26100200 2 Result 2=126