<tbody>
ICSE
Java
computer applications
Class: X
Pre Board Examination Dec ’22
Date: 30/12/22
Max Marks: 100
Subject: Computer
Max. Time 2 hours
</tbody>
_________________________________________________________________________
SECTION A
(Attempt all questions from this Section)
Question 1 Choose the correct answer and write the correct option. [20]
- _________ is the blueprint that can produce multiple objects with common
characteristics and behaviour.
- Object
- Class
- Data member
- Function
- The escape sequence for New line is :
- \t
- \b
- \n
- \”
- The code that is obtained after the compilation of the java program is :
- Byte code
- Source code
- Java Virtual machine
- Object code
- The size of a float data type is:
- 4 bytes
- 8 bits
- 4 bits
- 8 bytes
- What will be the value of variable ‘val’ when the following statement is
executed?
val = (char) 50;
- ‘A’
- 2
- “50”
- ‘2’
- What will be the value in variable ‘n’ when the following code is executed?
int x=67;
char n=(x<=67) ? ‘C’ : ‘B’ ;
- ‘B’
- 66
- ‘C’
- true
- What will be value returned by the following statement ?
Double.toString(Math.cbrt(27));
- 9
- 3.0
- “3.0”
- “3”
- The statement that will be executed when there are no matching cases in a switch-case is:
- break
- default
- continue
- condition
- Which of the following is an exit-controlled loop?
- switch-case
- while ()
- for()
- do-while()
- The following is an example of which kind of loop?
int x=10;
while(x++ >= 10)
{ System.out.println(x);}
- do-while() loop
- infinite loop
- for() loop
- time-delay
- The keyword used to declare a class variable is :
- class
- public
- static
- void
- What will Character.toUpperCase(‘b’) return?
- ‘B’
- “B”
- “b”
- 66
- What will be the output of 100 / 9?
- 11.1
- 11
- 9.99
- 1
- Which of the following is not applicable for a constructor?
- It is used to update the member variables with legal values.
- It has no return type, not even void.
- It is invoked by making a function call using an object.
- It will have the same name as class.
- The method of calling a function in such a way that the change in the formal
arguments reflects in the actual parameter also is known as :
- Call by value
- Call by method
- Call by reference
- None of the above
- What will be the output when the following statements are executed?
if (“AMIT” . compareTo (“AMAN“) > 0)
System.out.println(“AMIT”) ;
else
System.out.println(“AMAN”);
- 8
- -8
- AMAN
- AMIT
- Which of the following is a composite data type?
- static char n;
- class Student
- int j;
- static boolean b;
- The output of “Lemonade”. indexOf (‘e’, 3); is :
- 1
- ‘e’
- 3
- 7
- If String s = “Computer Applications”, what will be the output of : s.substring(5,12);
(a) “terAppl”
(b) “ter Appl”
(c) “ter App”
(d) “Comput”
- What is the result produced by 2-10*3+100/11?
(a) -1
(b) 33
(c) -15
(d) -19
Question 2
- If a=5, b=9 calculate the value of a+=a++ - ++b +a
- What will be the value of x after the execution of the following expression?
x=10 and y=20
x=x>y?10:y+2;
- Write a java expression for the following.
√3x+x2/a+b
- If int X[]={4,3,7,8,9,10}; What will be the value of p and q?
p=X.length
q=X[2]+X[5]*X[1]
- Differentiate local variable and Instance variable (Write two points each).
- String x[]={“SAMSUNG”, “NOKIA”, “SONY”,”MICROMAX”, “BLACKBERRY”};
Give the output of the following statements:
System.out.println(x[3]);
System.out.println(x[4].length);
- What will be the final value of ctr when the loop given below executes
int ctr=0;
for(int i=1;i<=5;i++)
for(int j=1;j<=5;j+=2)
++ctr;
- Convert the following if else statement in to switch case.
if(val==1)
System.out.println(“good”);
elseif(val=2)
System.out.println(“better”);
elseif(val==3)
System.out.println(“best”);
else
System.out.println(“invalid”);
- Give the output of the following
Math.pow(36, 0.5)+ Math.cbrt(125)
Math.ceil(4.2)+Math.floor(7.9)
- Write the output of the following.
String S1=”Life is beautiful”;
System.out.println(“Earth”+S1. substring(4));
System.out.println(S1. indexOf(‘i’));
Section B (60 Marks)
Answer any four questions from this Section(15X4=60 marks)
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 3
Define a class BookFair with the following members :
Data members/Instance variables :
String bName – Stores the name of the book
double price - Stores the price of the book
Member functions :
void input() – Inputs and stores the name and price of the book
void calculate()-Calculates the price after discount.
Discount is calculated based on the following criteria:
<tbody>
Price
Discount
Less than or equal to Rs.1000
2%
More than Rs.1000 and less than or equal to Rs.3000
10%
More than Rs.3000
15%
</tbody>
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 methods. [15]
Question 4
Write a program in java to accept a word from the user and check and display whether the word is a Palindrome or not. Palindrome is a word that reads the same from left to right and vice versa. (Ex.MALAYALAM, LEVEL etc.) [15]
Question 5
Write a program to perform function overloading as follows:
- a) myfunction() – It displays the following pattern.
1
12
123
1234
12345
- b) myfunction(String)-accepts a string and checks if the word is a special word or not
Special words are those which start and end with the same alphabet. (Ex. EXISTENCE, COMIC etc)
- c) myfunction (int)- accepts a number from the user and check whether it is a Perfect number.
(A number is a perfect number if the sum of all it’s factors, except itself, gives back the number. Ex. 28 is a perfect number as it’s factors are 1, 2, 4, 7 and 14, and if you add them you will get back 28.)
Question 6
Write a program to accept 10 numbers in an array and sort it in ascending order using bubble sort.
Question 7
Write a program to accept the year of graduation from school as an integer value from the users . Using the Binary search technique on the sorted array of integers given below . Output the message “record exists" if the value input is located in the array and if not output the message record does not exist”.
{1982, 1987 ,1993, 1996 ,1999, 2003, 2006 ,2007 ,2009, 2010,}
Question 8
Write a program that creates integer array of 10 elements, accepts values of arrays and Find Sum, Average, Minimum and Maximum element.