2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
15th October 2014, 04:27 PM
Super Moderator
 
Join Date: Apr 2013
Re: ICSE X Exam Solved Paper

As per your request here I am sharing the last year solved question paper of ICSE Class X Computer Applications ( Java ) Exam

Section A

Question 1:
(a) Why is a class called a factory of objects? [2]
Ans. A class is known as a factory of objects because objects are instantiated from classes. Each object gets a copy of the instance variables present in the class. It is like a factory producing objects.
(b) State the difference between a boolean literal and a character literal. [2]
Ans. i) A boolean literal can store one of two values – true and false. A character literal can store a single Unicode character.
ii) The memory required by a boolean literal depends on the implementation. The memory required by a character literal is 2 bytes.
(c) What is the use and syntax of a ternary operator? [2]
Ans. The ternary operator is a decision making operator which can be used to replace certain if else statement.
Syntax: condition ? expression1 : expression2
(d) Write one word answer for the following: [2]
i) A method that converts a string to a primitive integer data type
ii) The default initial value of a boolean variable data type
Ans. i) Integer.parseInt()
ii) false
(e) State one similarity and one difference between while and for loop. [2]
Ans. A while loop contains only a condition while a for loop contains initialization, condition and iteration.

Question 2:
(a) Write the function prototype for the function “sum” that takes an integer variable (x) as its argument and returns a value of float data type. [2]
Ans.
public float sum(int x)
(b) What is the use of the keyword this? [2]
Ans. this refers to the object on which the method has been invoked. If an instance variable and a local variable in a method have the same name, the local variable hides the instance variable. The keyword this can be used to access the instance variable as shown in the example below:
public class thisKeywordExample {

int a; // varaible 1

public void method() {
int a; // variable 2
a = 4; // varaible 1 will be changed
a = 3; // varaible 2 will be changed

}
}
(c) Why is a class known as a composite data type? [2]
Ans. A class is composed of instance variables which are of different data types. hence, a class can be viewed as a composite data type which is composed of primitive and other composite data types.
(d) Name the keyword that: [2]
i) is used for allocating memory to an array
ii) causes the control to transfer back to the method call
Ans. i) new
ii) return
(e) Differentiate between pure and impure functions. [2]
Ans. i) A pure function does not change the state of the object whereas an impure function changes the state of the object by modifying instance variables.
ii) get functions are examples of pure functions and set functions are examples if impure functions.

Question 3:
(a) Write an expression for [2]
Ans. (Math.pow(a+b),n)/(Math.sqrt(3)+b)
(b) The following is a segment of a program.
x = 1; y = 1;
if(n > 0)
{
x = x + 1;
y = y - 1;
}
What will be the value of x and y, if n assumes a value (i) 1 (ii) 0? [2]
Ans. i) 1 > 0 is true, so if block will be executed.
x = x + 1 = 1 + 1 = 2
y = y – 1 = 1 – 1 = 0
ii) 0 > 0 is false, so if block will not be executed and therefore, the values of x and y won’t change.
x = 1
y = 1
(c) Analyze the following program segment and determine how many times the body of loop will be executed (show the working). [2]
x = 5; y = 50;
while(x<=y)
{
y=y/x;
System.out.println(y);
}
Ans.
Iteration 1 : 5 <= 50 - true y = y / x = 50 / 5 = 10 10 will be printed
Iteration 2 : 5 <= 10 - true y = y / x = 10 / 5 = 2 2 will be printed
Iteration 3 : 5 <= 2 - false
The loop will be executed two times.
(d) When there are multiple definitions with the same function name, what makes them different from each other? [2]
Ans. The function prototype make multiple definitions of a function different from each other. Either the number, type or order or arguments should be different for the functions having identical names.
Q3. (e) Given that int x[][] = { {2,4,6}, {3,5,7} };
What will be the value of x[1][0] and x[0][2] ? [2]
Ans. We can write the array as

As shown in the figure x[1][0] is 3 and x[0][2] is 6.
(f) Give the output of the following code segment when (i) opn = ‘b’ (ii) opn = ‘x’ (iii) opn = ‘a’. [3]
switch(opn)
{
case 'a':
System.out.println("Platform Independent");
break;
case 'b':
System.out.println("Object Oriented");
case 'c':
System.out.println("Robust and Secure");
break;
default:
System.out.println("Wrong Input");
}
Ans. i) Output will be
Object Oriented
Robust and Secure
As there is no break statement for case ‘b’, statements in case ‘c’ will also be printed when opn = ‘b’.
ii) Output will be
Wrong Input
As ‘x’ doesn’t match with either ‘a’, ‘b’ or ‘c’, the default statement will be executed.
iii) Output will be
Platform Independent
(g) Consider the following code and answer the questions that follow: [4]
class academic
{
int x, y;
void access()
{
int a, b;
academic student = new academic();
System.out.println("Object created");
}
}
i) What is the object name of class academic?
ii) Name the class variables used in the program?
iii) Write the local variables used in the program.
iv) Give the type of function used and its name.
Ans. i) student
ii) x and y
iii) a and b
iv) Type: Non Static
Name: access
Q3 (h) Convert the following segment into an equivalent do loop. [3]
int x,c;
for(x=10,c=20;c>10;c=c-2)
x++;
Ans.
int x, c;
x = 10;
c = 20;
do {
x++;
c = c - 2;
} while (c > 10);


Rest of the Questions are attached in below file which is free of cost
Attached Files
File Type: doc ICSE X Computer Applications Java Exam Question Paper.doc (90.0 KB, 117 views)


Quick Reply
Your Username: Click here to log in

Message:
Options




All times are GMT +5. The time now is 05:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4