Formatting page ...
Practice paper for the Board Examination March 2018 I. Evaluate the given expressions:(1) int a=4, b=2, c=8; System.out.println (a+b*c%a); System.out.println (a+b/c+a); System.out.println (a%b + b%c + b/a + c/b); (2) int x=2, y=5, z=3; System.out.println (x*=5); System.out.println (x+5); y+=x+=z; System.out.println (x+" "+y+" "+z); (3) int m=100, n=200, p=500; System.out.println (m+n>n-p); System.out.println (m+p%m==n-100); System.out.println (! (m*2==n)); System.out.println (m<n & p%m==0); System.out.println (n%m!=p%p); (4) String s="Examination"; int a=20, b=19; System.out.println (s+a+b); System.out.println (a+b+s); System.out.println ('A'+'B'+" is the Output"); System.out.println ("Output is "+'A'+'B'); System.out.println ("Output is "+('A'+'B')); System.out.println ("Output is "+a*b%2); System.out.println ("Output is "+'a'+5); System.out.println ('a'+5+"=Output"); (5) (a) int k=5, g=3; System.out.println (k++ - --g*++k%g++); System.out.println ("k="+k+"\ng="+g); (b) int a=2, b=-5; a*=++a + --b + a--; System.out.println ("a="+a+" b="+b); (c) int m=1000, n= 500; m%=n; System.out.print (m); System.out.println (n); n+=--n + ++m; System.out.println (m+n); (d) int a=3; char ch='a'; System.out.println (a++ + ++ch a++); System.out.println (a+"\n"+ch); II. State the return data type and value given by the following expressions:(1) System.out.println (1+2*5%3); (2) System.out.println (1.5 + 2*'b'); (3) char ch='X'; System.out.println (ch++ + 5); System.out.println (--ch);
|