6. Computer Applications (1)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

November 2023

____________________________________________________________________________________________

© Copyright, Council for the Indian School Certificate Examinations


All rights reserved. The copyright to this publication and any part thereof solely vests in the Council for the Indian
School Certificate Examinations. This publication and no part thereof may be reproduced, transmitted, distributed or
stored in any manner whatsoever, without the prior written approval of the Council for the Indian School Certificate
Examinations.
Council for the Indian School Certificate Examinations (CISCE)

MISSION STATEMENT

The Council for the Indian School Certificate


Examinations is committed to serving the nation's
children, through high quality educational
endeavours, empowering them to contribute towards
a humane, just and pluralistic society, promoting
introspective living, by creating exciting learning
opportunities, with a commitment to excellence.

ETHOS OF CISCE

Trust and fair play.


Minimum monitoring.
Allowing schools to evolve their own niche.
Catering to the needs of the children.
Giving freedom to experiment with new ideas
and practices.
Diversity and plurality - the basic strength for
evolution of ideas.
Schools to motivate pupils towards the
cultivation of:
Excellence - The Indian and Global
experience.
Values - Spiritual and cultural - to be the bedrock
of the educational experience.
Schools to have an 'Indian Ethos', strong roots in
the national psyche and be sensitive to national
aspirations.
FOREWORD

The Analysis of Pupils’ Performance document for ICSE (Class X) and ISC (Class XII) Examinations
stands out as a unique and indispensable resource. Over the years, it has evolved to become a valuable
tool for schools, shedding light on both the strengths and challenges faced by candidates as they
navigate these Examinations.
We would like to extend our heartfelt appreciation to the Research Development and Consultancy
Division (RDCD) of the CISCE for their painstaking efforts in creating this analysis. Furthermore,
our gratitude goes out to the examiners who have generously provided feedback on candidates’
performance during the examinations, along with suggestions for teachers and students to enhance
their curriculum.
We hope that the schools find this document to be of value. We also invite schools to share their
sincere thoughts on its utility and quality.

Sangeeta Bhatia
November 2023 Deputy Secretary

i
PREFACE

The Analysis of Pupil Performance documents have been prepared by the CISCE since the year 1994,
with the objective to facilitate 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 been made available on the CISCE website www.cisce.org. These documents are
being released after a two-year gap, understandably caused by the challenges in conducting
examinations during the pandemic.
The documents for the ICSE and ISC Examination Year 2023 include a detailed qualitative analysis
of the performance of students in various subjects. The Analysis of Pupil Performance document for
ICSE for the Examination Year 2023 covers the following subjects - English Language, Literature in
English, History and Civics, Geography, Mathematics, and Computer Applications.
The subjects covered in the ISC Analysis of Pupil Performance document for the Year 2023 are
English Language, Literature in English, Mathematics, History, Accounts, and Physics.
The relevance of this question-by-question analysis lies in the valuable insights into the performance
of candidates on each question in the subject paper. The Comments of Examiners section is based on
inputs provided by examiners from examination centers across the country. It comprises of question
wise feedback on the performance of candidates in the form of the common errors made by
candidates. The Suggestions for Teachers section along with, provides pedagogical interventions that
teachers can utilize to rectify/ reduce these errors. The criteria used for marking each question has
been provided for both teachers and students to understand in the Marking Scheme section. Certain
topics in the question paper that were found to be challenging or confusing for the majority of the
candidates have been listed, along with general recommendations for candidates to prepare for the
subject paper to perform better in the examination.
I humbly acknowledge and appreciate the pivotal contributions of all the ICSE and the ISC examiners
who have enriched the document with their valuable insights on each question.
My gratitude and best wishes to the RDCD team of Dr. Manika Sharma, Ms. Parul Kohli and
Ms. Mansi Guleria, who have worked tirelessly towards the meticulous preparation and timely release
of this document.
We are sanguine that this document will empower teachers to support their students towards
efficacious preparation for the upcoming ICSE/ ISC Examinations.

Bhawna Taragi
November 2023 Deputy Head - RDCD

ii
COMPUTER APPLICATIONS

SECTION A (40 Marks)


(Attempt all questions from this Section.)

Question 1
Choose the correct answers to the questions from the given options. [20]
(Do not copy the questions, write the correct answers only.)
(i) A mechanism where one class acquires the properties of another class:
(a) Polymorphism
(b) Inheritance
(c) Encapsulation
(d) Abstraction
(ii) Identify the type of operator &&:

(a) ternary
(b) unary
(c) logical
(d) relational
(iii) The Scanner class method used to accept words with space:
(a) next()
(b) nextLine()
(c) Next()
(d) nextString()
(iv) The keyword used to call package in the program:
(a) extends
(b) export
(c) import
(d) package
(v) What value will Math.sqrt (Math.ceil (15.3)) return?
(a) 16.0

1
(b) 16
(c) 4.0
(d) 5.0
(vi) The absence of which statement leads to fall through situation in switch case
statement?
(a) continue
(b) break
(c) return
(d) System.exit(0)
(vii) State the type of loop in the given program segment:
for (int i = 5; i ! = 0; i - = 2)
System.out.println(i);
(a) finite
(b) infinite
(c) null
(d) fixed
(viii) Write a method prototype name check() which takes an integer argument and
returns a char:
(a) char check()
(b) void check (int x)
(c) check (int x)
(d) char check (int x)
(ix) The number of values that a method can return is:
(a) 1
(b) 2
(c) 3
(d) 4
(x) Predict the output of the following code snippet: String P = "20", Q ="22";
int a = Integer.parseInt(P);
int b = Integer.valueOf(Q);
System.out.println(a+""+b);
(a) 20

2
(b) 20 22
(c) 2220
(d) 22
(xi) The String class method to join two strings is:
(a) concat(String)
(b) <string>.joint(string)
(c) concat(char)
(d) Concat()
(xii) The output of the function "COMPOSITION".substring(3, 6):
(a) POSI
(b) POS
(c) MPO
(d) MPOS
(xiii) int x = (int) 32.8; is an example of __________ typecasting.
(a) implicit
(b) automatic
(c) explicit
(d) coercion
(xiv) The code obtained after compilation is known as:
(a) source code
(b) object code
(c) machine code
(d) java byte code
(xv) Missing a semicolon in a statement is what type of error?
(a) Logical
(b) Syntax
(c) Runtime
(d) No error
(xvi) Consider the following program segment and select the output of the same
when n = 10 :
switch(n)
{case 10 : System.out.println(n*2);

3
case 4 : System.out.println(n*4); break;
default : System.out.println(n);
}
(a) 20
40
(b) 10
4
(c) 20, 40
(d) 10
10
(xvii) A method which does not modify the value of variables is termed as:
(a) Impure method
(b) Pure method
(c) Primitive method
(d) User defined method
(xviii) When an object of a Wrapper class is converted to its corresponding primitive
data type, it is called as ___________.
(a) Boxing
(b) Explicit type conversion
(c) Unboxing
(d) Implicit type conversion
(xix) The number of bits occupied by the value ‘a’ are:
(a) 1 bit
(b) 2 bits
(c) 4 bits
(d) 16 bits
(xx) Method which is a part of a class rather than an instance of the class is termed
as:
(a) Static method
(b) Non static method
(c) Wrapper class
(d) String method

4
Comments of Examiners
(i) Majority of the candidates chose Suggestions for teachers
the correct option (b). Some − Teach the concepts of OOPS using daily
candidates, however, chose option
life examples.
(a).
(ii) Most of the candidates chose the − Ensure that the students understand the
correct option (c). Some difference between logical and relational
candidates who were not clear of operator.
the concept chose option (d). − Lay stress on the symbols used for
(iii) Majority of the candidates were relational and logical operator.
unable to choose the correct option − Give short questions to the students to
(b). They chose either (a) or (c) identify the category of an operator.
whereas the question stated, ‘words − Lay stress on the programs based on
with space’. accepting a name with two words.
(iv) Few candidates chose option (d) − Teach how to use package while teaching
instead of option (c).
the concept of Scanner class input.
(v) Most of the candidates chose the
− With examples of nested function, lay
correct option (c). Some
candidates, however, selected stress on the order of evaluation – that the
option (a) or (b) or mentioned 4 inner function should be executed/called
instead of 4.0 clearly showing that first and then on the returned value of the
they had no idea about a nested inner function the outer function to be
function cell. executed.
(vi) Many candidates chose option (d) − Adequate practice to be given on return
instead of option (b). type of the function.
(vii) Most of the candidates chose either − Teach the concept of fall through
option (a) or option (d) instead of condition with suitable programs.
option (b). − Ensure that the students understand that
(viii) Most of the candidates chose either all loops are not fixed loop or finite loop.
option (b) or option (c) instead of
− Ensure that the students are clear when to
option (d).
use void as a return data type and when to
(ix) Most of the candidates chose the
correct option (a). A few, however, use other data type as a return data type.
chose option (b). − Explain, using suitable programs in the
(x) Many candidates chose option (c) computer lab, that in a method, only one
instead of option (b). value can be returned.
(xi) Instead of the correct option (a), − Lay emphasis on using correct syntax for
candidates chose either option (c) all string methods.
or option (d). − Ensure that the students understand that
(xii) Very few candidates chose the changing the case of a letter in string
correct option (b). method may lead to an error message.
(xiii) Instead of the correct option (c), − Explain to the students that in a string,
most of the candidates chose the
index number starts from 0 and not from
incorrect option (a) or option (b).
1.
(xiv) Very few candidates chose the
correct option (d). − Explain the types of conversion with
(xv) Only a few candidates chose the alternate names for implicit and explicit
correct option (b). conversion.

5
(xvi) Few candidates chose the incorrect
option (c) instead of the correct one
(a) Suggestions for teachers
(xvii) Instead of the correct option (b), − Teach the difference between syntax error,
many candidates chose the runtime error and logical error with proper
incorrect option (a) or (d). examples in the computer lab.
(xviii) Most of the candidates chose either − Explain to the students in detail, the
the option (b) or (d) instead of the meaning of auto boxing and unboxing with
correct option (c). suitable programs in the computer lab.
(xix) Many candidates chose the − Ensure that the students understand the
incorrect option (a) or option (b). difference between implicit and explicit
(xx) Most of the candidates chose the conversion.
correct option (a). However, some − Teach the students the number of bits /
candidates chose the incorrect bytes occupied by each primitive data
options (b) or option (d). type.
− Make the use of static variables and
instance variables to explain this concept
properly.

MARKING SCHEME
Question 1
(i) (b) Inheritance

(ii) (c) logical

(iii) (b) nextLine()

(iv) (c) import

(v) (c) 4.0

(vi) (b) break

(vii) (b) infinite

(viii) (d) char check (int x)

(ix) (a) 1

(x) (b) 20 22

(xi) (a) concat(String)

(xii) (b) POS

(xiii) (c) explicit

6
(xiv) (d) java byte code

(xv) (b) Syntax

(xvi) 20
(a)
40

(xvii) (b) pure method

(xviii) (c) unboxing

(xix) (d) 16 bits

(xx) (a) static method

Question 2
(i) Write the Java expression for (𝑎𝑎 + 𝑏𝑏)𝑥𝑥 . [2]
(ii) Evaluate the expression when the value of x = 4: [2]
x * = - - x + x++ + x
(iii) Convert the following do…while loop to for loop: [2]
int x=10;
do
{x– –;
System.out.print(x);
}while (x>=1);
(iv) Give the output of the following Character class methods: [2]
(a) Character.toUpperCase ('a')
(b) Character.isLetterOrDigit('#')
(v) Rewrite the following code using the if-else statement: [2]
int m= 400;
double ch = (m>300) ? (m / 10.0) * 2: (m / 20.0) - 2;
(vi) Give the output of the following program segment: [2]
int n = 4279; int d;
while(n>0)
{d=n%10;
System.out.println(d);

7
n=n/100;
}
(vii) Give the output of the following String class methods: [2]
(a) "COMMENCEMENT" . lastIndexOf('M')
(b) "devote" . compareTo("DEVOTE")
(viii) Consider the given array and answer the questions given below: [2]
int x[ ]={4,7,9,66,72,0,16};
(a) What is the length of the array?
(b) What is the value in x[4]?
(ix) Name the following: [2]
(a) What is an instance of the class called?
(b) The method which has same name as that of the class name.
(x) Write the value of n after execution: [2]
char ch ='d';
int n = ch + 5;

Comments of Examiners
(i) Many candidates did not use any Suggestions for teachers
mathematical method. A few − Explain each mathematical method with
candidates used Math.sqrt instead of the number of arguments required.
Math.pow (a + b, x) − Explain how to apply BODMAS rule for
(ii) Most of the candidates did not use
evaluating expressions.
the BODMAS rule properly. Many
− Lay stress on each operator precedence
candidates did not take the initial
and operator associativity in detail.
value of x for calculation.
− Teach in detail, the syntax of each loop
(iii) Many candidates did not:
with suitable programs in the computer
- Write for loop.
lab.
- Initialize the value of x with 10.
− Explain each character class method in
- Write the iteration statement.
detail with suitable programs in the
(iv) (a) Few candidates wrote ‘a’
computer lab.
(b) Few candidates wrote ‘true’
− Teach the students how to convert
(v) The common errors made by most of
ternary operator into if .. else statement
the candidates were:
- Not having written int m = 400. using suitable programs in the computer
- Not defining variable ch. lab.
- Copying the statement as it is − Give adequate practice to the students on
without using if statement. digit extraction while updating ‘n’ with
- Not writing the else statement. various powers of 10 as students are
mostly familiar with updating ‘n’ by
division by 10.

8
(vi) Many candidates overlooked the
updating of ‘n’ by 100 and were
unable to do the correct digit Suggestions for teachers
extraction. Some candidates did − Tell the students that index number starts
outputs on the same line. from 0.
(vii) Many candidates considered first − Ensure that the students understand the
index number as 1 and gave 9 as the difference between equals() and
answer. compareTo() method.
(viii) (a) A few candidates calculated sum − Teach the students how to find the length
of all the elements. of an array and how to access each
(b) Some candidates considered the element by its index number.
first index number as 1 and wrote 66 − Ensure that the students are clear about
as the answer. the concept that index number in Arrays
(ix) (a) Most of the candidates gave starts from 0.
‘method’ as the answer. − The concept of object-oriented
(b) Majority of the answer scripts programming needs to be discussed in
had static method as the answer. detail.
(x) Most of the candidates were unable − The concept of constructor, its use and
to recollect the corresponding its application should be taught
Unicode value of the character. thoroughly with suitable programs in the
Some candidates gave the answer in computer lab.
char datatype. − Adequate practice should be given to the
students in questions where characters
corresponding Unicode is required.
− Emphasis should be laid on the concept
of implicit type conversion.

MARKING SCHEME
Question 2
(i) Math.pow (a + b, x)

(ii) x = 40
x= x*(--x + x++ +x)
x=4* (3+3+4)
(iii) for(int x = 10; x > = 1; x --)
{System.out.print(x);}
]
(iv) (a) A
(b) false
(v) int m = 400; double ch;
if (m > 300)
ch = (m / 10.0) * 2;

9
else
ch = (m / 20.0) * 2;
(vi) 9
2
(vii) (a) 8
(b) 32
(viii) (a) 7
(b) 72
(ix) (a) object
(b) constructor
(x) n = 105

SECTION B (60 Marks)


(Answer any four questions from this Section.)

Question 3
Design a class with the following specifications: [15]
Class name: Student
Member variables: name – name of student
age – age of student
mks –marks obtained
stream – stream allocated
(Declare the variables using appropriate data types)
Member methods:
void accept() – Accept name, age and marks using methods of Scanner class.
void allocation() – Allocate the stream as per following criteria:
mks stream
> = 300 Science and Computer
> = 200 and < 300 Commerce and Computer
> = 75 and 200 Arts and Animation
< 75 Try Again
void print() – Display student name, age, mks and stream allocated.
Call all the above methods in main method using an object.

10
Comments of Examiners
The common errors made by most of the Suggestions for teachers
candidates were: − Lay stress on writing the same class
- Did not write the same class name as name as it is given in the question.
mentioned in the question. − Explain to the students to declare
member variables with the appropriate
- Did not declare the member variables or data type.
declaring it inside the accept () method. − Explain the importance of writing the
- Not having written the same member same method names as given in the
question.
method names as mentioned in the
− Solve programs in the computer lab to
question.
show how various operators are used in
- Not having written the syntax of the program.
relational operators properly. − Explain the occurrence of syntax errors
/ compilation errors in case of writing
- Not having created an object of the class wrong syntax for the operators.
and not calling member methods. − Solve programs in the computer lab to
- Missing double quotation marks in explain an object of the class with
string message. proper syntax is created and how to call
the member methods using object name.
− Lay emphasis on the concept that
double quotation is must for messages.

MARKING SCHEME
Question 3
import java.util.*;

class Student

String name;int age; int mks; String stream;

void accept()

Scanner sc=new Scanner(System.in);

System.out.println("enter name, age ,mon_no,mks");

name=sc.next();

age=sc.nextInt();

mks=sc.nextInt();

11
void allocation ()

if(mks>=300)

stream="science and computer “;

else if(mks>=200&&mks<300)

stream="commerce and computer";

else if(mks>=75&&mks<200)

stream="arts";

else

stream="Try again";

void print()

System.out.println(name+" "+age+" "+mks+" "+stream);

public static void main(String args[])

Student ob=new Student();

ob.accept();

ob.allocation();

ob.print();

(Variable description not required , if the same variables are used )

12
Question 4
Define a class to accept 10 characters from a user. Using bubble sort technique arrange [15]
them in ascending order. Display the sorted array and original array.

Comments of Examiners
Majority of the candidates declared the Suggestions for teachers
integer array instead of character array. − Teach the students to check the data type
Several candidates did not take the character given in the question and declare the array
input properly. They wrote next( ) or accordingly.
nextLine( ) − Explain how to take array input
Some candidates did not write the swapping depending on the data type.
statements properly. − Solve adequate number of programs in
A few candidates missed out writing the computer lab to explain the students
statements to print the sorted array. how to take integer input, decimal input,
character input and string input using
scanner class in an array.
− Lay emphasis on the order in which
swapping statements are written along
with the importance of each statement
and the effect of each statement with
regards to the position of element in an
array.
− Explain to students that without printing
the sorted array, it is possible to know
whether the array is sorted properly or
not.
− Ensure that students write statements to
print the sorted array.

MARKING SCHEME
Question 4
import java.util.*;
class Bubble{
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
System.out.println("enter characters");
char a[ ]=new char[10];
for(int i=0;i<a.length;i++)
{

13
a[i]=sc.next().charAt(0);
}
System.out.println("original array");
for(int i=0;i<a.length;i++)
System.out.println(a[i]);

for(int j=0;j<a.length;j++)
{
for(int i=0 ; i<a.length-1;i++) or for(int i=0 ; i<a.length-1-j;i++)
{
if((int)a[i]>(int)a[i+1])
{
char temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}}}
System.out.println("sorted array");
for(int i=0;i<a.length;i++)
System.out.println(a[i]);
} } (Variable description )

Question 5
Define a class to overload the function print as follows:
void print() to print the following format
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
void print(int n) To check whether the number is a lead number.
A lead number is the one whose sum of even
digits are equal to sum of odd digits.
e.g. 3669 odd digits sum = 3 + 9 = 12
even digits sum = 6 + 6 = 12
3669 is a lead number.

14
Comments of Examiners
Most of the candidates did not use the Suggestions for teachers
method overloading concept in the
− Explain the concept of method
program. Many candidates did not use the
overloading by solving suitable
same method name as given in the question.
Some candidates did not use the nested programs.
loop concept to print the given pattern. A − Ensure that the students understand the
few candidates were unable to extract the importance and use of method
digits properly. overloading in a program.
− Emphasize on giving the same method
name as given in the question and also
giving the same method name in the
program.
− Solve number of programs in the
computer lab to explain to the students
how to print the given pattern using
nested loop.
− Explain that only writing printing
statements without using nested loop is
not acceptable.
− Solve number of programs in the
computer lab to explain to the students
how to extract each digit of the number
using while loop with proper syntax.
− Ensure that students know how to write
proper condition, use remainder
operator to extract a digit and use
division operator to reduce the number.

MARKING SCHEME
Question 5
class overload
{
public static void print( )
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=4;j++)
{
System.out.print(i);
}
System.out.println();

15
} }

public static void print(int n)


{
int s1=0; int s2=0;
while(n>0)
{
int rem=n%10;
if(rem%2==0)
s1+=rem;
else
s2+=rem;
n/=10;
}
if(s1==s2)
System.out.println("Lead number");
else
System.out.println("not Lead number");
}
public static void main(String args[])
{
print( );
print(3669);
}
} (Variable description )

Question 6
Define a class to accept a String and print the number of digits, alphabets and special [15]
characters in the string.
Example: S = “KAPILDEV@83”
Output: Number of digits – 2
Number of Alphabets – 8
Number of Special characters – 1

16
Comments of Examiners
The common errors made by many Suggestions for teachers
candidates were:
− Solve number of programs in the
- Not having extracted characters in the
computer lab to explain to students the
program.
- Not having used the concept of use, syntax and importance of each string
Character class methods properly method.
- Not having used if condition properly − Solve number of programs in the
to check the range of characters and computer lab to explain the students how
digits to use each character class method in a
- Having used the alternate logic and string program.
made errors such as: − Explain the method of checking for range
• Printing inside the loop of digits and characters in a string
For example: if(ch>=48 && program.
ch<=57) − Ensure that the students understand that
d=d+1;
printing must be done outside the loop,
• System.out.println(“Number of
digits=”+d); otherwise the printing will be done as
many times the loop will execute.

MARKING SCHEME
Question 6
import java.util.*;
class check_string{
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
System.out.println("enter string");
String s=sc.next();
int c=0,d=0,sp=0;
for(int i=0;i<s.length();i++)
{ char ch=s.charAt(i);
if(Character.isLetter(ch))
c++;
else if(Character.isDigit(ch))
d++;
else if(!(Character.isLetterOrDigit(ch)))
sp++;
}
System.out.println("number of digits "+d);
System.out.println("number of Alphabets "+c);

17
System.out.println("number of special characters "+sp);
}}
(Variable description )
Alternate logic:
1)if(ch>='0' && ch<='9')
c++;
else if((ch>= 'A' && ch<='Z') || (ch>='a' && ch<='z') )
d++;
else
sp++;
2) char ch=s.charAt(i);
if(ch>=48 && ch<=57)
c++;
else if((ch>= 65 && ch<=90) || (ch>=97 && ch<=122) )
d++;
else
sp++;

Question 7
Define a class to accept values into an array of double data type of size 20. Accept a [15]
double value from user and search in the array using linear search method. If value is
found display message “Found” with its position where it is present in the array.
Otherwise display message “not found”.

18
Comments of Examiners
The common errors made by most candidates Suggestions for teachers
were:
− Emphasize the importance of checking
- Used int data type instead of double data
the data type given in the question and
type
- Took size as 10 instead of 20. declaring the array accordingly.
- Not taking an input of the number to be − Tell the students the importance of
searched. reading the question properly and
- Not using the break keyword when the declaring the array with the size as
flag variable is used in the loop. given in the question.
- Ignoring the output message “not found” − Solve programs in the computer lab to
explain to the students the importance
Some candidates made an error in the use of of taking input of the number to be
System.exit(0). A few candidates did Binary searched in an array.
search instead of Linear search. − Explain to the students that without
input of number, searching is not
possible in an array.
− Importance of indicator in linear search
must be explained.
− Distinction between linear search and
binary search must be explained.
− Train students with the correct
algorithm of linear search method
− Teach the concept of System.exit(0).

MARKING SCHEME
Question 7
import java.util.*;
class Linear{
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
System.out.println("enter numbers");
double a[ ]=new double[20];
for(int i=0;i<a.length;i++)
{
a[i]=sc.nextDouble();
}
System.out.println("enter search element");
double search=sc.nextDouble();
for(int i=0;i<a.length;i++)
{
if(a[i]==search)
{

19
System.out.println("element found"+(i + 1)); OR (i)
System.exit(0);
}
}
System.out.println("not found");
}}
(Variable description )

Consider Alternate logic :


boolean flag =false;----->1
for(int i=0;i<a.length;i++) //
{
if(a[i]==search)//
{
flag =true;
System.out.println("element found"+(i + 1)); //
break;
}
}
if(flag== false)
System.out.println("not found"); //

Question 8
Define a class to accept values in integer array of size 10. Find sum of one digit number
and sum of two digit numbers entered. Display them separately.

Example: Input: a[ ] = {2, 12, 4, 9, 18, 25, 3, 32, 20, 1}

Output: Sum of one digit numbers : 2 + 4 + 9 + 3 + 1 = 19

Sum of two digit numbers : 12 + 18 + 25 + 32 + 20 = 107

20
Comments of Examiners
Majority of the candidates lost marks in the Suggestions for teachers
identification of 2-digit number. Many − Teach the concept of checking the 2-digit
candidates were able to do the single digit number.
number checking properly but assumed that − Explain the logical operator concept.
the remaining numbers were 2-digit − Ensure that the students understand the
number. Some candidates made an error in
difference between the value display
the use of logical operator. Instead of &&
inside the loop and outside the loop.
operator candidates used || operator. A few
candidates displayed the value inside the
loop.

MARKING SCHEME
Question 8
import java.util.*;
class Que8
{
public static void main (String args[ ])
{
Scanner sc=new Scanner(System.in);
int a[ ]= new int[10]; [ Array size -10]
int s1=0; int s2=0;int i;
System.out.println("enter elements");
for(i=0;i<a.length;i++)
a[i]=sc.nextInt();
for(i=0;i<a.length;i++)
{
if(a[i]>0&&a[i]<=9)
s1+=a[i];
else if(a[i]>=10&&a[i]<=99)
s2+=a[i];
}
System.out.println("sum of single digit nos"+s1);
System.out.println("sum of double digit no"+s2);
}}

(Variable description )

Alternate logic to be accepted

21
GENERAL COMMENTS

Topics (a) Topics/Concepts found difficult:


found • Prefix postfix and shorthand operators.
difficult/ • Character class methods.
confusing by
• Declaration of array and input data in array through keyboard, especially character
candidates type.
• Method overloading concept.
• Use of counter variables.
• ASCII codes of characters.
• Evaluating the expression.
• Object creation and calling member methods.
• Multiple Mathematical functions.
• Nested loop.
(b) Topics/Concepts between which candidates were confused:
• The method compareTo().
• Logical operator and relational operator.
• How to declare the instance variable.
• How to invoke the methods using objects.
• The first index of the array and first index of the string.
• Array length and string length.
• How to check a particular character is a digit.
• Unboxing.
• Implicit and explicit casting.
• Wrapper class methods.

22
• Read questions carefully as lot of specifications are clearly provided in the
question.
Suggestions
• Keep in mind the case sensitivity feature of Java.
for
candidates • Understand the program-based questions in a such a way that i) input ii) process
and output.
• Choose data types carefully using common sense approach.
• Be cautious about the difference between print() and println(), specially for
output questions.
• Method prototype and correctly invoking a method to be practiced.
• Learn the ASCII codes of alphabets, digits, etc.
• Solve assignments on your own and submit the same to the teachers for their
correction.
• Solve number of programs in the computer lab in the presence of the teacher
and clarify doubts.

23

You might also like