Formatting page ...
SUBJECT: Computer Applications Class: X Marks:100 Time: 2Hrs Answers to this Paper must be written on the paper provided separately. You will not be allowed to write during the first 15 minutes. This time is to be spent in reading the question paper. The time given at the head of this Paper is the time allowed for writing the answers. This paper is divided into two sections. Attempt all questions from Section A and any four questions in Section B. The intended marks for questions or parts of questions are given in brackets[ ]. SECTION A (Attempt all questions from this section) [40 Marks] Question 1 a) A single dimensional array contains N elements what will be the last subscript? [2] b) What is the role of try and catch keyword in exception handling? Give an example. [2] c) Suppose a = Computer . What will be the following Java statement return? Explain with the output [2] a.toCharArray(a.substring(2,7)); d) Differentiate interpreter and compiler. [2] e) Values are assigned to a variable using which operator? Are both these statements same? [2] a + = b; a = a + b; Question 2 a) Differentiate between: i) Call by value and Call by reference [2] ii) Pure function and Impure function b) Evaluate the following Java expression if x=-3, y= --x. [2] x - = --x + x--+y++ + - - x + --y* 2 c) What is the purpose of using This keyword? [2] d) Explain the formal and actual parameter with an example. [2] e) Consider the following code [2] int amount = 100; while (amount > 0 ) { system.out.println(amount); amount = amount -1; } Rewrite the above code using (i) do while (ii) for Question 3 a) If a class is defined as amphibians, give a statement to create an object frog belonging to class amphibians. [2] b) What is data hiding? [2] c) If x = -9.99, calculate i) Math.abs(Math.floor(x)) ii) Math.pow(Math.ceil(x),2) d) If String x = Computer ; [2] [2] String y = Applications ; What do the following function return for; i) System.out.println(x.substring(1,5)); ii) Sytem.out.println(x.charAt(0) + y.charAt(4)) e) Given a package named Student.edu, how would you import a class named Test1 contained in this package? Write one line statement only. [2] Question 4 a) Write a recursive function for finding the factorial of a number. [2] b) What is the smallest and largest value of primitive type byte? [2] c) Declare an array of 5 integers and initialize first five even numbers to it? [2] d) What is stream? Name any two inbuilt classes of IO package. [2] e) . [2] SECTION B (Attempt any four questions from this section) [60 Marks] Question 5 Design a class to overload a function num_cal( ) as follows: [15] (i) void num_cal( int num, char ch) with one integer argument and one character argument. It computes the square of an integer if choice ch is s otherwise computes its cube. (ii) void num_cal(int a, int b, char ch) with two integer arguments and one character argument. It computes the product of integer arguments if ch is p else adds the integers. (iii) void num_cal(String str1, String str2) with two String arguments prints two Strings are equal or not Question 6 [15] Write a program to accept 10 numbers in single Dimensional Array and pass this array to a function search(int m[ ] , int ns). The function checks whether the given element is present in the list or not. It returns true, if found and false otherwise. Question 7 [15] Write a program to accept a string and the frequency of a word entered by the user in a string. However, the word should not be a part of a string. Sample Input: the quick brown fox jumps over the lazy dog Frequency of the word to be searched: the Sample Output:2 Question 8 [15] Using the switch statement, write a menu driven program to calculate the maturity amount of a bank deposit. The user is given the following options: (i) Term Deposit (ii) Recurring Deposit For option (i) accept principal(p), rate of interest(r) and time period in years(n). Calculate and output the maturity amount (A) receivable using the formula: A = p(1 + r/100)n For option (ii) accept monthly instalment (p), rate of interest(r) and time period in months (n). Calculate and output the maturity amount (A) receivable using the formula. A = p x n + p x [n x (n +1)] / 2 X r/100 x 1/ 12 For an incorrect option, an appropriate error message should be displayed. Question 9 [15] Write a program to: (i) Input the ISBN(International Standard Book Number) code as a 10 digit integer. (ii) If the ISBN is not a 10 digit integer, output the message, Illegal ISBN and terminate the program. (iii) If the number is 10 digits, extract the digits of the number and compute the sum as given below: Example: If the ISBN code is 1401601499 sum = 1 x 1+ 2 x 4 + 3 x 1 + 4 x 1 + 5 x 6 + 6 x 0 + 7 x 1 + 8 x 4 + 9 x 9 + 10 x 9 (iv) If the sum is divisible by 11, output the message, Legal ISBN . If the sum is not divisible by 11, output the message, Illegal ISBN .
|