0% found this document useful (0 votes)
64 views

Class 10 Computer Solved 1-3

FRANK Computer Solved 1-3

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)
64 views

Class 10 Computer Solved 1-3

FRANK Computer Solved 1-3

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/ 45
Model Test Paper (Solved) SECTION A (40 Marks) Attempt all questions. QUESTION 1. Choose the correct answer and write the correct option. (20) (i) The small individual unit used in java program having some meaning to its language compiler is termed as. (a) Operators (6) Keywords (©) Identifiers (d) All the above Ans: (d) All the above [Note: Smallest individual unit used in java program is known as token. Ex: Operators, Keywords, Identifiers etc.] (ii) Java Interpreter which converts java byte code to Machine code is known as: (@ Library Class () JVL (c) JVM (d) API Ans: (c) JVM (iii) ______ is an assignment operator. (a) = ) (o) I= (d) All the above Ans: (b) INote: are the relational operators.) (iv) Math.cbrt(64.00) results to. (@) 8 () 2 () 32Model Test Papers 185 (a4 Ans: (d) 4 fo) Number of bytes occupied by char chl] with size 10. fa) 20 (b) 30 (co) 40 (d) 50 Ans: (a) 20 [Note: char occupies 2 bytes in memory hence, 2 *10 = 20) (vi) A method with same name as of its class name is termed as (a) Method overloading (6) Parameterised method (©) Constructor (d) Package Ans: (b) Constructor (vii) When a primitive data type is converted to the corresponding object of its class, it is termed as: (a) Boxing (b) Explicit type conversion (©) Unboxing (d) Implicit type conversion Ans: (a) Boxing [Note: Explicit Type Conversion: Converting a higher data type into lower type forcefully by the user is known as Explicit conversion or type casting. Unboxing: Converting an object of a Wrapper class (Integer) to its corresponding primitive typelint) is known as Unboxing] Implicit Type Conversion: The conversion in which the lower data type gets converted to higher data type. Data type without any intervention by the user is known as Implicit Type Conversion.] (viii) To find length of the array. (a) size (b) concate fo) length (d) length Ans: (d) length (ix) Parameters used at function definition: (a) Actual Parameters (6) Formal Parameters (c) Default parameters (d) None the above Ans: (b) Formal Parameters186 ICSE Computer Applications Papers [Note: Actual Parameters - Parameters used at function call side. Deafault parameters - No parameters used within the function (x) If a=10, result of a*= a++ - +4b 4a; ja) 18 (b) 0 ic) 180 (d) 12 Ans: ‘c) 180 [Working: a=10*(10 - 3 + 11), a= 10*18, a=180] xi) Method to convert String to lowercase is ‘a) TolowerCase() (b) toLowerCase() (ec) tolowert) (d) tolowercase() Ans: (b) toLowerCase() (xii) The element in a[3+1] of the array (1,3,5,7,9,11,13) is: @ 7 (b) i} (dd) Ans: (c) 9 (ziti) The output of the method “COMPUTER APPLICATION" substring(0,11) is: (a) COMPUTER APPL (») COMPUTER AP (c) COMPUTER APP (d) COMPUTER A Ans: (b) COMPUTER AP (xiv) The corresponding wrapper class of the int data type is: Koos (a) Integer (b) INTEGER (c) Int d) int Ans: (2) Integer (av) Number of bits occupied by double type variable (a) 8 (b) 16 (e) 32 (d) 64 Ans: (4) 64 INote: 1 byte = 8 bits hence, double data type holds 8 bytes=8 x & bits=64 bits)Model Test Papers 187 ee (xvi) class A f int a=5; public void disp() t ! } Identify the scope of the variable a. (a) Instance variable (b) Class Variable (c) Local Variable (d) None of the above Ans: (a) Instance variable (xvii) The return type of the library function compareTo() is: (a) boolean (6) int (c) char (d) string Ans: (b) int (xviii) for(; iitem) usm-1; £(f System.out rint1n (“Search Successful"); out.printin ("Number is not present”); tem.out. rModel Test Papers Variable Description Variable Name | Data Type | Description nf) int to store 10 integers item int to store the value to search i int to run the loop 1 int to store the lowest index position u int to store the upper index position m int to store middle index position f int to store the flag value, i.e. 0 for false and 1 for true Write a program to input a sentence and display the toggled sentence. Input: WelCome to School Output: wELcOME TO sCHOOL (15) Ans, import java.util.* class toggleSentence { public static void main(String args[]) Scanner sc=new Scanner (System. in) i String s,sl=""7 char chi int i; System.out.println ("Enter any sentence”); s=sc.nextLine(); for (i=0;i5éed154sdmax)Model Test Papers — _—_c rre_er'seorerereeeeeerr max=ar (i); if (ar[i]80000) allow(i]=basic[i]*0.30; else if(basic[i]>50000 && basic[i]30000 4% basic{i]1800?500:300; System. out.printin(s)+ Ans. (i) 300 (i) 500 (vii) What is the function of the new operator? 2) ‘Ans. The new operator is used to create an object of a class and associate the object with a reference variable that names it, eg., ew Kps(); //a new object of class Kps is created and the reference variable ob is associated with it. (viii) What is a Wrapper class? Give an example. 7 ‘Ans. Java's primitive data types are data values and not class objects. Wrapper classes convert primitive data types as objects. We can create an object of byte type from its wrapper class as follows: (5);//a Byte object created having value 5.Model Test Papers 29 tix) Differentiate between equala() and compareTo () methods. fa) equala) compare Tot) () It checks the equality between 7) It also checks the other relations two strings. between two strings. (2)_Tt returns boolean type of value, (ii) It returns integer type of value. (x) What is a default constructor? fay Ans, A default constructor is a constructor which does not have any parameters but initialises the instance variables with default values. It is automatically executed at run time. 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. Write a program to enter any sentence and display the frequency of each character. U5) Ans. import java.util. class charFreq { public static void main(String args(]) { Scanner sc=new Scanner (System. in); string si int 1,i,c=1/37 system.out printIn("Enter any sentence :"); s=sc.nextLine()i slengthQ)s char ch [J=new char[1],t7 pislsitt) ch[i]=s-charAt (1)ive) if(ch{j}>ch{541]) { tech{jle eh(3)=ch(5+11 chij+1]=te } ) for (i=0;imax) max=ar lil; system.out ntin ("The largest ime number: ”+max) 7 ntln("The lowest number: ”+min);Model Test Papers Variable Description Variable Name Data Type Description Bebe ar{} int An array to store integers n ‘To store size of the array max ‘To store maximum element in the array min ‘To store minimum element in the array c ‘To count the factors ‘To know the logic state(1-true,0-false] Write a program to input marked price of a product from the user and calculate and display the discount amount and the amount after discount paid by the user, where discount is calculated based on the given conditions. (15) Marked Price (in @) Discount % Up to 5000 4% 5001-10000 8% 10001-20000 10% Above 20000 12% Ans: import java.util.*; class markedPrice { public static void main(String args{]) ‘ Scanner sc=new Scanner (System.in); double mp, d=0.0; system.out .printIn(“Enter marked price of a product"); mp=sc.nextDouble () if (mp

You might also like