Monday , 25 January 2021
Latest Posts
Home » Announcements » ICSE 2016 Computer Applications Paper Solved

# ICSE 2016 Computer Applications Paper Solved

Greetings students!

We have also solved the theory portion of the question paper and have posted the answers below. The programs of this question paper have been solved separately and appropriate links to the solutions have been posted. [Note: If you find any typing errors in the answers then do report to us by commenting below]

ICSE Question Paper – 2016 (Solved)

Computer Applications
Class X

SECTION A (40 Marks)
Answer all questions from this Section

Question 1.

(a) Define Encapsulation. [2]

answer : Binding up of data and associated functions together into a single unit called (class) is called Encapsulation.

(b) What are keywords? Give an example. [2]

answer : These are the special reserved words which have some specific meaning to the Java interpreter. Examples: break, import, int etc.

(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;

answer : (i) runtime error (ii) syntax error

(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]

answer : (i) 6 (ii) 37

Question 2.

(a) State the difference between = = operator and equals( ) method. [2]

 = = operator equals( ) 1. It is a relational operator 1. It is a String function 2. It is used to check for equality of any primitive data types. 2. It is used to check for equality of two String objects.

(b) What are the types of casting shown by the following examples: [2]

(i) char c = (char)120;
(ii) int x = ‘t’;

answer : (i) explicit (ii) implicit

(c) Differentiate between formal parameter and actual parameter. [2]

 formal actual 1. parameters which are specified in the function prototype while creating a function. 1. parameters which are specified while calling a function. 2. contains data-type in their declaration. 2. does not contain data-type.

(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.

answer : int PosChar(String s, char c)

(e) Name any two types of access specifiers. [2]

Question 3.

(a) Give the output of the following string functions : [2]

(i) “MISSISSIPPI”.indexOf(‘S’) + “MISSISSIPPI”.lastIndexOf(‘I’)

answer : (i) 12 (ii) -2

(b) Give the output of the following Math functions: [2]

(i) Math.ceil(4.2)
(ii) Math.abs(-4)

answer : (i) 5.0 (ii) 4

(c) What is a parameterized constructor? [2]

answer : A parameterized constructor is a member method of a class which has the same name as that of the class and it initializes the instance variables of the class with its parameters.

Example: If class declaration is

class Sample
{
int a, b;
.
.
}

then Sample(int aa, int bb) is a parameterized constructor.

(d) Write down java expression for : [2]

T = $\sqrt{A^2 + B^2 + C^2}$

answer : double T = Math.sqrt((Math.pow(A,2) + Math.pow(B,2) + Math.pow(C,2))

or double T = Math.sqrt((A*A + B*B + C*C))

(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–;
}

int m = 5, n;
for(n=10; n>=1; n–)
{
System.out.println(m*n);
}

or

int m = 5, n = 10;
for(; n>=1; n–)
{
System.out.println(m*n);
}

(g) Write one difference between primitive data types and composite data types. [2]

answer : primitive data types are built-in data types provided by Java whereas, composite datatypes are datatypes that are based on fundamental or primitive datatypes.

(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;
}

10

(ii) 3 times

Working :

When m = 5,
if(m%3 == 0) is false
if(m%5 == 0) is true
so it prints ‘5’
Loop executed 1 time.

When m = 10,
if(m%3 == 0) is false
if(m%5 == 0) is true
so it prints ‘10’
Loop executed 2 times.

When m = 15,
if(m%3 == 0) is true
so, break is encountered and loop terminates.
Loop executed 3 times.

(i) Give the output of the following expression : [2]

a+=a++ + ++a + –a + a– ;     when a = 7

Working : a+=a++ + ++a + –a + a– ;
a = a + a++ + ++a + –a + a– ;
a = 7 + 7 + 9 + 8 + 8
a = 39

(j) Write the return type of the following library functions : [2]

(i) isLetterOrDigit(char)
(ii) replace(char,char)

answer : (i) boolean (ii) String

SECTION B (60 Marks)

Attempt any four questions from this Section.

Question 4.

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 Rs 1000 2% of price More than Rs 1000 and less than or equal to Rs 3000 10% of price More than Rs 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.

Question 5.

Using the switch statement, write a menu driven program for the following:

(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
I C
I C S
I C S E

For an incorrect option, an appropriate error message should be displayed.

Question 6.

Question 7.

Question 8.