Formatting page ...
COMPUTER APPLICATIONS (Theory) (Two hours) Answer 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 to write the answers. This Paper is divided into 2 sections. Attempt all questions from Section A and any four questions from Section B. The intended marks for questions or parts of questions are given in the brackets [ ] SECTION A (40 Marks) Attempt all questions Question 1 a) b) c) d) e) f) g) Question 2 a) b) c) d) e) f) g) T21263 What are the default values of the primitives data types int and float? Identify the types of literals listed below: i) 0.5 ii) A iii) false iv) a Why class is called object factory? What is Polymorphism? Name the concept of polymorphism which is implemented in Java programming? Name the key word that allocated dynamic memory to objects, variables. What are escape sequences? Write two examples and mention their working? Explain an example the working of explicit type conversion. Name the package that contains Wrapper classes. Write two Wrapper class and one example each. Write a prototype to convert an Integer value to string type. Differentiate between pure and impure functions. Differentiate between void Abc ( ) & Abc ( ). Write all different types integer data types in ascending order of their size. Why is main ( ) is static in nature by default? What is the difference between selection sort and bubble sort. THIS PAPER COMPRISES OF 4 PRINTED PAGES AND ZERO BLANK PAGE [1] [2] [1] [2] [1] [2] [1] [2] [1] [2] [2] [1] [1] [1] TURN OVER Question 3 a) b) c) d) e) f) g) h) i) j) k) l) T21263 Write the equivalent Java expression for 4 2 Read the code segment and find out how many times loop will execute: int x =2, y = 50; do { ++x; y - = x++; }while (x<=10); How will you differentiate between = = and equal ( ) ? Given: int p = {11,21,31,41,51}; p[0] = 10; p[3] = p[1]; int m = p[1] p[0]; int n = p[3] + 22 + p[2]; System.out.println( The difference : +m); System.out.println( the sum is : + n); Find the value of m and n. Calculate the output of the following expression. a+ = a++ - (- - a * - -b) a = 12 , b= 12. Also find the values of a and b. [1] [1] Define escape sequence. Name any four escape sequences with their use. Write a java prototype as an example to show the concept of constructor overloading. Write the output for the following String function: i) String st = Moral Science .substring(3,10); ii) int n = Geography .indexOf( r ); Identify which of these method are static and non static i) pow( ) ii) display( ) If Car is a class , write a statement to create an object maruti. Write an example to show the concept of call by value. Differentiate between class variable , instance variable and local variable. [2] 2 [2] [2] [2] [2] [1/2 +1/2] [1] [1] [2] [3] TURN OVER SECTION B (60 Marks) Attempt any four questions from this Section. The answers in this section should consist of the Programs in either Blue J environment or any program environment with Java as the base. Each programs should be written using Variable description / Mnemonic Codes such that the logic of the programs can be clearly depicted. Flowcharts and Algorithm are not required. Question 4 Write a program to accept a number and check and display whether it is spy number or not. A number is said to be spy if the sum of the digits of a number is equal to product of the digits. Example: consider the number 1124. Sum of the digits: 1+1+2+4 = 8 Product of the digits: 1*1*2*4 = 8 [15] Question 5 Using the switch statement , write a menu driven program to: i) Generate and display the sum of first 10 numbers of Fibonacci numbers. The first two numbers of Fibonacci series are 0 and 1 and each subsequent number is the sum of two like 0,1,1,2,3,5 n ii) Find the sum of the following series: 1 3 5 S = 2! + 4! + 6! + __________________________ [15] Question 6 Write a Java program to create two 1-Dimensional arrays storing 10 years and 10 weight of a person. Perform selection sort operation to arrange the weight in the ascending order and print the weight with corresponding year. eg: The output will be 1992 36 1993 38 1994 40 1996 42 [15] Question 7 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 1 1 1 Sum = 1 + 2 + 3 + ________________ ii) double series(double a, double n) with two double arguments and returns the sum of the series Sum = 1 2 + 4 5 + 7 8 + _____________ +1 Write main function and create object to call the above mentioned methods. T21263 3 [15] TURN OVER Question 8 Define a class Employee having the following description: [15] Data members / instance variable int pan to store personal account number String name to store the name double income to store annual taxable income double tax to store the calculated tax Member function Employee ( ) Parameterize constructor to initialize class variables void input( ) Store the pan number , name taxable income void calc ( ) Calculate tax of an employee void display( ) Display the details of an employee Write a program to compute the tax according to the given condition and display the output as per given format: Total annual taxable income Tax Upto `1,00,000 No tax From `1,00,001 to `1,50,000 10% of the amount exceeding `1,00,000 From `1,50,001 to `2,50,000 `5000+20% of the amount exceeding `1,50,000 Above `2,50,000 `25000+30% of the amount exceeding `2,50,000 Create the objects under the same class and call the methods using objects. Question 9 Write a Java program using if else..if condition to print the following pattern: In the first case print 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 In the second case 1 8 27 64 125 216 343 512 729 1000 Add appropriate message if none of the above condition is satisfied. T21263 4 [15] END
|