[go: up one dir, main page]

0% found this document useful (0 votes)
24 views4 pages

Test Paper 1 For 2023-1

Uploaded by

tapaskumarmahato
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views4 pages

Test Paper 1 For 2023-1

Uploaded by

tapaskumarmahato
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ICSE 2023 Revision Test paper 1

Maximum Marks: 100 Time: 2 Hours

Section A
(Attempt all questions from this Section)
Question 1
Choose the correct answer and write the correct option. [20x1=20]
(i) Hiding of complex details, while exposing only (ii) Which of the following data types is passed as a
necessary information is called _______. value when a method is called?
a) Encapsulation a) Array
b) Abstraction b) static
c) Inheritance c) int
d) Polymorphism d) none of the above
(iii) Array variables are also called ________. (iv) A method can return __________ value(s).
a) Elements a) 0
b) Subscripted Variables b) 1
c) Both a and b c) 2
d) None of the above d) Any number of values
(v) A highly optimized Intermediate code created by (vi) Which of the following statement is true?
Java compiler from Java source code, which is a) An instance method can be accessed
then executed by JVM/Java Interpreter is called using this.
a) Object Code b) A static method cannot be accessed using
b) Source Code this.
c) Bytecode c) Both a and b
d) Java Program d) None of the above
(vii) System.exit(0) and break have same (viii) Data Members of a class are always either
functionality. static or non-static.
a) True a) True
b) False b) False
(ix) Number of bytes occupied by literal ‘\u0000’ and (x) true and false are examples of __________.
‘\uffff’ are: a) Literal
a) 2 bytes and 2 bytes respectively b) Identifier
b) 4 bytes and 4 bytes respectively c) Keyword/Reserved word
c) 1 byte and 1 byte respectively d) Operator
d) None of the above
(xi) On the basis of declaration: (xii) Which of the following access modifiers does not
int a [] = {10, 14, 5, -75, 82, 9, -7}; which is the allow inheritance?
most appropriate choice? a) private
a) Array a [] contains 8 elements b) public
b) Array a [] will occupy 64 bytes c) protected
c) Element a [7] contains 0 d) package (default)
d) All of the above
e) None of the above
(xiii) How many wrapper classes are there? (xiv) Which of the following is used to get the address
a) 1 of an object?
b) 2 a) new
c) 4 b) this
d) 8 c) constructor
d) data member
(xv) int i = 3, j = 0; (xvi) Given that Toy is a class, how many reference
double k = 3.2; variables and objects are created by the
if (i < k) following code?
if (i == j) Toy toyName, toyId;
System.out.println (i); toyName = new Toy ();
else Toy toy_type = new Toy ();
System.out.println (j); a) Three reference variables and two objects
else b) Two reference variables and two objects
System.out.println (k); c) One reference variable and two objects
Select the right answer. d) Three reference variables and three
a) 3 objects
b) 0
c) 3.2
d) none of these
(xvii) What will be the final value of x, if initially a = 3, (xviii) Which of the following is same as
b = 6, c = 9 and x = 1. geek = geek + 1; where geek is of int data type.
if (a == b && c == 9) x = 7; a) geek+=1;
a) 3 b) ++geek;
b) 6 c) geek++;
c) 7 d) All of the above
d) 1
(xix) Division of any integer by a variable that (xx) for (int i=6, k=10 ; i <=60 ; i+=6 )
contains a value of zero is ________. if (i%k==0) break;
a) Syntax Error else System.out.print(i) ;
b) Logical Error will produce ____ as output and run ___ times.
c) Runtime error a) 6 12 18 24 and 4 times
d) No Error b) 6 12 18 24 30 and 5 times
c) No output and 10 times
d) 6 12 18 24 and 5 times

Question 2 [10x2=20]

(i) Differentiate between Call by value and call by reference.


(ii) Arrange the following values in ascending order of memory space, they will use.
a) 1234 b) “FINAL” c) int a [] = {1,2,3,4,5}; d) 45L e) 200.0
(iii) Give the output of following:
a) System.out.println( “DOG”.compareToIgnoreCase(“CAT”) );
b) System.out.println( “CAT”.equals(“cat”) );
(iv) Give the output of following statements:
a) System.out.println ( 8 > 9 && 8 < 8);
b) System.out.println ( 8 > 9 == 8 < 8);
(v) Give the output of the following:
int[] a = { 11, 12, 13, 14 };
int[] b = { 0, 1, 2, 3 };
System.out.println(a[ b[3] ]);
(vi) Convert the given statement into if...else form. big = 5 > 10 && 8 <= 10 ? 2 : 20;
(vii) Give the output, if value of x = 12
if(x>4)
System.out.println("Fool");
else if(x>9)
System.out.println("Idiot");
else
System.out.println("Duffer");
(viii) Give the output of following program snippet:
int a = 2, b=4, c=10;
a *= ++a * c++ - --b;
System.out.println (“Result is:” + a);
(ix) Give 1 word answer:
a) A method that converts a string to a primitive integer data type.
b) The default initial value of a Boolean variable data type.
(x) Give the output:
a) Math.pow (25,0.5) + Math.ceil (4.2)
b) Math.round (14.7) + Math.floor (7.9)

Section B
(Attempt all questions from this Section.)
Each program should be written using variable description / mnemonic codes so that the logic of the program is clearly depicted.

Question 3 [10]
Define a class with the following specifications:
Class name: IncomeTax
Member variables/Data members/Instance variables:
String ename - name of the employee
int age - age of the employee
double gross - gross yearly salary
Member methods:
IncomeTax () - a constructor to initialize all the data members.
void accept () - to input values of ename, age and gross (using Scanner class).
double tax () - to calculate income tax as per the details given below:
income tax
<=₹500000 Nil
₹500001 to ₹750000 10 % of the exceeding amount.
₹750001 to ₹1000000 ₹25000 + 20% of the exceeding amount
Above ₹1000000 ₹75000 + 30% of the exceeding amount
Anybody earning above ₹3000000, has to pay an additional 10% of income tax
calculated, which is added to the tax calculated as per the rules given above.
void display () - To display the tax calculated in the given format:
EName Gross Tax Payable
______ _____ __________

Create an object of the class in main method and invoke the member methods to get the work done.
Question 4 [10]
Define a class to overload the method display as follows:
a) void print () to print the pattern as given.
A
BA
BAB
ABAB
ABABA
b) boolean print (int n) to check and return appropriate value if a given number n is “PRIME” or
“NOT PRIME”.

Write a main method to invoke all the methods using objects.

Question 5 [10]
Write a program to create an array of 10 double values and search for a number using linear search. Print an
appropriate message for data found or not found.

Question 6 [10]
Write a program to enter String and print the percentage occurrences of Alphabets, Digits and Special
Characters contained in it.

Question 7 [10]
Write a program to store the following numbers in an array: 10, 30, -56, 45.75, -33.33, 0, -4, 76, -91, 8 and
produce the given output.
Positive Numbers are 10.0, 30.0, 45.75, 76.0, 8.0
Negative Numbers are -56.0, -33.33, -4.0, -91.0

Question 8 [10]
Write a program to enter 50 positive numbers and print the frequency of the following class intervals.
Class Intervals Frequency
<=100 ___
Above 100 to <=1000 ___
Above 1000 to <=10000 ___
Above 10000 ___

You might also like