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

ICSE Computer Solved Paper 2019

Uploaded by

Ashwini Shirude
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
21 views

ICSE Computer Solved Paper 2019

Uploaded by

Ashwini Shirude
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
COMPUTER APPLICATIONS-2019 (THEORY) (Two Hours) “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. The time given at the head of this Paper is the time allowed for writing the answers. ‘This paper is divided into two Sections. Altempt 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) Attempt all questions Question 1. (a) Name any two basic principles of Object-oriented Programming. I Write a difference between unary and binary operator. gl (0 Name the keyword which : rey (G) indicates that a method has no return type. (i) makes the variable as a class variable, (b) (a) Write the memory capacity (storage size) of short and float data type in bytes. iy (e) Identify and name the following tokens : (2] (public Gi) a” (iti) == fv) 1) Answer 1. (a) Encapsulation and Abstraction. () ‘Unary Operator ‘Binary. Operator. 1. The operator |The operator that that acts on a single | acts on two operands operand is called alis called a binary unary operator. operator. Bu tr Egy tn / © @ void Gi) static short requires 16 bits or two(2) bytes of storage whereas float requires 32 bits or four(4) bytes of storage. . (i) public — Keyword. (ii) ‘a’ — Character Literal. @ © (iii) == — Operator. tiv) (| Separator. Question 2. (a) Differentiate between if else if and switch-case statements, Lay (b) Give the output of the following code : ay String P = "20", Q= "19"; int a = integer. parselnt(P); int b = Integer. valueOf(Q); ‘Systent.out.printin(a+”"+ b); (©) What are the various types of errors in Java? {2| State the data type and value of res after the following is executed al chiar cht = °9'; res = Character.isDigit(ch); What is the difference between the linear search and the binary search techniqite ? a ) Answer 2. (@) ifelse if 1. It can work with all relational operators. 2. It-can work with any data type. switch case Tt can only test for, equality. It can only work with} byte, short, char and int primitive data types. (b) 2019 (0) Compile time errors, Logical errors. Data type of res is boolean and it's value is enue. Linear Search. Binary Search _| . It can work with ' It can only work with both sorted and_ sorted arrays. unsorted arrays. | 2, It takes more num | It takes less number | parisons. | of comparisons Runtime errors and (a) (| Question 3. (a) Write a Java expression for the following ie) [x2 + 2xy] (b)_ Wirt she return datatype ofthe flowing fection (starts with) (i) randomt } (o) If the value of basic = 1500, what will be the value of tax after the following statement is executed 72) tax = basic > 1200 ? 200 : 100; Give the output of following code and mention hat many times the loop will execute ? a (a) int i; fort =5;i>=1;%—) t ifi%2 ==1) continue; Systent.out.print(i+*"); ond @ State a difference between call by value and call by "reference. fea) (Give the output of the following : el Math.sqri(Math.max(9, 16)) @ Write the output for the following : i String 81 = “phoenix”; String s2 = “island”; System out.printin(s1 substring(0).concat (s2.substring(2) ) ); ‘System.out.printli(s2.toUpperCaset)); (h)_ Evaluate the following expression if the value of x = 2, y=3andz=1 2) soetytt ty () String x1] = {“Artificial intelligence”, “Machine learning", “Big data”); Give the output of the following statements: [21 G) System.out.printin(al3)); Gi) System.out println(x.length); What is meant by a package ? Give an example. [2] Answer 3, @) Mathabs(x*x+2*x*y) "or", ) @ boolean Gi) double (9 200 id) 42 The loop will get executed 5 times. fe 2! Call By Value “Call By Reference. 1. In this, local copy | In this, no local copy of parameters are|of parameters are created and whatever | created therefore |changes are made| whatever changes inside the function | are made inside the get reflected in| function get reflected the local copies while | in the original copies. the original remains unaffected. 2, In this primitive | In this non-primitive data typesare passed. | data types are passed. © 40 ® phoenixland ISLAND hy 9 ® (Big Data Qa ()_ A package is a collection of inter-related classes and interfaces having common functionality. eg,, java.io, java.util, java.lang, etc. SECTION B (60 Marks) Aitempt 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. Question 4. Design a class name ShowRoont with tte following description = (15) Instance variables/Data inernbers : String name To store the name of the customer Jong mobno + To store the mobile umber of the customer double cost To store the cost of the items purchased. double dis To store the discount amount double amount To Store the amount to be paid after discount. Member methods : ShowRoom() — default constructor 10 initialize data members void input) — To input customer name, ‘mobile raumber, cost void calculatel) - To calculate discoust on the cost of purchased items, based on the following criteria : Cost -piscount fd a percentage)| Less than or equal to% 10,000 5% : More than % 10,000 and less) 10% than or equal to ® 20,000 _ More than % 20,000 and less] 15% than or equal to ® 39,000 More thant % 35,000 20% void display’) - To display customer name, mobile number, amount to be paid after discount. Write « main metitod to create an object of the class and call the above member methods. Answer 4. import java.util class ShowRoom { String name; long mnobno; double cost, dis, amount; public ShowRoom() { 1 name ‘mobno = OL; cost = 0.0; dis = 0.0; amount = 0.0; void input) { Scanner se = new Scanner(Systemin) System.out printin("Enter the details"); name = scnextLine(); mobno = sc-nextLong(); cost = senextDouble(); void caleulate(} { ) if(cost <= 10000) { dis = 0.05 * cost I else if(cost > 10000 && cost <= 20000) { dis = 0.10 * cost; } else if(cost > 20000 && cost <= 35000) { dis = 0.15 * cost; y else { dis = 0.20* cost; ) amount = cost ~ dis; void display) { System.out printin("Customer Name :" +name); System.outprintin("Customer Mobile Number : "+ mobno); System.cutprintin("Amount tobe Paid:" + amount); | public static void main(String args[]) ShowRoom ob = new ShowRoom(); their Unicode, Unicode Letters ob.input(); ob.calculate(); ob.display(); } Name | Type Description name | String | To store the name of | the customer mobno long | To store the mobile number of the customer. cost double | To store the cost of the item purchased dis | double | To store the discount {onthe item purchased. double | To store the final |_EEE amount tobe pate. | Using the switch-case statement, write a menw driven program to do the following : ns) (a) To generate and print Letters from A to Z and A 65 B 66 Zz 90 (looping) statement : 1 12 123 1234 12345 i (b) Display the following pattern using iteration Answer 5. import java.util“) class Menu nt ch i,j void display() Scanner sc = new Scanner(System.in); System out println("1. Letters"); System.outprintln("2. Patten’); ‘System.out-printin("Enter Your Choice"); ch= senextint(; switch(ch) ( case 1 : System.outprintin (‘Letters \t Unicode’); for(i = 65; i <= 90; i++) { System.outprintin ((chani + "Nt" +1); ) break; case 2 :for(i = { Bist) for(j=15j <= isj+4) t f for(j=0;}<14- (Aue adem t= Agl Aljl = Alj +1: A+ = J + ) fori= { i< 15;i++) System.out.printhn(A lil); System.out print ame as 4 All [Array to store 15 } numbers System.outprintinQ; ij int __| for loop variables. } t int ‘Temporary variable to break; store value to swap. default: System.outprintin Question 7. (‘Wrong Choice”); Design a class to overioad a function series( ) as follows : 5] (a) void seriestint x, int n) — To display the sum of the series given below = = Dee dartge "terms “Type Description. * i id serieaint wa Vo comthe choice ©) oid seriestintp)~ To spay the following ij int for loop variables. 0,7, 26, 63 pierms Question 6. (0) void series() — To display the sum of the series Write a program to input 15 integer elements in an goer ddlow : array and sort them in ascending order using the Stat bubble sort technique. 15 a ‘ Answer 7. Nero. class Overload importjava.util+; { class Bsort double s = 0; inti; int A[] = new int{15]; Void series(int x, int n) inti,j,& ( void display() for(i = ji <= ayiv4) { Scanner se = new Scanner(System.in); for(i = 0; i <15;i+4) { System out printin("Enter a number"); Ali] = sc.nextint(; t for(i = 0;1< 15;i+4) { =5 +Math.pow(x, i); } System.out printin("Sum of the series is" + s); 1 void series(int p) { for(i = 1;i<=p;i+4) i System.out print((i*i*i)—1+ ",")y ' } } Systemoutprintin(’Total number of d void series() words starting with letter A ="4 9), t ) for(i = 2; 1 <= 10; i++) } { s=s+10/i; Name. | ‘Types Description =| } 5 String | To store a sentence, System.out.printin(‘Sum of the I int | Tostore the length. series is" +5); i int | forloop variable. } c int _| Counter variable. } - Question 9. Enc Description A tech number has even number of digits. if te for loop variable. ee e ple in vo equal Iatoes then ihe ree sum alves is equal to the number itself To store the sum of Write a program to generate and print all four digit techmonbers. 5} xn, p int To store the terms of Example : - the series. Consider the number 3025 Question 8. Square of sum of the halves of 3025 Write a program to input a sentence and convert (30 + 25 it into uppercase and count and display the total (say number of words starting with a letter ‘A’. 15) 395 isa tec number. Example : A AND Answer 9. Sample Input DVANCEMENT hase Tech APPLICATION OF INFORMATION | * TECHNOLOGY ARE EVER CHANGING inteabs Sample Output : Total number of words starting void display with letter 'A’ = 4. Answer 8. fori = 1000; i <= 9999; i++) import java.util”; { class Count a=i1% 100; t string s; int, i,¢ void display() { Scanner sc = new Scanner(System.in); 1 System.out:printin("Enter a sentence"); } 5 =scmextLine); } } “Name “| -:: Type ‘Description. int | To store the last two for(i = 0;i< Liv) a Mgt t b t To store the first two! iff(echarAt@) == '" &ée s.charAt( +1) | digits. / =A) 8 int |Tostorethesum. | ! i int___|forloop variable. _| ott;

You might also like