CLASS 10 ICSE JAVA SPECIMEN PAPER 2022 Term - I

Maximum Marks: 50

Time allowed: One hour (inclusive of reading time)

ALL QUESTIONS ARE COMPULSORY.

The marks intended for questions are given in brackets [].

Select the correct option for each of the following questions.

SECTION A




Question 1

Choose the correct answer

(a) Which of the following are valid comments?

  1. /* comment */
  2. /* comment
  3. // comment
  4. */ comment */
  1. (i) & (iii)
  2. (i) & (ii)
  3. All of the above
  4. None of the above

Solution

(1) (i) & (iii)

(b) Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence.

  1. &&
  2. %
  3. >=
  4. ++
  1. (iv), (i), (iii), (ii)
  2. (iv), (iii), (ii), (i)
  3. (iv), (ii), (iii), (i)
  4. (i), (ii), (iii), (iv)

Solution

(3) (iv), (ii), (iii), (i)

(c) Which of the following keyword is used to create an instance of a class?

  1. new
  2. public
  3. class
  4. None of the above

Solution

(1) new

(d) What is the final value stored in variable x ?
double a =-8.35;
double x = Math.abs(Math.floor(a));

  1. 9.0
  2. 7.0
  3. 6
  4. 7

Solution

(2) 7.0

(e) Name the type of error in the statement given below.
int r=100/0;

  1. Syntax
  2. Runtime
  3. Logical
  4. None of the above

Solution

(2) Runtime
Question 2

Fill in the blanks with the correct option

(a) The _____________ allows a class to use the properties and methods of another class.

  1. Inheritance
  2. Polymorphism
  3. Encapsulation
  4. None of the above

Solution

(1) Inheritance

(b) The number of bytes occupied by char data type is __________byte/s

  1. 4
  2. 8
  3. 2
  4. None

Solution

(3) 2

(c) The _________ is called an instance of a class.

  1. Object
  2. Attributes
  3. State
  4. None

Solution

(1) Object

(d) The ____________ are the words which have special meaning.

  1. Keywords
  2. Identifier
  3. Methods
  4. Package

Solution

(1) Keywords

(e) Method that accepts a string without any space is ______.

  1. next()
  2. nextLine()
  3. nextInt()
  4. None of the above

Solution

(1) next()
Question 3

Name the following

(a) The keyword to make a variable as a class variable.

  1. static
  2. Static
  3. final

Solution

(1) static

(b) Intermediate code obtained after compilation.

  1. Source code
  2. Byte Code
  3. Object code

Solution

(2) Byte Code

(c) The method with the same name as of the class and which does not have a return data type is called as.

  1. Constructor
  2. Function
  3. Method

Solution

(1) Constructor

(d) The statement to stop the execution of a construct.

  1. System.exit(0)
  2. break
  3. STOP

Solution

(2) break

(e) Invoking a method by passing the objects of a class is termed as.

  1. Call by value
  2. call by reference
  3. call by method

Solution

(2) call by reference
Question 4

State True Or False

(a) byte is a non - primitive data type.

  1. True
  2. False

Solution

(2) False

(b) !(2>3&&4>6)

  1. True
  2. False

Solution

(1) True

(c) Scope of local variable is within a class.

  1. True
  2. False

Solution

(2) False

(d) The default statement is optional in switch- case.

  1. True
  2. False

Solution

(1) True

(e) The assignment operator(=) is left associative.

  1. True
  2. False

Solution

(2) True
Question 5

Choose the odd one

(a)

  1. Encapsulation
  2. Data abstraction
  3. Portable
  4. Polymorphism

Solution

(3) Portable

(b)

  1. >
  2. ==
  3. &&
  4. <

Solution

(3) &&

(c)

  1. return
  2. break
  3. continue
  4. System.exit(0)

Solution

(4) System.exit(0)

(d)

  1. int
  2. double
  3. char
  4. String

Solution

(4) String

(e)

  1. +
  2. %
  3. /
  4. ||

Solution

(4) ||
Question 6

Give the output of the following

(a) x + = x++ + ++ x + --x + x; [ x = 5 ]

  1. 29
  2. 28
  3. 26

Solution

(1) 29

(b) if ( a > b )

System.out.println(a+b);

System.out.println (a*b); when a = 5 and b = 7

  1. 12, 35
  2. 35
  3. 35, 12

Solution

(2) 35

(c) String x = (a >= 90) ? "excellent" : "best"; when a = 90

  1. best
  2. excellent
  3. excellentbest

Solution

(2) excellent

(d) switch ( x )
{ case 'a' : System.out.println("Discipline");
case 'b' : System.out.println ("Dedication"); break;
case 'c' : System.out.println("Commitment");
default : System.out.println("Success");
} when x='A

  1. Discipline
  2. Dedication
  3. Success

Solution

(3)
Success

(e) n=1000;
while (n>10)
{ n=n/10;
}
System.out.println(n); How many time the loop is executed and what is the output?

  1. Loop is executed 2 times and the output is 100
  2. Loop is executed 3 times and the output is 10
  3. Loop is executed 2 times and the output is 10

Solution

(3) Loop is executed 2 times and the output is 10

SECTION B




Question 7

Given below is a class with the following specifications:

Class name : overload
Member Methods:
void print ( int n ) – to print the first ‘n’ natural numbers
boolean print (int m, int n) – to check whether n is a multiple of m or not
Fill in the blanks of the given program with appropriate java statements –
class (a)____________
{
void print (int n)
{
int k;
for ( (b)_______; (c)_________; (d)____________)
{
System.out.println(k);
}
}
boolean print( int m, (e)________)
{
if ( (f)_________________)
return true;
else
return false;
}
}

(a)

  1. OVERLOAD
  2. overload
  3. class

Solution

(2) overload

(b)

  1. k = 1;
  2. k = n;
  3. k = 0

Solution

(1) k = 1;

(c)

  1. k<=n;
  2. k>=n;
  3. k+n;

Solution

(1) k<=n;

(d)

  1. k+=2;
  2. k+=5;
  3. k++;

Solution

(3) k++;

(e)

  1. int n
  2. double n
  3. char n

Solution

(1) int n

(f)

  1. if (n%m == 0)
  2. if (m%n==0)
  3. if (m/n==0)

Solution

(1) if (n%m == 0)




Question 8

Given below is a class with the following specifications:

class name : telephone

member variables :
int noc [ number of calls]
double bill [ telephone bill to be paid ]
String n [ name of the customer ]

Member methods :
void input ( ) – to accept the data using the scanner class
void print() – to print the details
void calculate () – to calculate the telephone bill as per the following criteria based on number of calls
Number of calls        Rate per call
First 100 calls          free
Above 100 calls          Rs.2.50
void main ( ) – to create an object of the class and invoke the functions of the class

class (a)_____________
{ int noc; double bill ; String n;
Scanner ob = (b)______________ Scanner(System.in);
void input( )
{ System.out.println(“Enter Number of calls”);
noc = (c)____________________;
System.out.println(“Enter name “);
n=ob.next();
}
void calculate()
{ if ( (d)__________________)
bill =0;
else
bill = (e)_____________________________;
}
void print()
{ System.out.println(“Name = “+n);
System.out.println(“Amount to be paid=”+bill);
}
void main ()
{ telephone t = new telephone();
t.input();
(f)______________________;
t.print();
}
}

(a)

  1. telephone
  2. class
  3. object

Solution

(1) telephone

(b)

  1. old
  2. new
  3. void

Solution

(2) new

(c)

  1. ob.nextDouble()
  2. ob.nextLine()
  3. ob.nextInt()

Solution

(3) ob.nextInt()

(d)

  1. noc< 100
  2. noc <=100
  3. noc <=100

Solution

(2) noc <=100

(e)

  1. bill=0+(noc-100)*2.50
  2. bill = (noc-100)*3.50
  3. bill = noc*2.50

Solution

(1) bill=0+(noc-100)*2.50

(f)

  1. t.input()
  2. t.calculate()
  3. t.print()

Solution

(2) t.calculate()




Question 9

The following program segment calculates the norm of a number, norm of a number is square root of sum of squares of all digits of the number.

Example:
The norm of 68 is 10
6×6 + 8×8 = 36+64 = 100 square root of 100 is 10.

Fill in the blanks with appropriate java statements.
void norm ( int n)
{ int d, s =(a)______;
while ( (b)_________)
{ d = n%10;
s = (c)________________;
n=n/10;
}
System.out.println(“Norm = “ + (d)_____________);
}

(a)

  1. 0
  2. 0.0
  3. 1

Solution

(1) 0

(b)

  1. n>0
  2. n < 0
  3. n>1

Solution

(1) n>0

(c)

  1. s+d*d
  2. s*d+d
  3. s*s+d

Solution

(1) s+d*d

(d)

  1. Math.sqrt(s)
  2. Math.SQRT(s)
  3. Math.sqrt(n)

Solution

(1) Math.sqrt(s)



Question 10

Read the paragraph given below and answer the questions given below.

Case study 1
Decision control statements are used to check for condition and execute the statements based
on the condition. The two decision control statements in java are if and switch, switch is also
called as multiple branching statement. An if statement within another if statement is termed
as Nested if Statement. Repetitive execution of a set of statements is termed as looping. The
two types of looping statements are entry controlled and exit controlled loops. Both while and
for are termed as entry-controlled loops. A for loop is used when the number of iterations is
known. A while is used when the set of statements are executed as long as the condition is true,
it is executed when the number of iterations are not known.

(a) What are the two decision control statements in java?

  1. if and switch
  2. for and while
  3. ternary and logical

Solution

(1) if and switch

(b) An if statement within another if statement is termed as

  1. Nested
  2. Nested while
  3. Nested if

Solution

(3) Nested if

(c) Name given for repetitive execution of set of statements.

  1. Looping
  2. Decision Control
  3. Assignment

Solution

(1) Looping

(d) Which one of the following does not execute even once?

  1. for(k = 1; k<=100;k++);
  2. for(k=10;k< 1;k++);
  3. for(k=1;k>=1;k++);

Solution

(2) for(k=10;k< 1;k++);



Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com