You are on page 1of 1

2 2

Worksheet-1 x +y
b)
Q.1.What will be the output of the following code:- xy
a)int k=5,j=9;
k+=k++ - ++j+k;
System.out.println(“k=”+k);
b)int x=5;
x=x++ * 2+ 3*--x;
System.out.println(x);
c)
√( p−a)( p−b)( p−c)

3
5 x +2 y
3

System.out.println(“j=”+j); d)
x+ y
Q.6. Write the mathematical expression for the following:-
c)char x=’A’;int m; d)int a=5,b=9;
a)double s=Math.sqrt(Math.pow(a,4)+Math.pow(b,3)/(p+q));
m=(x==’a’)?’A’:’a’; a+=a++ - ++b +a;
System.out.println(“m=”+m); System.out.println(a+” “+b); b)Square root of p, without using Math.sqrt.
Q.7.Give the resultant data type of the following expressions:-
e)int a=2,b=3,c=9; f)int a=0,b=30,c=40; i)int i,j;float f;double d;
int d=a-(b++)*(--c); a=--b + c++ +b; c*f/d;
int e=a*(++b)%c; System.out.println(a+” “+b+” ii)int x;char y;float z;
System.out.println(d+” “+e); “+c);
z*(x+y);
g)int m=5,n=2; h)char c=’A’; Q.8.What is the outcome when following statements are executed:-
m-=n;n=m+m/n; short m=26; i)Math.sqrt(-225);
System.out.print(m+” “+n); int n=c+m; ii)int tax=(int)678907.00d;
System.out.println(n); Q..9.Identify the operands & operators used:-
If((a==b)||(b==c)||(c>=a))
Q.2.Write the output:-
Q.10.Differentiate between the following:-
i)’ ‘&” “ ii)true & “true” iii)/ and % iv)= and == v)0.0d and 0.0f
a)int a=56,b=78; b)int a=89,b=a--,c=a++;
Q.11.Write the memory size and range of values of the following data
int c=a++ -b;int d=--a+b;int e=--c+d--; System.out.println(a+” “+b+”
System.out.println(c+” “+d+” “+e); “+c); types:-
a)float b)int c)boolean d)char
Q.3.Identify the valid variable names:-
a)_123 b)break c)var.1 d)T$ e)c23 f)c*23 g)c 23 h)acc_no
Q.4.Which of the following are valid integer literals:-
a)-5.0 b)21 c)aX10-3 d)-16E+03
Q.5.Write java expressions for the following:-
a) √ a2 +b 2

You might also like