Comp App REVISION SHEET SA1
Comp App REVISION SHEET SA1
DUBAI, UAE
2022-23
1
System.out.print(i+ ”
}
(e) State a difference between call by value and call by reference.
(f) Give the output of the following:
Math.sqrt(Math.max(9, 16))
(g) Write the output for the following:
String s1 = “phoenix”; String s2 =”island”;
System.out.prindn (s1.substring(0).concat (s2.substring(2)));
System.out.println(s2.toUpperCase( ));
(h) Evaluate the following expression if the value ofx=2,y=3 and z=1.
v=x+–z+y+ + +y
(i) String x[ ] = {“Artificial intelligence”, “IOT”, “Machine learning”, “Big data”};
Give the output of the following statements:
(i) System.out.prindn(x[3]);
(ii) System.out.prindn(x.length);
(j) What is meant by a package? Give an example.
Q4 Design a class name ShowRoom with the following description :
Instance variables/ Data members :
String name – To store the name of the customer
long mobno – To store the mobile number of the customer
double cost – To store the cost of the items purchased
double dis – To store the discount amount
double amount – To store the amount to be paid after discount
Member methods: –
ShowRoom() – default constructor to initialize data members
void input() – To input customer name, mobile number, cost
void calculate() – To calculate discount on the cost of purchased items, based on
following criteria
2
Q5 Using the switch-case statement, write a menu driven program to do the following :
(a) To generate and print Letters from A to Z and their Unicode Letters Unicode
Q7 A tech number has even number of digits. If the number is split in two equal halves, then
the square of sum of these halves is equal to the number itself. Write a program to
generate and print all four digit tech numbers
Q8 Write a program in Java to accept a string in lower case and change the first letter of
every word to upper case. Display the new string.
Sample input: we are in cyber world
Sample output : We Are In Cyber World