SUB: COMPUTER FOR CLASS X
This paper is divided into two sections. You are to answer all the questions from Part I, and any four from Part II.
SECTION A (40 Marks)
Attempt all questions from this Section
Question 1. [5*2=10]
- Give the difference between call by value and call by reference
- Explain function overloading with an example.
- What is a keyword? Give two examples.
- Explain what is the job of return keyword?
- Mention two characteristic of java?
Question 2. [5*2=10]
- What is the difference between pure and impure function.
- What is the purpose of new keyword?
- Give the difference between actual parameter and formal parameter.
- What is the difference between unary and binary operator?
- What is the difference between a static member function and a not static member function?
Question 3. 
(a) What will be the output for the following program segment? 
int a = 10,b=30,c=40;
a= –b + c * a / 2;
System.out.print(“a” + a);
System.out.print(“b ” +b );
(b) Write an equivalent Java expressions for the following expression : 
(c) What will be the output for the following program segment? 
(i) a. System.out.println(10%5)
(ii) if a = 5 then What will be the value of
a- – + ++a%4;
(d) Rewrite the following if-else statement in terms of switch-case statements? 
else if(code ==’B’ || code ==’C’)
else if(code ==’D’)
(e) What do you understand by JVM? 
(f)Write output of the following? 
System.out.println(“value of x=”+x);
System.out.println(“value of y=”+y);
(g) What do you understand by primitive and non-primitive data type? 
(h) Convert the following segment into equivalent for loop and do while loop. 
public void display()
while ( i !=0)
System.out.print(i +” “);
SECTION B (60 Marks)
Attempt any four questions from this Section.
The answer in the Section should consist of the Program in BlueJ environment with Java. Each program should be written using Variable descriptions/Mnemonic Codes such that the logic of the program is clearly depicted. Flow-Charts and Algorithms are not required.
Question 4. 
Design a class to overload a function series( ) as follows :
- i) double series(double n) with one double argument and returns the sum of the series,
sum= 1/1 + 1/2 +1/3 + …. 1/n
- ii) double series(double a, double n) with 2 double arguments and returns the sum of the series,
sum = 1/a2 + 4/a5 + 7/a8 + 10/a11+…… to n terms
Question 5. 
Given below is a hypothetical table showing the rates of income tax for male citizens below the age of 65 years:
|Taxable Income (TI) in Rs.||Income Tax in Rs.|
|Does not exceed Rs.1,60,000||Nil|
|Is greater than Rs. 1,60,000 & less than or
equal to Rs. 5,00,000
|(TI- 1,60,000) x 10%|
|Is greater than Rs. 5,00,000 & less than or
equal to Rs. 8,00,000
|[(TI-5,00,000) x 20%] + 34,000|
|Is greater than Rs. 8,00,000||[(TI-8,00,000) x 30%] + 94,000|
Write a program to input the age, gender (male or female) and Taxable Income of a person. If the age is less than 65 years and the gender is male, compute and display the income tax payable as per the table given above.
Question 6. 
Write a menu driven program to :
i) To find and display all the factors of a number input by the user (including 1and excluding the number itself).
Sampleinput: n =15
ii) To find and display the factorial of a number input by the user (the factorial of a non-negative integer n , denoted by n!,is the product of all integers less than or equal to n.
Sampleinput: n =5
For an incorrect choice an appropriate error message should be displayed.
Question 7. 
Write a menu driven program:
i) To check and display whether a number input by the user is a composite number or not (A number is said to be composite, if it has one or more than one factor excluding 1 and the number itself).
Example 4, 6, 8,9…..
ii) To find the smallest digit of an integer that is input.
Sample input : 6524
Sample output : Smallest digit is 2
For an incorrect choice, an appropriate error should be displayed.
Question 8. 
Using the switch statement, write a menu driven program to :
- Generate and display the first 10 terms of the Fibonacci series 0,1,1,2,3,5….The first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two.
- Find the sum of the digits of an integer that is input. Sample Input : 15390 Sample Output: Sum of the digits = 18 For an incorrect choice, an appropriate error message should be displayed.
Question 9. 
Define a class taximeter having the following description:
Data members/instance variables
int taxino – to store taxi number
String name – to store passenger’s name
int km – to store number of kilometers travelled
input () – to store taxino,name,km
calculate() – to calculate bill for a customer according to given conditions
Kilometers travelled(km) Rate/km
1 km Rs 25
1 < km 6 Rs 10
6 km 12 Rs 15
12 km 18 Rs 20
18 km Rs 25
display()- To display the details in the following format
Taxino Name Kilometres travelled Bill amount
– – – –
Create an object in the main method and call all the above methods in it.