Formatting page ...
ICSE Practice Question Paper Prepared by: A.Tindale 8979764707, 8909726126 COMPUTER APPLICATIONS (Theory - Two hours) 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 from Section B. The intended marks for questions or parts of questions are given in brackets [ ]. SECTION A (## Marks) Attempt all questions Question 1 (a) Give the difference between :(1) Default Constructor and Normal Constructor (2) Multilevel Inheritance and Multiple Inheritance. (3) Instantiation and Initialization. (b) What is Light weight Code and Spaghetti code? (c) Write an expression in Java for ( ( ( ) ) )+ (d) Give example of any 5 lexical unit of a Java program. (e) What is the result produced by the following expression when int a=5, double b=3.01, int x=0 Show the working steps. (i) x+ = ++x++++b - x; (ii) y = a+++++b+++a; Question 2 (a) What are different techniques of exception handling ? (b) How many types of Java Programs are there ? Name all the categories. Question 3 Define the following Terms :a) Abstract class b) Absurd Value c) Coercion d) Delimeter e) Dot (.) Operator f) Early Binding g) Infinity h) Hybrid Inheritance i) Integral Promotion j) Label k) Intrinsic data types l) Message passing m) Multi-threading n) Mutator method o) NaN p) Reusability q) Setter method r) Truncation s) WORA Question 4 Explain the following keywords used in a Java program : a) abstract b) assert c) enum d) extends e) implements f) instanceOf g) interface h) native Question 5 (a) What is the difference between local variable and instance variable? [2] (b) Will this program compiles successfully? public class CodingExamples { public static void main(String args[]) { System.out.println(1); http://javaconceptoftheday.com/ System.out.println(2); } } (c) What Are Access And Non-Access Modifiers In Java? Question 6 - What will be the output of the following program segment? (i) String st = Duplication ; System.out.println(st.indexOf(st.charAt(4))); (ii) int a = 10; if(a>10 && a<9) a++; else a-- ; System.out.println(--a); (iii) int a= 7, b = 3,c; if (a>b || a ! = b) c = ++a+--b; System.out.print(c+ - +a+ - +b); (iv) int i=2,x=0; for(i=1 ; i<=4 ; ++i) ; {System.out.print(++x); } SECTION B (## 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 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 7 - A Financial Company announces a plan for their customers on Fixed Deposit scheme as per the following criteria :No.of Days Rate of Interest/p.a. Bonus Amount in Rs. Upto 90 Nil 500 Next 270 7.5 % 2000 Next 360 9.33 % 5000 Rest of the Days 11.10 % 9000 Input Customer name, Fixed Deposit amount and number of days for which FD is to be made. ICSE Practice Question Paper Prepared by: A.Tindale 8979764707, 8909726126 Question 8 - Input Train No., Name of the train and Distance covered. Write a program to Find the total time taken by the Train as per the following schedule:Distance Covered Upto 55 kms Next 145 kms Next 150 kms Rest of the kms @ Speed in km 70 km/hr 80 km/hr 65 km/hr 90 km/hr Stoppage Time 6 minutes 8 minutes 3 minutes 9 minutes Question 9 - Input any long Sentence or Paragraph and find the frequency of Fibonacci String and also print the longest Tribonacci string. Question 10 - Input any sentence and sort all the words according to the characters of the word from Right to Left in Descending Order without changing the case and sequence of characters of the word. Sample Input Java Language is mend for Genius programmers Sample Input Genius programmers is for Language mend Java Question 11 - Input 50 Employee names along with Father s name in a single Dimension Array and Find the matching first Anagram pair of a given Name in the list of Names or Father s Name. Question 12 - Accept any 50 different names of an item and their MRP and print the following:a) Sort MRP present on even index no. without disturbing rest of the MRPs. b) Transpose MRP present on odd index no. c) Find the Name of an Item with Lowest and Highest MRP. Question 13 - WAP to accept Quantity, Rate and print the amount in words also. Eg. Amt=435762 Rs. Four Lac Thirty Five Thousand Seven Hundred Sixty Two. Question 14 - Input 20 integer numbers in a SDA and delete all Non-Anagram numbers (Delete with shifting) and also print the Cube Root of the first Anagram Number Question 15 - Write a program in Java to input any two numbers and check whether it is Amicable number Pair or not. Question 16 - Input Name of the student and marks of 8 different subjects in a SDA for 50 students. Print the list in the following format after considering only the best five subjects for each student. MARKS LIST -------------------------------------------------------------------------------------------------------------------------S.No. NAME OF THE STUDENT SUB-1 SUB-2 SUB-2 SUB-2 SUB-2 TOTAL-MARKS Percentage% -------------------------------------------------------------------------------------------------------------------------Question 17 - From a given string arrange all the Characters in ascending order according to their potential value. Note:- An ASCII decimal value character having greater decimal value is the more weighty character. Question 18 - Define a class watercharges having the following description: Data members / instance variables int meterno - to store Meter connection number String subname - to store consumer's name int gallon - to store number of gallons water consumed double wtax - to computer tax Member functions: waterchargesr() - constructor to initialize meterno to 0, subname to and billamt to 0. accept() - to input name of the Consumer, Meter No. and Water consumed print() - To display the details in the following format calculate() - to compute bill for a customer according to the given tariff :Water Supplied in Gallons Rate for every fraction of 100 Gallon Tax % Upto 400 Nil 1.0 Next 2600 Rs. 1.25 1.2 Next 3000 Rs. 2.75 2.0 Rest of the Gallons Rs. 3.10 2.2 Consumer Name Meter No. Water Consumed Tax Amount Payable Amount Question 19 Write a menu driven program to print the given pattern and find the sum of the following series depending upon the user s choice also display message for incorrect option. Eg. 1, 2 or 3 1 (b) S = 1*2 1*2*3 1*2*3*4 1*2*3*4*5*4*3*2*1 (c) t = 4*3*2*1 3*2*1 2*1 1 (a) + + + ! + + ! ! + + ! + + + 20 Terms ! + 25 Terms ICSE Practice Question Paper Prepared by: A.Tindale 8979764707, 8909726126 Question 19 Enter any 10 different integers in a array a[] and another 10 nos. in array b[] then swap both the arrays without using third array or a temporary normal variable. (Do not disturb the sequence of array a[] & b[]. 22 Math.PI This returns the 16 digits precise value of PI(Note that it is not a function) Q. What is a singleton class? Give a practical example of its usage. Ans. A singleton class in java can have only one instance and hence all its methods and variables belong to just one instance. Singleton class concept is useful for the situations when there is a need to limit the number of objects for a class. The best example of singleton usage scenario is when there is a limit of having only one connection to a database due to some driver limitations or because of any licensing issues. Byte Code is an intermediate code that consists of a set of pseudo machine language instructions that are understood by the JVM and are independent of the underlying hardware. It is called byte code because each chunk of code is of 8 BITS (1 byte = 8 Bits). The byte code files have an extension of *.class When a method is declared as final,it can NOT be overridden by the subclasses.This method are faster than any other method,because they are resolved at complied time. When a class is declares as final,it cannot be subclassed. Example String,Integer and other wrapper classes. Difference Between Iterator and Enumeration Interface in Java The three cursors that are used to access the elements from any collection one by one are Enumeration, Iterator and ListIterator. Though, Iterator and Enumerator are meant for performing the same work. Still, they are distinct from each other in a sense that Enumeration has read-only access to the elements in the collection. On the other side, Iterator can read as well as remove the elements from the collection. The important difference between the Iterator and Enumeration is that the Enumeration can t be applied on the collection classes it is only applicable on the legacy classes. On the other hand, the Iterator is applicable to the collection classes hence, it is referred as a universal cursor. Let us learn some more difference between Iterator and Enumeration with the help of the comparison chart shown below. Constructors can be classified into 5 types 1. Default Constructor 2. Parameterized Constructor 3. Copy Constructor 4. Static Constructor 5. Private Constructor Constructor Chaining - Constructor chaining is nothing but a scenario where in one constructor calls the constructor of its super class implicitly or explicitly. Suppose there is a class which inherits another class, in this case if you create the object of child class then first super class(or parent class) constructor will be invoked and then child class constructor will be invoked. There are two types in primitive casting. 1) Auto Widening 2) Explicit Narrowing 1) Auto Widening When you are converting data from small sized data type to higher data type, i.e when you are converting data from left-placed data type to right-placed data type in the above order, auto widening will be used. For example, when you are converting byte to short or short to int, auto widening will be used. 2) Explicit Narrowing When you are converting data from big sized data type to small sized data type, i.e when you are converting data from right-placed data type to left-placed data type in the above order, explicit narrowing will be used. For example, when you are converting double to float or float to int, explicit narrowing will be used. 2) Derived Casting Derived casting is used to change the type of object from one user defined data type to another user defined data type in the class hierarchy. There are two types in derived casting. 1) Auto-up Casting 2) Explicit Down Casting. 1) Auto-Up Casting Auto-Up Casting is used to change the type of object from sub class type to super class type. i.e an object of sub class type is automatically converted to an object of super class type. For example, 2) Explicit Down Casting Explicit down Casting is used to change the type of object from super class type to sub class type. i.e you have to explicitly convert an object of super class type to an object of sub class type. For example, Java Enums Tutorial With Examples ICSE Practice Question Paper Prepared by: A.Tindale 8979764707, 8909726126 Enums in java are mainly used for grouping similar kind of constants as a one unit. constants means static and final. Enums are introduced in JDK 1.5 onward. Before that similar kind of constants are grouped by declaring them as static and final in one class. Below example shows how the constants will look without enums. Program to print the possible consecutive number combinations : A positive natural number, (for e.g. 27), can be represented as follows: 2+3+4+5+6+7, 8+9+10, 13+14 where every row represents a combination of consecutive natural numbers, which add up to 27. Write a program which inputs a positive natural number N and prints the possible consecutive number combinations, which when added give N.
|