Trending ▼   ResFinder  

Class 10 ICSE Pre Board 2015 : Malayalam

13 pages, 0 questions, 0 questions with responses, 0 total responses,    0    0
Ganga Rejish
GHS mavelikara,  Mavelikara 
+Fave Message
 Home > adithyarajgangarejishkumar >   F Also featured on: schoolkid

Formatting page ...

ICSE 2015 Board Paper Solved Section A(40 marks) Question 1 (a)What are the default values of the primitive datatypes int and float ? Ans : Default value of int is 0 and that of float is 0.0 (b) Name any two OOP principles ? Ans : 1.Object 2.Class (c)What are Identifiers? Ans : Identifiers are a type of tokens used in Java Programming.Their value may change several types during the execution of the program. Example : int a = 5; here 'a' is the Identifier and holds a value of 5 in int type. (d)Identify the literals listed below : (i)0.5 (ii)'A' (iii)false (iv)"a" Ans : (i) Real literal (ii)character literal (iii)boolean literal (iv)String literal (e)Name the wrapper class of char type and boolean type Ans : Wrapper class of char is Character and that of boolean is Boolean Question 2 (a)Evaluate the value of n if the value of p=15, q=19; int n =(q-p)>(p-q)?(q-p):(p-q); Ans : The value of n will be 14 (b)Arrange the following primitive data types in an ascending order of their size : (i)char (ii)byte (iii)double (iv)int Ans : byte<char<int<double (c)What is the value stored in variable res given below : double res = Math.pow("345".indexOf('5'),3); Ans : The value of res will be 8.0 in double data type (d)Name the two types of constructors Ans : The two types of Constructors are : (i)Default Constructor (ii)Parameterized Constructor (e)What are the values of a and b after the following function is executed, if the values passed are 30 and 50 : void paws(int a,int b){ a=a+b; b=a-b; a=a-b; System.out.println(a+" , "+b); Ans : The value of a will be 50 and that of b will be 30 Question 3 (a)State the data type and the value of y after the following is executed : char x = '7'; y = Character.isLetter(x); Ans : The value of y will be false in boolean data type (b)What is the function of catch block in exception handling? Where does it appear in a program? Ans : Catch block catches any error that had occured in try block and thus prevents any termination of the execution of the program due to an exception. It appears after the try block in a program (c)State the output of the following program segment is executed : String a = "Smartphone", b = "Graphic Art"; String h=a.substring(2,5); String k = b.substring(8).toUpperCase(); System.out.println(h); System.out.println(k.equalsIgnoreCase(h)); Ans : The Output will be : art true (d)The access specifier that gives most accessibility is __________ and the most accessibility is ___________ Ans : public , private (e) (i)Name the mathematical function which is used to find sine of an angle given in radians Ans : Math.sin(); (ii)Name a string function which removes the blank spaces provided in the prefix and suffix of a string Ans : trim(); (f) (i)What will the code print? int arr[] = new int [5]; System.out.println(arr); (i)0 (ii)value stored in arr[0] (iii)0000 (iv)garbage value Ans : (iv)garbage value (ii)Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields Ans : this (g)State the package that contains the class : (i) BufferedReader (ii)Scanner Ans : (i) java.io (ii)java.util (h)Write the output of the following code segment : char ch; int x = 97; do { ch = (char)x; System.out.print(ch+" "); if(x%10==0) break; ++x; }while(x<=100); Ans : The output will be : abcd (i)Write the Java expression for : a2+b2 /2ab Ans : ((a*a)+(b*b))/2*a*b; (j) If int y = 10 then find int z = (++y*(y++ +5)); Ans : The value of z will be 176 Section B Question 4 Define a class ParkingLot with the following description : Instance variables/data members : int vno - to store the vehicle number int hours - to store the number of hours the vehicle is parked in the parking lot double bill - to store the bill amount Member methods : void input() - To input and store vno and hours void calculate() - To compute the parking charge at the rate of Rs.3 for the first hour or part thereof, and Rs.1.50 for each additional hour or part thereof. void display() - To display the detail Write a main method to create an object of the class and call the above methods Ans : class ParkingLot { int vno,hours; double bill; void input(int v,int hr) { vno=v; hours=hr; } void calculate() { if(hours<=1) bill=3; else bill=3+((hours-1)*1.5); } void display() { System.out.println("Vechile Number :"+vno); System.out.println("No. Of hours :"+hours); System.out.println("Bill :" +bill); } void main(int v1,int h1) { ParkingLot p=new ParkingLot(); p.input(v1,h1); p.calculate(); p.display(); } } Question 5 Write two separate programs to generate the following patterns using iteration(loop) statements : (a) (b) class Pattern1 { static void test() { for(int i=1;i<=5;i++) { for(int j=1;j<=i;j++) { if(j%2!=0) System.out.print("* "); else System.out.print("# "); } System.out.println(); } } } class Pattern2 { static void test() { int k = 5; for(int i=5;i>=0;i--) { k=5; for(int j=i;j>=0;j--) { System.out.print(k+" "); k--; } System.out.println(); } } } Question 6 Write a program in to input and store all roll numbers, names and marks in 3 subjects of n number of students in five single dimensional arrays and display the remark based on average marks as given below Average marks = total marks/3 Average marks Remark 85 - 100 EXCELLENT 75 - 84 DISTINCTION 60 - 74 FIRST CLASS 40 - 59 PASS Less than 40 POOR Ans : import java.util.*; class Ques6 { static void test(int n) { Scanner in = new Scanner(System.in); String name[] = new String[n]; int rno[] = new int[n]; int sub1[] = new int[n]; int sub2[] = new int[n]; int sub3[] = new int[n]; System.out.println("Enter the Details : "); for(int i = 0;i<n;i++) { System.out.println("Enter the name "); name[i]=in.nextLine(); System.out.println("Enter the Roll No "); rno[i] = in.nextInt(); System.out.println("Enter the First Subject marks "); sub1[i]=in.nextInt(); System.out.println("Enter the Second Subject marks "); sub2[i]=in.nextInt(); System.out.println("Enter the Third Subject marks "); sub3[i]=in.nextInt(); int tot = sub1[i]+sub2[i]+sub3[i]; int avg = tot/3; if(avg>=85&&avg<=100) System.out.println("Excellent "); if(avg>=75&&avg<84) System.out.println("Distinction "); if(avg>=60&&avg<75) System.out.println("First Class "); if(avg>=40&&avg<60) System.out.println("Pass "); if(avg<40) System.out.println("Poor "); } } } Question 7 Design a class to overload a function Joystring() as follows : (i)void Joystring(String s, char ch1, char ch2) with one string and two character arguments that replaces the character argument ch1 with the character argument ch2 in the given string s and points the new string Example : Input value of s = "TECHNALAGY" ch1 = 'A' , ch2 = 'O' Output : "TECHNOLOGY" (ii)void Joystring(String s) with one string argument that prints the position of the first space and the last space of the given String s. Example :First Index : 5 Last Index : 36 (iii)void Joystring(String s1, String s2) with two string arguments that combines the two strings with a space between them and prints the resultant string Example : Input value of s1 = "COMMON WEALTH" , s2 = "GAMES" Output : "COMMON WEALTH GAMES" Ans : class Question_7 { void Joystring(String s,char ch1,char ch2) { System.out.println("New String : "+(s.replace(ch1,ch2))); } void Joystring(String s) { System.out.println("First Index : "+(s.indexOf(' '))); System.out.println("Last Index : "+(s.lastIndexOf(' '))); } void Joystring(String s1,String s2) { System.out.println("New String : "+(s1.concat(s2))); } } Question 8 Write a program to input twenty names in an array. Arrange these names in descending order of alphabets , using the bubble sort technique Ans : import java.util.*; class buble_strng { static void main() { Scanner cy=new Scanner(System.in); String m[]=new String[20],t; System.out.println("Enter names in the array : "); for(int i=0;i<m.length;i++) { System.out.print("m["+i+"] :"); m[i]=cy.nextLine(); } for(int i=0;i<m.length-1;i++) { for(int j=i+1;j<m.length;j++) if(m[i].compareTo(m[j])<0) { t=m[i]; m[i]=m[j]; m[j]=t; } } System.out.println("Sorted array : "); for(int i=0;i<m.length;i++) System.out.println(m[i]); } } Question 9 Use switch statement,write a menu driven program to: (i) To find and display all the factors of a number input by the user (including 1 and excluding number itself.) Example : Sample Input : n=15. Sample Output : 1,3,5 (ii) To find and display the factorial of a number input by the user(the factorial of a nonnegative integer n ,denoted by n!,is the product of all integers less than or equal to n. Example : Sample Input : n=5 Sample Output : 120. For an incorrect choice ,an appropriate error message should be displayed. Ans : import java.util.*; class Ques9 { static void test(int n) { Scanner in = new Scanner(System.in); System.out.println("Enter 1 to find the factors of "+n); System.out.println("Enter 2 to find the factorial of "+n); int choice = in.nextInt(); switch(choice) { case 1 : System.out.println("Users choice is to find the factors of "+n); System.out.println("Factors are "); for(int i=1;i<n;i++) { if(n%i==0) System.out.print(i+" "); } break; case 2: System.out.println("Users choice is to find the factorial of "+n); int facto=1; for(int i = 1;i<=n;i++) facto=facto*i; System.out.println("Factorial of "+n+" is "+facto); break; default : System.out.println("Wrong Choice "); } } } ----------------------- o --------------------------------Work by Teja and Buncy ;) ;)

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

adithyarajgangarejishkumar chat