Computer applications
Revision worksheet-1
I.Fill in the blanks:-
a) ______and _________ are the two elements of a computer program.
b) A _______contains the definition and description of object.
c)Procedure oriented programming is organized around___________.
d)_______feature of java allows multiple parts of a same programs to execute
concurrently.
e)_____is the extension of java source code, ________is the extension of byte
code.
f) Java’s keywords and reserved words cannot be used as_________.
g) variable is the memory that hold a fixed value of any of the data types.
h)’\n’ and ‘\t’ are also called as_______________.
i) Two or more operators of same priority in an expression are evaluated
according to their____________.
j)________keyword is used to declare a variable as constant in a java program.
II. Identify and write valid and invalid identifiers from the following :-
a) x+y b) sum20 c) year@23 d) days_365 e) char$
f) average value g) True h) (discount) j) switch
III. Write equivalent java expressions for the following:-
a) d=√𝑏 2 − 4𝑎𝑐
1
b)
4b√a2 −b2
4
c) √𝑥 + 3√𝑦
𝜋
d) 𝑎𝑏 ÷
2
IV. Arrange the following data types in ascending order of their size:-
(1) long (2) short (3) float (4) double (5) char (6) boolean (7) int
V. Identify the type of conversion (Implicit/Explicit):-
a) int x=12; double y=12.0;
double z=x*y;
b) char ch=78;
c)int m=4;
int rt=(int)Math.sqrt(m);
VI. Evaluate and Write the output of the following expressions:
a) int k=4,r=2;
r*=r+ ++k + k++;
System.out.println(“k=”+k+ “r=”+r);
b) int a=7;
a/=a++ + ++a +--a;
System.out.println(“a=”+a);
c) int a=12, b=7;
a%=a/++a + --b + ++b/2;
System.out.println("The result");
System.out.println("The value of a is "+a+"\n The value of b is "+b);
d)int n=789;
n=n%10+n/10%10;
System.out.println(++n);
e) double x=-80.7, y=-48.3;
System.out.println(Math.abs(Math.max(x,y)));
System.out.println(Math.sqrt(Math.abs(Math.round(x))));
System.out.println(Math.pow(Math.ceil(y)/3, 2));
f) System.out.println ("Output is "+10+10.5);
System.out.println ("Output is "+(10+10.5));
System.out.println (10+10.5 + " is the output");
System.out.println ("Output is "+'b'+5);
System.out.println ("Output is "+(char)('b'+2));
System.out.println ('b'+5+" is the output");
System.out.println ("\"***FINAL EXAMINATION***\"");