Formatting page ...
Visit YouTube Channel: ICSE JAVA CLASS 10 COMPLETE REFERENCE PRE-BOARD EXAMINATION Grade: X SUBJECT: Computer Applications Date : 08 -02-2018 Maximum Marks: 100 Duration: 2 hour 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 this 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. You are to answer 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 (40 Marks) Answer all the questions [10x4=40] Question 1: (a) Give the visibility of following access specifiers. i. private ii. protected [2] (b) State the Object Oriented concept that is implemented through i. Function Overloading ii. A super class and sub class [2] (c) What is a package? Give two widely used packages. [2] (d) Mention two attributes to declare the following: i. variable ii. class [2] (e) What is the significance of final variable? Give an example. [2] Question 2: (a) Briefly explain type casting with an example. [2] (b) State a difference between instance methods and static methods. [2] Visit YouTube Channel: ICSE JAVA CLASS 10 COMPLETE REFERENCE (c) Can you use any alternative to 'if else' in java? If yes, name it and give an example for the same. [2] (d) Discuss the suitability of 'for' loop and 'while' loop in java. [2] (e) What is the difference between array declaration and array initialization? Give one example each. [2] Question 3: (a) Give the output of the following programming code: [2] String Str1 = "Inkjet Printer", Str2 = "Pencil"; System.out.println(Str1.startsWith(Str2.substring (4,5).toUpperCase())); System.out.println(Str1.substring (3,6).concat(Str2.substring(0,3))); (b) Convert the following into 'do-while' loop. [2] for(int n = 10; n>0; n--) { System.out.println("My value is : "+n); n--; } (c) Write valid java statement for the following mathematical expression. [2] + cos (d) What are the final values stored in variables y and z after executing following [2] java codes if, initial value of x is 3.12. y = Math.sqrt(Math.ceil(x)); z = Math.pow(y,Math.floor(x)); (e) Answer the following after studying the following java code? [2] int i, j = 5; for (i = 8 ; i <= 10; i++ ) { for ( ; j<10; i++){ System.out.println("Inner Loop");} System.out.println("Outer Loop"); } i. How many times the outer loop will get executed? Why? ii. How many times the inner loop will get executed? (f) Write a prototype of parameterized constructor of class called ICSE and [2] Visit YouTube Channel: ICSE JAVA CLASS 10 COMPLETE REFERENCE initialize the variable with the value 2.34. (g) List the errors in the following java snippet and explain each error in brief. [4] int A [] = new A [20]; for (int x = 0, x < A.length(); x++) { A [x] = Obj.next(); } System.out.println(A[20]); (h) If x = 2 and y = 3 initially, what will be the value x and y after executing following codes: [4] i. x = x++ + --y + ++ x - --y; ii. y %= x - --y + ++y; 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 program should be written using Variable descriptions/Mnemonic Codes so that the logic of the program is clearly depicted. Flow-Charts and Algorithms are not required. Answer any four questions 15 x 4 = 60 Question 4: Blood group is identified using following details of Anti Bodies in a blood [15] sample. Whether Anti-Bodies are Present or Not Anti-A Anti-B No Yes No Yes Result of Blood Group No No Yes Yes O B A AB Write a program to print the Blood Group according to the presence and absence of Antibodies. If invalid input is given then appropriate message should be printed. Question 5: Write java program to overload the following methods. [15] Visit YouTube Channel: ICSE JAVA CLASS 10 COMPLETE REFERENCE void number (int a, int b) which prints the LCM of a and b. void number (int N) which prints the sum of following series up to N. 1/1 + 1+2/1x2 + 1+2+3/1x2x3 .. 1+2+3+4 N/1x2x3x4x N Question 6: Following is Floyd's Triangle of 5 rows. [15] 1 23 456 7 8 9 10 11 12 13 14 15 Write a program to print Floyd's triangle of given number of rows. Question 7: Write a program to create an array of 10 Names and print the longest name [15] with number of characters present in that name. Question 8: Write a program to input a number, count and print the frequency of each digit present in that number. Example : if input is 47123277 Digit Freq 1 1 2 2 3 1 4 1 7 3 [15] Question 9: Define a class called Laptop with the following description: Instance variables/Data members: int BP to store basic price. String P to store type of processor. String B to store name of the brand. String OP to store operating system loaded in the Laptop boolean ST to store the value 'true' if Touch Screen 'false' if not. int PP to store product price. Member methods: [15] Visit YouTube Channel: ICSE JAVA CLASS 10 COMPLETE REFERENCE Laptop() - default constructor to initialize data members(int as 0 and String as"") void input() - to input P, B, OP, ST and PP. void calc() - to calculate discount on PP as given below and net price after discount if price is more than 19,999 - 5% discount if price is above 30,000 and below 40,000 - 10% discount if price is 40,000 and above 15% discount. otherwise no discount. void print() - to display the Product you purchased with Original price, discount and net price. Call the above methods in main method.
|