Formatting page ...
NIRAJ PUBLIC SCHOOL PREFINAL II JANUARY 2021 COMPUTER APPLICATIONS CLASS: 10 TIME: 2 hrs. MARKS: 100 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 only. Answer ALL questions from SECTION Aand anyFOUR questions from SECTION B. The intended marks for questions or parts of questions are given in brackets (). SECTION A (40 marks) Attempt all the questions QUESTION NO 1:- a) i)What is the difference between ASCII and Unicode? ii) Write the java expression for 5 + (2) b) Evaluate The Following:(2) int a=10,b=4; (i) int z= ++a/--b - a++* ++b%a ; System.out.println(z); (ii) System.out.println( value= + a + b ); c) i)What is the size(in bytes) of a class consisting of a floating number and a long integer. ii)Name 2 types of java programs. (2) d) Write the difference between length and length ( ). (2) e) What is the difference between pure and impure functions? (2) QUESTION NO 2:- a) Write the output:(2) System.out.println(Math.pow(2,3)+Math.round(9.777); System.out.println(Math.ceil(-9.3)+Math.sqrt(9)); System.out.println(Math.max(5.2,7); System.out.println(Math.floor(-5.3+Math.rint(5.5)); b) Differentiate between an infinite loop and empty loop. (2) c) Explain the difference between static and dynamic initialization by giving a suitable example. (2) d) Define inheritance. Name the keyword used for inheritance. (2) e) i) What is Byte code? ii) What are library classes? (2) :2: PREFINAL II JANUARY 2021 CLASS 10TH : COMPUTER APPLICATIONS QUESTION NO 3:- a) Give the output of the following code snippet. (i) String str= new String( java world ); System.out.println(str.substring(0,3).compareTo(Str.substring(7)); (2) (ii) b) c) d) e) String str= java applications ; System.out.println(str.lastIndexOf(str.charAt(1)); What are escape sequences? Explain. (2) Write the difference between simple expression and complex expression.(2) If intx[ ]={34,6,8,23,9,5}; what will be the output? (2) i) System.out.println(x[2] x[1]-- *x[1]++); ii) System.out.println(x[2] %(++x[2]/4*x[1])); i) What is an array? ii) What are comments? (2) f) Write the output. (2) int a=0,i; for(inti=2;i<10; ) { a=++i-i++*4; System.out.println(a); } g) Write the difference between while loop and do-while loop. (2) h) What is the difference between primitive data type and composite data type? (2) i) i)What are wrapper classes? Give an example. ii) Give the prototype of a function Add that takes one String argument and one character argument, returns true or false and whose only one copy exits for all objects. (2) j) Convert the following into if-else (2) int c; double calc = 0.00d; switch(c) { case 5: calc=c*25; break; case 10: calc=c*55; break; case 15: calc=c*75; break; default: calc=c*85; break; } :3: PREFINAL II JANUARY 2021 CLASS 10TH : COMPUTER APPLICATIONS SECTION B (60 Marks) Attempt any four questions from this Section. Each question carries 15 marks. The answers in this section should consist of the programs in either BlueJ environment or any program environment with Java as the base.Each program should be written using Variable descriptions/Mnemonic codes so that the logic of the program is clearly depicted. QUESTION NO 4:(15) Define a class Passenger described as below Data members: Nop (Number of passengers) Dc (Destination code) A or a for America S or s for Singapore J or j for Japan and T or t for Thailand Amount (Total ticket amount) Discount (Discount amount) Total (Total amount to be paid after excluding the discount) Member methods: Passenger() : Default constructor Accept() : To accept number of passengers and the destination code Calc() : To calculate the Total ticket amount Destination Rate of ticket(per person) America Rs.50000.0 Singapore Rs.20000.0 Japan Rs.25000.0 Thailand Rs.15000.0 Compute() :Discount will be given as per the given criteria: Amount Above Rs.200000 Rs.150001 to Rs.200000 Rs.100001 to Rs.150000 Less than Rs.100000 Discount 25% 20% 15% 10% Find the net balance to be paid excluding the discount. Display() : Print the number of passengers, destination code, discount and total ticket amount in the given format. N0_PASS DESTINATION NATIONAL AIRWAYS AMOUNT DISCOUNT TOTAMT Write main() method to create object of the class and call the above member methods. :4: PREFINAL II JANUARY 2021 CLASS 10TH : COMPUTER APPLICATIONS QUESTION NO 5:- (15) QUESTION NO 6:- (15) Write a program to accept a number and check if it is an Adam number or not. If the square of a number and the reverse of square of the same number are palindrome to each other, then the number is Adam number. Ex:12 Square of 12 =144 Reverse of 12=21 Square of 21= 441 144 and 441 are palindrome to each other. Write the given overloaded methods: (i) (ii) (iii) + + + .. + ( ) Sum of the prime numbers from 2 to 100. main() QUESTION NO 7:- (15) Write a program to store the names and bill amount of 25 customers in 2 different arrays and i) Calculate the discount and total amount AMOUNT DISCOUNT(%) <1000 0 Next 4000 5% Next 5000 8% >10000 10% ii) Print in the given format SNO NAME BILLL AMOUNT DISCOUNT 1 ANUSHA 20000 2000 18000 2 RAVI 5000 250 4750 TOTAL AMOUNT :5: PREFINAL II JANUARY 2021 CLASS 10TH : COMPUTER APPLICATIONS QUESTION NO 8:- (15) Write a menu driven program (using Scanner class functions) to (i) Accept a set of any 10 characters. Calculate the sum of ASCII codes of the characters. Print the reverse of the sum. OR (ii) Accept a number and check whether it is a Special number or not. Special number: A number is said to be special number when the sum of factorial of its digits is equal to the number itself. Example- 145 is a Special Number as 1!+4!+5!=145. OR (iii) Print a filled rectangle of length x and breadth y using the symbol @ . Ex:- Input value of x=3, y=5 Output : @@@@@ @@@@@ @@@@@ For an incorrect choice, appropriate error message should be displayed. QUESTION NO 9:- The Central Library charges late fine from the students as per the rules: No. of days late Up to 10 days 11 to 15 days 16 to 30 days More than 30 days Text books Rs. 2 per day Rs. 5 per day Rs. 8 per day Rs. 10 per day (15) General books Rs. 4 pr day Rs. 6 per day Rs. 10 per day Rs. 12 per day Write a program to input name of the person, number of days late and type of the book ( T for Text books and G for General books). Calculate and display the fine and name of the person against whom the book is issued. (Hint: Use if-else)
|