For more java concepts click https://java4school.com/wrapper-classes-in-java
In this paper most of the important topics of ICSE syllabus for class X java is covered.
- Section I (Theory)
A. Answer the following questions. Write a function prototype of the following: - A function ConcatChar which takes a string argument and a character argument and returns a string value.
- Write the java expression for the following.
2AB/P2-S3 - Find the output of Z:
int P= 4;
int Z = ++P * (P– + P++); - What is a parameterized constructor?
- Name the package that contains Scanner class.
- Which unit of the class gets called, when the object of the class is created?
- What is function overloading? Explain with example.
- Explain the function prototype and the signature?
- Rewrite the following using if….else
- double disc=(cost>4000)? cost*5/100 : 60;
- Write statements for the following
- To create an object of class Student with default constructor.
- To invoke a method of class Student i.e ShowResult(int marks)
- Analyze the following code and state at which iteration does value of b will equate to the initial value of a.
int a=20, int b=15
while (a>10)
{
a–;
b++;- }
Section II (Programs)
- }
Attempt any two programs [2X10=20]
- Define a class to overload a function Sum() as follows:
int Sum(int a, int b) – with two integer arguments (a and b) calculate and return the sum of all the even numbers in the range of a and b.
Sample input: a=4 and b=16
Sample output: sum = 4 + 6 + 8 + 10 + 12 + 14 + 16
double Sum( double n ) – with one double arguments(n) calculate and return the product of the following series:
sum = 1.0 x 2.0 x 3.0 x……….x n
int Sum(int n) – with one integer argument (n) calculate and return sum of only odd digits of the number n
Sample Input : N=43961
Sample output : surg 3+9+ 1= 13
- Define the class called Transport with the following description.
Class : Transport
Data members:
String name: to enter the name
int wt: to enter the weight of the parcel
int charge: To calculate the charges to be paid for the parcel.
Member Functions:
Transport(): default constructor to assign the values to the data members
void input():To input the details
void display() : To display the details
void compute(): to calculate the charges to be paid
The charges for the transport company are as follows
weight of the parcel charges/kg
up to 10 kg Rs/- 30
11 to 25 Rs/- 25
26 to 40 Rs/- 20
More than 40 Rs/- 15
Write a main method to create an object of the class and call the above member methods. - Write a program to make a menu driven program to do the following tasks as per user choice.
i. To check for the amicable number (Note: An amicable number are pair of numbers such that one is the sum of proper factors of the other.
For example 220 and 284
sum of factors of 220: 1+2+4+5+10+11+20+22+44+55+110=284
sum of factors of 284:1+2+7+71+142=220
ii. To check for the prime number. A number that has only two factors is called a prime number. - For videos related to java programming
- http://www.youtube.com/user/trushnatej