This paper is divided into two sections. You are to answer all the questions from section A, and any four from section B.
Section A(40 marks)
Attempt all questions
Question 1 [5X2=10]
- How is abstraction different from Encapsulation.
- i) Name the mathematical function which is used to find sine of an angle given in radians. ii) Name a string function which removes the blank spaces provided in the prefix and suffix of a string.
- What will this code print, choose from the given options?
int arr= new int;
- 0 2. values stored in arr 3. 0000 4. garbage value
4. Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields.
5.State the package that contains the class:i) BufferedReader ii) Scanner
Question 2 [5X2=10]
- Write statements for the following. To create an object of class student with default constructor. To invoke a method of class student i.e Grade_calculation(int x)
- What is the difference between literals and identifiers?
- What are tokens, name any four of them.
- Write any two differences in implicit & explicit type casting
- Write a main difference between while loop & do while loop
Question 3. [5X2=10]
- a) List the variables from those given below that are composite data types.
i) Static int x; ii) arr[i]=10; iii) obj.display(); iv) Boolean b;
v) private char chr vi) String str;
- b) What are the final values stored in x and y below?
double a= -22.71; double b= 99.29;
c) Rewrite the following program segment using while instead of for statement.
d) Name the data member of an Array class that stores the length of the array.
e) What is the difference between / and % operator?
Question 4. [5X2=10]
- Analyse the following program segment and determine how many times the loop will be executed and what will be the output of the program segment.
2. State the output of the following program segment:
3. Write the output of the following program code:
char ch; int x= 97;
System.out.print(ch + “ “);
if(x%10 = =0)
4. Write the Java expressions for:
5. If int y=10 then find
int z=(++y * (y++ + 5));
Section B (60 marks)
Attempt any 4 questions from this section
Each program should be written using a variable list so that the logic of the program is clearly depicted.
Question 5 
Write a menu driven program to perform the following . (Use switch-case statement)
(a) To print the series 0, 3, 8, 15, 24 ……. n terms
(value of ‘n’ is to be an input by the user).
(b) To find the sum of the series given below:
S =1/2+ 3/4 + 5/6 + 7/8 …….. +19/20
Question 6 
Write a program that has a method integerPower (base, exponent) that returns the value of base exponent.
For example, integerPower (4, 3) calculates 43 (or 4 * 4 * 4). Assume that exponent is a positive, nonzero integer and that base is an integer. The method should use a for or while loop to control the calculation. Do not use any math-library methods.
Question 7 
Write a program to accept the year of graduation from school as an integer value from the user. Using the Binary Search technique on the sorted array of integers given below, output the message “Record exists” if the value input is located in the array. If not, output the message “Record does not exist”.
Question 8. 
Write a program to input a number and print whether the number is a special number or not. (A number is said to be a special number, if the sum of the factorial of the digits of the number is same as the original number).
Example: 145 is a special number, because 1! + 4! + 5! = 1 + 24 + 120 = 145(where ! stands for the factorial of the number and the factorial value of a number is the product of all integers from 1 to that number, example 5! = 1*2*3*4*5 = 120).
Question 9 
Write a program to assign a full path and file name as given below. Using library functions, extract and output the file path, file name and file extension separately as shown.
Input C:\Users\Public\Pictures\Sample Pictures\Desert.jpg
Output Path: C:\Users\Public\Pictures\Sample Pictures\
File name: Desert
Question 10. 
An airline announces discount on tickets depending upon destination chosen by the passenger from the following:
|Destination||Rate of ticket (per person)
The discount will be given as per the given criteria:
|Ticket Amount||Discount on Total amount|
|Above Rs. 200000||25%|
|Rs. 150001 to Rs. 200000||20%|
|Rs. 100001 to Rs. 150000||15%|
|Less than Rs. 100000||10%|
Write a Java program to input name of the passenger/group head (in case of more than 1 passengers), number of passengers and destination code viz: A or a for America, S or s for Singapore, J or j for Japan, and T or t for Thailand.
Calculate the total ticket amount and discount amount. Find the net balance to be paid excluding the discount. Print name, number of passengers, destination code, discount and total ticket amount to be paid.