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

Computer Applications MS - 2016

The document provides an analysis of pupil performance in the ICSE Class-10 Examination, highlighting strengths and weaknesses in student responses. It includes statistical data on student performance, examiners' comments, and suggestions for teachers to improve instructional methods. The analysis covers 14 subjects and aims to enhance the teaching-learning process by offering detailed feedback to educators and students alike.

Uploaded by

aryaanstudys777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Computer Applications MS - 2016

The document provides an analysis of pupil performance in the ICSE Class-10 Examination, highlighting strengths and weaknesses in student responses. It includes statistical data on student performance, examiners' comments, and suggestions for teachers to improve instructional methods. The analysis covers 14 subjects and aims to enhance the teaching-learning process by offering detailed feedback to educators and students alike.

Uploaded by

aryaanstudys777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

FOREWORD

This document of the Analysis of Pupil Performance at the ICSE (Class-10) Examination is a
unique tool for retrospection for both, teachers and students. It has grown and evolved over
the years to provide feedback to all concerned in terms of the strengths and weaknesses of the
candidates in handling the ICSE examinations.

We commend the work of Mrs. Shilpi Gupta and the team at the RDCD who have
painstakingly prepared this analysis. We are grateful to the examiners who have contributed
through their comments on the performance of the candidates under examination as well as
for their suggestions to teachers and students for the effective transaction of the syllabus.

We hope the schools will find this document useful in more ways than one. We invite
comments from schools on further improving its utility and quality.

Gerry Arathoon
November, 2016 Chief Executive & Secretary

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


The Council has been involved in the preparation of the ICSE and ISC Analysis of Pupil
Performance documents since the year 1994. Over these years, these documents have
facilitated the teaching-learning process by providing subject/ paper wise feedback to
teachers regarding performance of students at the ICSE and ISC examinations. With the aim
of ensuring wider accessibility to all stakeholders, from the year 2014, the ICSE and the ISC
documents have also been made available on the Council’s website.
The documents which comprise of one Volume for ICSE and three Volumes for
ISC (Languages, Commerce and Humanities) aim to provide a detailed quantitative and
qualitative analysis of the performance of candidates for various subjects, including the
overall performance of the candidates, examiners’ comments on common errors made by
candidates, topics found difficult or confusing, marking scheme for each question and
suggestions for teachers/ candidates.
It is hoped that while on one hand, feedback provided in this document will enable teachers
to understand the assessment/ evaluation process better and help them in guiding their
students more effectively and comprehensively, it will also help students in preparing for the
ICSE/ ISC Examinations, with a better understanding of what is required from them in the
examination.
The Analysis of Pupil Performance document for ICSE for the Examination Year 2016 covers
14 subjects/papers. The ISC Analysis of Pupil Performance document for the year 2016 covers
21 subjects/papers. On popular demand, the subject Business Studies has been added to the
list of subjects for which the analysis is done at the ISC level.
The RDCD team of Mr. Richard Ellis, Dr Manika Sharma and Ms. Mansi Guleria have done a
commendable job in preparing this document. I would also like to thank Mr. M R Felix of the
IT department for providing the statistical data.

Shilpi Gupta
November, 2016 Deputy Head - RDCD

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


COMPUTER APPLICATIONS

STATISTICS AT A GLANCE
Total Number of students who took the examination 99,856
Highest Marks Obtained 100
Lowest Marks Obtained 27
Mean Marks Obtained 83.28

Percentage of Candidates according to marks obtained


Mark Range
Details
0-20 21-40 41-60 61-80 81-100
Number of Candidates 0 45 9,459 29,331 61,021
Percentage of Candidates 0.00 0.05 9.47 29.37 61.11
Cumulative Number 0 45 9,504 38,835 99,856
Cumulative Percentage 0.00 0.05 9.52 38.89 100.00

Range of Marks Obtained

70.00 61.11

60.00
Percentage of Candidates

50.00

40.00 29.37

30.00

20.00 9.47
0.00 0.05
10.00

0.00
0-20 21-40 41-60 61-80 81-100

Marks Obtained

239

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


COMPUTER APPLICATIONS

ANALYSIS OF PERFORMANCE

Question 1.
(a) Define Encapsulation. [2]
(b) What are keywords? Give an example. [2]
(c) Name any two library packages. [2]
(d) Name the type of error ( syntax, runtime or logical error ) in each case given below: [2]
(i) Math.sqrt (36 – 45)
(ii) int a;b;c;
(e) If int x [ ] = { 4, 3 , 7, 8, 9, 10}; what are the values of p and q? [2]
(i) p = x.length
(ii) q= x[2] + x[5] * x[1]

Comments of Examiners
1. Suggestions for teachers
(a) A number of candidates answered correctly.
However, some candidates confused  Basic principles such as
Encapsulation with Data abstraction. Encapsulation, Polymorphism etc.
(b) Examples of keywords were written in capital should be explained properly with
letters. For example, This, New, Public …. etc. examples.
(c) Majority of candidates wrote the full word instead  Explain the importance of case
of the name of the package. For example, utility sensitivity while writing keywords.
was written instead of util.  Difference between class and
(d) Many candidates were confused between runtime package must be explained with
and logical errors and therefore wrote incorrect examples.
answers.  Explain different types of errors
(e) The first part was answered correctly by most with examples on the computer with
candidates. In the second part of the question clear cut differences.
some candidates were not clear about index  Calculation of length of an array and
position of the array and hence used wrong values retrieving an element from a given
for calculation of the answer. array should be practiced.

240

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


MARKING SCHEME
Question 1.
(a) The wrapping up of data and functions (that operate on the data) into a single unit( called class)
is known as encapsulation
OR
It is the way of combining both data and the functions that operate on that data under a single
unit.
(Correct definition in any form)

(b) Keywords are the words that convey a special meaning to the language Compiler. These are
reserved for special purpose and must not be used as normal identifiers.
(Correct explanation with an example)
(c) java.io.* or io package
java.util.* or util package
(Any 2 library packages)
(d) (i) Runtime error
(ii) Syntax error
(e) (i ) 6
(ii) 37

Question 2.

(a) State the difference between == operator and equals ( ) method . [2]
(b) What are the types of casting shown by the following examples: [2]
(i) char c = (char)120;
(ii) int x = 't';
(c) Differentiate between formal parameter and actual parameter. [2]
(d) Write a function prototype of the following : [2]
A function PosChar which takes a string argument and a character argument and returns
an integer value.
(e) Name any two types of access specifiers. [2]

241

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Comments of Examiners
2. Suggestions for teachers

(a) Most candidates answered correctly. However,  Give examples of the use of ==
some candidates confused == operator with operator and equals () method and
assignment operator. practice exercise questions based on
(b) Some candidates were unsure of the answer. They the above topics.
seem to have overlooked the mention of (char)120  Explain each type of conversion with
in the question and therefore interchanged the proper examples and point out the
answers. difference between them.
(c) A number of candidates were confused between  Explain the terms such as formal
formal parameters and actual parameters. parameters and actual parameters and
(d) Many candidates were unable to write the illustrate them with several examples
function prototype. Some did not use the same  Explain various parts of a function
variable name as mentioned in the question. with different examples. Make it
(e) Most candidates answered correctly. clear that the formal parameters
require data types and variable
names.
 Students should be reminded
constantly about the importance of
case sensitivity while writing
keywords.

MARKING SCHEME
Question 2.
(a) == is an operator which is used to check the equality between primitive data type
equals () function checks the equality between Strings
(b) (i) explicit type casting
(ii) implicit type casting
(c) Actual parameter : The parameter which is present in the function call statement is called
actual parameter. It stores the original value.
Formal parameter : The parameter which is present in function prototype or function
signature is called formal parameter. It stores the duplicate value.
(d) int PosChar( String s, char ch)

(e) public /private/protected (Any two)

242

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 3.
(a) Give the output of the following string functions : [2]
(i) "MISSISSIPPI".indexOf('S')+ "MISSISSIPPI".lastIndexOf('I')
(ii) "CABLE".compareTo("CADET")
(b) Give the output of the following Math functions : [2]
(i) Math.ceil(4.2)
(ii) Math.abs(-4)
(c) What is a parameterized constructor? [2]
(d) Write down java expression for : [2]
T = √𝑨𝑨𝟐𝟐 + 𝑩𝑩𝟐𝟐 + 𝑪𝑪𝟐𝟐

(e) Rewrite the following using ternary operator: [2]


if (x%2 == 0)
System.out.print("EVEN");
else
System.out.print("ODD");
(f) Convert the following while loop to the corresponding for loop: [2]
int m = 5, n = 10;
while (n>=1)
{
System.out.println(m*n);
n-- ;
}
(g) Write one difference between primitive data types and composite data types [2]
(h) Analyze the given program segment and answer the following questions: [2]
(i) Write the output of the program segment
(ii) How many times does the body of the loop gets executed?
for (int m=5; m<=20; m+=5)
{ if (m%3==0)
break;
else
if (m%5==0)
System.out.println(m);
continue;
}
(i) Give the output of the following expression : [2]
a+= a++ + ++a + --a + a-- ; when a = 7
(j) Write the return type of the following library functions: [2]
(i) isLetterOrDigit(char)
(ii) replace(char, char)

243

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Comments of Examiners
3. Suggestions for teachers
(a) A few candidates answered both parts correctly.  String functions should be taught
However, some candidates lacked the knowledge using examples. Practice questions on
of String functions especially compare to () multiple String functions must be
function. given in class regularly.
(b) In the first part of the question some candidates  Practice exercises on evaluation of the
got confused regarding the output of the Math multiple and single mathematical
function ceil () However, majority of candidates functions must be given.
answered the second part of the question  Explain what is constructor, its need
correctly. in the program. Then explain the basic
(c) Many candidates had defined what is constructor difference between default and
instead of parametrized constructor. parametrized constructors.
(d) Mathematical functions are so often used in Java  Math class, its functions and syntax
but many candidates were unfamiliar with the must be taught in detail.
syntax. Some of the errors made in this question  Ternary operator, if…else statement
were: with different examples and
T= math. sqrt(math.pow (A,2)+(B,2)+(C,2)); conversion from ternary operator to
T=Math.sqr(Math.pow(A+B+C),2); if…else and vice versa must be taught
(e) A number of candidates were unfamiliar with the clearly.
working of a ternary operator. Some of the errors  Sufficient examples of inter
made in this question are: conversion between while loop and
If (x%2==0) ? EVEN: ODD; for loop and vice versa must be
(x% 2= 0) ? “EVEN”: “ODD”; worked out on the board.
 Explain all technical terms,
(f) Several candidates were confused with multiple differences between them and ensure
initialization in the question and some forgot to that students understand them
update the control variable. thoroughly.
(g) Majority of candidates were able to answer this  Provide more practice questions on
question correctly. First part was well answered iterative processes where students
by most candidates where as in the second part have to predict the output especially
some candidates got confused as to how many using output statements.
times body of the loop gets executed.  Order of evaluation of expression
(h) using arithmetic, assignment
(i) A number of candidates did not add the initial operators and increment and
value of the variable ‘a’ to the resulting value of decrement operators must be clearly
the expression. They were not aware that in an explained in class along with
expression of type a+= , the variable gets its examples.
initial value .  Emphasize on the return type of all the
(j) Many candidates answered the first part of the string functions given in the syllabus.
question correctly, whereas majority of
candidates wrote char as the answer instead of
String in the second part of the question.

244

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


MARKING SCHEME
Question 3.
(a) (i) 2 +10 = 12
(ii) - 2

(b) (i) 5.0


(ii) 4
(c) Constructors that take arguments are called parameterized constructors

(d) Math.sqrt(Math.pow(A,2)+ Math.pow( B,2)+ Math.pow(C,2))


OR
Math.sqrt((A*A+B*B+C*C))

(e) System.out.println((x%2==0)?"EVEN":"ODD");

(f) for ( int m = 5 , n = 10; n > = 1; n-- )


{
System.out.println ( m * n ) ;
}
(g) Primitive data types Composite data types
1. fundamental data types. Constructed using primitive data types
2. Size is fixed Size depends on the member variables/instance
Variables
3. Primitive data type is passed by value Composite data type is passed by reference.
(h) m=5
10 Loop is executed 3 times
(i) a = 7 + 7 + 9 + 8 + 8 = 39

(j) boolean and String

245

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


SECTION B (60 Marks)
Attempt any four questions from this Section.
Question 4. [15]
Define a class named BookFair with the following description :
Instance variables /Data members :
String Bname - stores the name of the book
double price - stores the price of the book
Member methods :
(i) BookFair() - Default constructor to initialize data members
(ii) void Input() - To input and store the name and the price of the book.
(iii) void calculate() - To calculate the price after discount. Discount is calculated
based on the following criteria
Price Discount
Less than or equal to `1000 2% of price
More than ` 1000 and less than or equal to ` 3000 10% of price
More than ` 3000 15% of price
(iv) void display() - To display the name and price of the book after discount.
Write a main method to create an object of the class and call the above member methods.

Comments of Examiners
4. Many candidates answered this question Suggestions for teachers
correctly. Some common errors found were:  Train students to use the same names
(i) Using a different class name than the one given for variables and methods as given in
in the question. the question.
(ii) constructor syntax was incorrect (return type  Constructor syntax to be explained
void was used, variables were declared inside comprehensively with additional
revision and practice on writing
the constructor). constructors.
(iii) A single function was used instead of the one  Programs on multiple functions of all
asked for in the question. types to be revised on a consistent
(iv) Price after discount was not calculated. basis.
(v) Use of ≤ and ≥ instead of the operators < = and  Guide and instruct students to
>= , using commas in numbers convert English statements having
(vi) Some candidates wrote input method with conditions with ranges to JAVA
if…else statements using proper
parameters but got confused with the local and relational operators.
global variables.  Advise students, in school exams
(vii) Syntax for object creation and function call against using ≤ and ≥ instead of < =
were incorrect. and >=.
 Difference between global and local
variables and how to use them in
multiple function programs should be
explained clearly in class.
 Creation of an object and invoking
methods using the object need to be
practiced thoroughly.

246

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


MARKING SCHEME
Question 4.
import java.util.*;
class BookFair {
String Bname;
double price;
BookFair() {
Bname="";
price =0.0d; }
void input() {
Scanner sc=new Scanner(System.in);
System.out.println("Enter Name and Price " );
Bname=sc.next();
price=sc.nextDouble(); }
void calculate() {
if(price<=1000)
price= price-price*2/100;
else if(price<=3000)
price =price-price*10/100;
else
price =price-price*15/100; }
void display() {
System.out.println("Name :" +Bname);
System.out.println("Price :" +price); }
public static void main(String args[])
{
BookFair obj=new BookFair();
obj.input();
obj. calculate();
obj.display();
}}
Variable description/Mnemonic codes

247

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 5.
Using the switch statement , write a menu driven program for the following: [15]
(i) To print the Floyd’s triangle [Given below]
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
(ii) To display the following pattern
I
IC
ICS
I CSE
For an incorrect option, an appropriate error message should be displayed.

Comments of Examiners
5. Common errors made by candidates while Suggestions for teachers
attempting this question were:
(i) Menu not displayed or choice not input.  Menu driven programs using switch
(ii) Wrote two separate programs instead of one. …case should be practiced in class.
(iii) Syntax of switch and default statements were  The significance of break and default
wrong. statements should be explained.
(iv) Forgot to write break statement.  Adequate examples and exercise
(v) Using println() in place of print() and vice versa. questions based on loop concept and
(vi) The patterns were obtained with multiple print nested loop must be given in class.
statements row after row.  Method of extracting character
should be explained to candidates.
Other mistakes observed were:
(i) Candidates printed the loop variable instead of
using a counter and using it for printing the output.
(ii) Candidates did not know how to extract a letter from a string.

248

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


MARKING SCHEME
Question 5.
import java .util.*;
class ques5 {
public static void main(String args[]) {
Scanner obj = new Scanner (System.in);
int choice,x; System.out.println("Enter 1 pattern1 , 2 Pattern2");
choice =obj.nextInt();
switch(choice) {
case 1: int r, c, k = 1;
for (r = 1; r <= 5 ; r ++) {
for (c=1;c<=r;c++) {
System.out.print(“ “+k);
k++; }
System.out.println(); }
break;
case 2:
String s="ÏCSE";
for(int i=0;i<s.length();i++ ) {
System.out.println(s.substring(0,i+1)); }
break;
default : System.out.println("Sorry wrong choice");
}
}
}
Variable description/Mnemonic codes

249

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 6.
Special words are those words which starts and ends with the same letter. [15]
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and vice-versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes.
Write a program to accept a word check and print whether the word is a palindrome or only
special word.

Comments of Examiners
Suggestions for teachers
6. Most candidates assigned a value given in the
example instead of accepting it from the user. Other  Advise students to read the question
mistakes were: carefully.
(i) Initial and final values of the loop were wrong.  Index value of the string starts from
(ii) Instead of applying proper logic to reverse a zero is an important point that must
word the library function reverse (). be explained with examples.
(iii) Extraction of the first and the last character of the  All commonly used functions must
string was incorrect. be taught using examples.
(iv) Candidates wrote the program for a palindrome  The difference between String
number. reverse and number reverse must be
taught.

250

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


MARKING SCHEME
Question 6.
import java .util.*;
class ques6
{
public static void main (String s[])//throws IOException
{
Scanner obj = new Scanner(System.in);
System.out.println(" enter a word ");
String word = obj.nextLine();
String rword="";
int l,x;
l= word.length();
for(x=l-1;x>=0;x--)
rword = rword+ word.charAt(x);
if(word.equals(rword))
System.out.println( word +" is palindrome");
else
if(word.charAt(0) == word.charAt(l-1))
System.out.println( word +"is a special word");
}
}
Variable description/Mnemonic codes

Question 7.

Design a class to overload a function SumSeries() as follows : [15]


(i) void SumSeries(int n, double x) – with one integer argument and one double argument
to find and display the sum of the series given below :
𝑥𝑥 𝑥𝑥 𝑥𝑥 𝑥𝑥 𝑥𝑥
s = − + − + … … … to n terms
1 2 3 4 5
(ii) void SumSeries() – To find and display the sum of the following series :
s = 1 + (1 × 2) + (1 × 2 × 3)+. … … … + (1 × 2 × 3 × 4 … … … … … × 20)

251

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Comments of Examiners
7. Most candidates answered this question correctly,
however a few common mistakes were observed: Suggestions for teachers
(i) Function overloading concept was not followed  Function overloading concept should
instead, two separate programs were written. be taught clearly.
(ii) Use double instead of void as return type of the  Use of double data type and its
function. initialization must be taught
(iii) Candidates accepted the values from the user  Program on function overloading
with in the function instead of accepting them as covering all logics must be done in
parameters. class.
(iv) Declaration and initialization of variable ‘s’
which is used to accumulate the value of the
series was not done properly.
(v) In the first part of the question, extraction and accumulation of negative and positive terms was
not done properly. In the second part of the question finding the factorial and accumulation of it
was also not done properly.

MARKING SCHEME
Question 7.
import java.util.*;
class Q7 {
void SumSeries(int n, double x) {
double sum=0.0d;
int i;
for(i=1;i<=n;i++)
{ if (i%2==0 )
sum=sum-x/(double)i;
else
sum=sum+x/(double)i; }
System.out.println("sum="+sum); }
void SumSeries() {
int s=0, p=1;
for(int i=1;i<=20;i++) {
p=p*i;
s=s+p; }
System.out.println("sum="+s); }
public static void main(String args[]) {
Q7 obj=new Q7();
obj.SumSeries(5,2.0);
obj.SumSeries();
}}}

252

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 8.
Write a program to accept a number and check and display whether it is a Niven number or [15]
not. (Niven number is that number which is divisible by its sum of digits).
Example :
Consider the number 126.
Sum of its digits is 1+2+6 = 9 and 126 is divisible by 9.

Comments of Examiners
8. Most of the candidates answered this question
Suggestions for teachers
correctly. However, few common mistakes were
observed:  Instruct students to read the question
(i) Duplicate value of the accepted number was not carefully.
done by most of the candidates.  The program should be done
(ii) Extraction of digits was not done in a proper way. carefully and importance of having a
(iii) Loop control variable was not updated (num = duplicate copy of a number should be
num/10) explained to the students.
(iv) Variable sum to add all digits of the number was  Guide students to extract digits from
not initialized. numbers with examples.
(v) Candidates checked whether the sum is divisible  Difference between / and % should
by num, instead of checking whether num is be explained clearly.
divisible by sum.

MARKING SCHEME
Question 8.
import java.util.*;
class Niven
{ public static void main(String args[]) {
Scanner sc =new Scanner(System.in);
System.out.println("enter number");
int num=sc.nextInt( );
int n=num;
int rem;
int sum=0;
while(num>0)
{ rem=num%10;
sum=sum+rem;
num=num/10; }
if(n%sum==0)
System.out.println("Niven number");
else
System.out.println("not Niven Number");
} }

253

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 9.
Write a program to initialize the seven Wonders of the World along with their locations in [15]
two different arrays. Search for a name of the country input by the user. If found, display the
name of the country along with its Wonder, otherwise display “Sorry Not Found!”.
Seven wonders - CHICHEN ITZA, CHRIST THE REDEEMER, TAJMAHAL, GREAT
WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations - MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example - Country Name : INDIA Output : INDIA - TAJMAHAL
Country Name : USA Output : Sorry Not Found!

Comments of Examiners
9. Common errors found were: Suggestions for teachers
(i) Syntax error in declaring and initializing of
arrays.  Solve number of problems on arrays
(ii) Double quotes were not used for any string having various data types.
values.  Syntax for creation of an array as
(iii) Country name to be searched was not accepted well assigning values and accepting
from the user. input values in an array need to be
(iv) Incorrect limits of loop practiced with different examples.
For (int i=1; i<=7;i++)
(v) outputting of messages were incorrectly placed.

254

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


MARKING SCHEME
Question 9.

import java.util.*;
class wonders
{
public static void main(String args[])

{
String w[]={"CHICHEN ITZA","CHRIST THE REDEEMER", "TAJMAHAL", "GREATWALL
OF CHINA","MACHU PICCHU","PETRA","COLOSSEUM"};
String l[]={"MEXICO","BRAZIL","INDIA","CHINA","PERU","JORDAN","ITALY"};
String s;int i,len;
Scanner br=new Scanner(System.in);
System.out.println("Enter the name of the country to be searched for " );
s=br.nextLine();
len=w.length; // OR len = l.length;
boolean flag=false;
for (i=0;i<len;i++) // OR for( i=0;i<7;i++)
{
if(s.equalsIgnoreCase(l[i]))
{
System.out.println(l[i]+" - "+ w[i]);
flag =true; break;
}
}
if(flag== false)

System.out.println("Sorry Not Found");


}
}

OR

class Wonders
{
String w[]={"CHICHEN ITZA", "CHRIST THE REDEEMER", "TAJMAHAL", "GREATWALL
OF CHINA", "MACHU PICCHU", "PETRA", "COLOSSEUM"};
String L[]={"MEXICO","BRAZIL","INDIA","CHINA" ,"PERU","JORDAN","ITALY"};
String s;
Wonders(String x)
{
s = x;
}
public void search ( )
{

255

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


int i,l = w.length ; //or L.length;
for ( i =0;i<l;i++)
{
if (s.equalsIgnoreCase(L[i]))
{
System.out.println(L[i] + " - " +w[i]);
System.exit(0);
}
}
System.out.println("Sorry Not Found");
}
}

256

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Topics /Concepts found difficult
- Conversion of if() to ternary operator
- Parametrized constructor
- Typecasting
- Finding, how many number of times body of the loop gets executed
- Types of errors
- Nested loop
- String functions
- Series Programs
- Function overloading

Suggestions for Students: -

- Attempt all questions in Section A


- Read the question carefully before answering.
- Practice programs on the Computer.
- A good variable description containing a list of important variables used in the program along with
their data types and purpose must be given at the end of every program.
- Project work should be done independently to reinforce all concepts
- Do not write meaningless words like SOP, SOPLN, PSVM etc. for System.out.print,
System.out.println, public static void main

257

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC

You might also like