0% found this document useful (0 votes)
32 views15 pages

Class 10 Computer Specimen

FRANK Computer Specimen Paper

Uploaded by

debjitdutta556
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
32 views15 pages

Class 10 Computer Specimen

FRANK Computer Specimen Paper

Uploaded by

debjitdutta556
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
QUESTION 1. Choose the correct answer and write the correct option. @ Ans: (ii) (iii) Ans: (iv) (v) Ans: Specimen Paper (Solved) SECTION A (40 Marks) Attempt all questions. Wrapping up of data and methods together as one unit is termed as: (@) Inheritance () Polymorphism (©) Encapsulation (@) Abstraction (c) Encapsulation The datatype which is specified that the method does not return a value is: (@ Void (b) void (©) VOID (@) boolean (b) void The logical operator which is an unary operator: (a) && @ 11 ©! @ >> ()! The Scanner class is a class. (@) Primitive (b) Derived (©) Wrapper (@) super class (c) Wrapper Math.pow(625, 2) + Math.sqrt(144) (a) 17.0 (b) 13.0 (©) 37.0 @ 13 edi (Working: 1.0+12.0=13.0] Ans: a) Ans: (viii) (ix) Ans: (x) statement printinin%2 return fe iftn® return else return “false”: ifn System.out.printin(“true”); else System.out.printin(*false”); ifin® return false; else return false: ifin%2==0) System.out.printIn(“true”); else System.out.println(“false”); ICSE Computer Applications Papers 1” the following ternary operation statement is: true” :*false”); Multiple branching statement of java is: (a) oo 7) (ad @ For while do...while switch switch The number of bytes occupied by the constant 45 are: (a) o a) (d) (a) do.. (@) o o (d) ©) fortk=1;k: four bytes two bytes eight bytes one byte one byte while loop is an entry controlled loop infinite loop exit controlled loop finite loop exit controlled loop fone byte stores whole numbers from -128 to 127] im Model Test Papers ———— Ans: (xi) Ans: (xii) Ans: (xiii) (xiv) Ans: (xv) f for(m=lim<=4;m++) t System.out.printIn(m*2); ! ! How many times the inner loop is executed? (a) 4 times (b) 8 times (c) 2 times (d) 16 times (b) 8 times A method with the same name as of the class and with arguments and no return data type is termed as: (a) parameterised constructor (b) default constructor (c)_ non-parameterized constructor (d) wrapper class method (a) parameterised constructor int ; What is the value of res? @) ) (o) @ (c) 65 The style of expressing single line comment is: (a) /* comment */ (b) * comment (©) comment (d) /* comment (c) //comment The method to check if a character is an alphabet or not is: (a) isLetter(char) (b) isAlpha(char) (c) isUppercase(char) (d) isLowerCase(char) (a) isLetter(char) The output of Double.parseDouble(“71.25") + 0.75 is: (a) 72 (b) 72.0 (ce) 71.0 (d) 71.75 172 ICSE Computer Applications Papers Ans: (b) 72.0 171.25 + 0.76 =72.0) (xi) The method to convert a string to upper case is: (a) toUpperCase(char) (b) toUPPERCASE(String) () toUpperCase(String) (d) touppercase(String) Ans: (c) toUpperCase(String) (xvit) The output of the method “DETERMINATION” substring(2,6) is (a) “TERM” (b) term () “Term” (d) “TERMi” Ans: (a) TERM (xviii) The array int x/10] occupies. (a) 10 bytes (b) 40 bytes (c) 20 bytes (d) 80 bytes Ans: (b) 40 bytes 110 x 4 bytes(int) = 40 bytes] (xix) The element in x(4] of the array (3,5,7,12,16,18,20,35,42,89) is: (a) 16 (b) 12 (co) 7 (d) 18 Ans: (a) 16 (xx) Name the type of error that occurs for the following statement: ‘System.out.println(Math.sqrt(24-25)); (a) Syntax error (b) run time error fe) logical error (d) no error Ans: (d) no error [Output; NaN”. which is not an error. NaN stands for ‘not a number". “Nan” is produced if @ floating-point operation has some input parameters that cause the operation to produce some undefined result.) (2) (i) Evaluate the expression: Z taav+ + -- b+ tta + “dF Model Test Papers 173 ee Ans: Ans: (iv) Ans: (w) Ans: Z=10 +10 +44 12 43; =39 Write java expression for |x? +xy\. Math.abs((Math, pow(x,2)+x*y)); Rewrite the following using ternary operators: iflx>y) (2) [2] c= else ca’; c=(x>y)MA'a"; Rewrite the following while loop using for loop. [2] int x=5; while(x<=5) f xtty I ‘System.out println(x); int x; for (x=5; x<=5; x++) System.out.printIn(x); How many times the following loop will gets executed? What is the output of the same? 2 int counter = do f ‘System.out.printin(counter); Jwhile( counter++<5); Working Counter | ExecutionCount | Output 1 a | 1 2 2 2 3 3 see 4 4 4 | eed ceed ‘The loop will get executed for 5 times. 174 Output (vi Ans: ett Ans: viii ixy Ans: (b) (xo Ans: 1 3 4 “MISSISSIPPI” replacet’S, ‘t).toLowerCase() @] mittittippi “REDUCE” compareTo(“REVOLT")+"ANTARTICA’ lastIndexOf"'’) 2) 10 (Working: -18 + 8-10] Define boxing with example. 2) Automatic conversion of primitive types (int) to their corresponding object wrapper class (Integer) is known as boxing. Consider the following program and answer the questions given below: 2] class sample int a, sample (int x, int y) a=x; void calculate () int 2; z=a+b; System.out.printin(z); (a) Name the global variables. (b) What are the method variables? (aba &b xy &z Consider the following array and answer the questions given below: pI int x{ ] = (23,45,67,12,45,89,24,12,9,7) (a) What is the size of the array? (b) What is the position of 89? (a) Size of the array is 10 (b) 5 Model Test Papers 175 SECTION B (60 Marks) Attempt any four questions from this section. 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 Description/Mnemonic Codes such that the logic of the program is clearly depicted. Flowcharts and Algorithms are not required. GeesTion se Ans: Define a class with the following specifications: 15) Class name Member variables employee : eno ~ employee number ename ~ name of the employee age — age of the employee basic — basic salary net - net salary (Declare the variables using appropriate data types Member methods void accept() void calculate() void print() void main() import java.util class employee ce int eno, ager String ename; double basic,net: void accept () { : accept the details using scanner class : to calculate the net salary as per the given specifications: net=basic + hra + da — pf hra= 18.5% of basic daz 17.45% of basic pé= 8.10% of basic if the age of the employee is above 50 he/she gets an additional allowance of 5000. : to print the details as per the following format eno ename age basic _—net. : to create an object of the class and invoke the methods. Scanner sc=new Scanner (System. in); system.out.print ("Input employee number\n”) ; eno=sc.nextInt (); sc.nextLine(); O\t\t"+"ename\t\t"+"age\t\t"+"basic\t\ n(eno+"\t\t"rename+"\t"tage+"\t\t"+basict”\ Variable Description Data Type | Description int __|Tostore employee number int fo store employee age _ "String [To store employee name double __| To store basic salary double To store net salary Define a class to overload the method print as follows: (15) void print() boolean print(int n) void print (int a, char ch) import java.uti class overload { void print () int i,j, k=l; for ( : to print the format 1 23 456 78910 : to check whether the number is a Dudeney number. A number is dudeney if the cube of the sum of the digits is equal to the number itself. Eg: 512=(5+1+2) = (8°=512 : if ch= s or S print the square of the number else if ch=e or C print cube of the number. void print (int n) int temp=n,d, su while (temp!=0) 178 ICSE Computer Applications Papers if((int) Math. pow (sum, 3 n) -Print1n ("Number is a Dudeney number"); +printin(*Number is not a Dudeney number”); println("Square of the number: tata); ntin ("Cube of the number:"ta*ata); system.out .printIn ("Incorrect character input”); Variable Description Data Type Description i int To run the loop S| into run the loop x | int | To store value for printing pattern | a | int | Tostore digitcfthenumber SSS n int | Tostorean integer value ==~=~S*~*~S~S~«~* I temp | __ int | Tostore copy ofan integer value SSCS [4 caine fromthe number SSS~*Y (Epeteeeet ree cairo ‘To store digits sum cube | ch char |Tostore choice value rere Pets Model Test Papers 179 QUESTION 5A A@oai_ i Define a class to accept 10 integers and arrange them in descending order using bubble sort. Print the original array and the sorted array. (5) Ans: class bubbleSort ( public static void main(String args{]) ( Scanner s csnew Scanner (System. in); int ar[] ew int (10],i,j,temps system.out.print1n( for (i=0;1<107i++) ( put any 10 integers”); ar[iJ=sc.nextint ()7 ) System.out.printIn("The Original Array”); for (i=0;1<10;i++) { system. out.printla(ar[il); ) for (i=0;i<97it+) { for (j=0. { is j++) if(ar(j]

You might also like