0% found this document useful (0 votes)
35 views3 pages

Comp App REVISION SHEET SA1

The document contains a summative assessment paper with 8 questions on Object Oriented Programming concepts in Java. The questions cover topics like OOP principles, operators, loops, methods, classes, arrays and strings.

Uploaded by

kka490855
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Comp App REVISION SHEET SA1

The document contains a summative assessment paper with 8 questions on Object Oriented Programming concepts in Java. The questions cover topics like OOP principles, operators, loops, methods, classes, arrays and strings.

Uploaded by

kka490855
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

AMBASSADOR SCHOOL

DUBAI, UAE

REVISION SHEET SUMMATIVE ASSESSMENT - 1

2022-23

Q1 (a) Name any two basic principles of Object-oriented Programming.


(b) Write a difference between unary and binary operator.
(c) Name the keyword which :
(i) indicates that a method has no return type.
(ii) makes the variable as a class variable.
(d) Write the memory capacity (storage size) of short and float data type in bytes.
(e) Identify and name the following tokens :
(i) public
(ii) ‘a’
(iii) ==
(iv) {}
Q2 a) Differentiate between if else if and switch-case statements.
(b) Give the output of the following code :
String P = “20”, Q = “19”,
int a = Integer .parselnt(P);
int b = Integer. valueOf(Q);
System.out.println(a+””+b);
(c) What are the various types of errors in Java ?
(d) State the data type and value of res after the following is executed :
char ch = ‘9’;
res = Character. isDigit(ch) ;
(e) What is the difference between the linear search and the binary search technique?
[2]
Q3 (a) Write a Java expression for the following :
|x2+2xy|
(b) Write the return data type of the following functions :
(i) startsWith( )
(ii) random( )
(r) If the value of basic=1500, what will be the value of tax after the following statement
is executed? [2]
tax = basic > 1200 ? 200 : 100;
id) Give the output of following code and mention how many times the loop will execute
? [2]
int i;
for(i=5; i> =l;i~)
{
if(i%2 ==1)
continue;

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

Cost Discount (in percentage)


Less than or equal to ₹ 10000 5%
More than ₹ 10000 and less than or equal to ₹ 20000 10%
More than ₹ 20000 and less than or equal to ₹ 35000 15%
More than ₹ 35000 20%
void display() – To display customer name, mobile number, amount to be paid after
discount
Write a main method to create an object of the class and call the above member
methods.

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

(b) Display the following pattern using iteration (looping) statement: 1

Q6 Design a class to overload a function series() as follows:


(a) void series (int x, int n) – To display the sum of the series given below:
x1 + x2 + x3 + ……………. xn terms
(b) void series (int p) – To display the following series:
0, 7, 26, 63 p terms.
(c) void series () – To display the sum of the series given below:

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

You might also like