Code is copied!
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?
- /* comment */
- /* comment
- // comment
- */ comment */
- (i) & (iii)
- (i) & (ii)
- All of the above
- 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.
- &&
- %
- >=
- ++
- (iv), (i), (iii), (ii)
- (iv), (iii), (ii), (i)
- (iv), (ii), (iii), (i)
- (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?
- new
- public
- class
- 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));
- 9.0
- 7.0
- 6
- 7
Solution
(2) 7.0
(e)
Name the type of error in the statement given below.
int r=100/0;
- Syntax
- Runtime
- Logical
- None of the above
Solution
(2) Runtime
Fill in the blanks with the correct option
(a) The _____________ allows a class to use the properties and methods of another class.
- Inheritance
- Polymorphism
- Encapsulation
- None of the above
Solution
(1) Inheritance
(b) The number of bytes occupied by char data type is __________byte/s
- 4
- 8
- 2
- None
Solution
(3) 2
(c) The _________ is called an instance of a class.
- Object
- Attributes
- State
- None
Solution
(1) Object
(d) The ____________ are the words which have special meaning.
- Keywords
- Identifier
- Methods
- Package
Solution
(1) Keywords
(e) Method that accepts a string without any space is ______.
- next()
- nextLine()
- nextInt()
- None of the above
Solution
(1) next()
Name the following
(a) The keyword to make a variable as a class variable.
- static
- Static
- final
Solution
(1) static
(b) Intermediate code obtained after compilation.
- Source code
- Byte Code
- 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.
- Constructor
- Function
- Method
Solution
(1) Constructor
(d) The statement to stop the execution of a construct.
- System.exit(0)
- break
- STOP
Solution
(2) break
(e) Invoking a method by passing the objects of a class is termed as.
- Call by value
- call by reference
- call by method
Solution
(2) call by reference
State True Or False
(a) byte is a non - primitive data type.
- True
- False
Solution
(2) False
(b) !(2>3&&4>6)
- True
- False
Solution
(1) True
(c) Scope of local variable is within a class.
- True
- False
Solution
(2) False
(d) The default statement is optional in switch- case.
- True
- False
Solution
(1) True
(e) The assignment operator(=) is left associative.
- True
- False
Solution
(2) True
Choose the odd one
(a)
- Encapsulation
- Data abstraction
- Portable
- Polymorphism
Solution
(3) Portable
(b)
- >
- ==
- &&
- <
Solution
(3) &&
(c)
- return
- break
- continue
- System.exit(0)
Solution
(4) System.exit(0)
(d)
- int
- double
- char
- String
Solution
(4) String
(e)
- +
- %
- /
- ||
Solution
(4) ||
Give the output of the following
(a) x + = x++ + ++ x + --x + x; [ x = 5 ]
- 29
- 28
- 26
Solution
(1) 29
(b)
if ( a > b )
System.out.println(a+b);
System.out.println (a*b); when a = 5 and b = 7
- 12, 35
- 35
- 35, 12
Solution
(2) 35
(c) String x = (a >= 90) ? "excellent" : "best"; when a = 90
- best
- excellent
- 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
- Discipline
- Dedication
- 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?
- Loop is executed 2 times and the output is 100
- Loop is executed 3 times and the output is 10
- 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)
- OVERLOAD
- overload
- class
Solution
(2) overload
(b)
- k = 1;
- k = n;
- k = 0
Solution
(1) k = 1;
(c)
- k<=n;
- k>=n;
- k+n;
Solution
(1) k<=n;
(d)
- k+=2;
- k+=5;
- k++;
Solution
(3) k++;
(e)
- int n
- double n
- char n
Solution
(1) int n
(f)
- if (n%m == 0)
- if (m%n==0)
- 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)
- telephone
- class
- object
Solution
(1) telephone
(b)
- old
- new
- void
Solution
(2) new
(c)
- ob.nextDouble()
- ob.nextLine()
- ob.nextInt()
Solution
(3) ob.nextInt()
(d)
- noc< 100
- noc <=100
- noc <=100
Solution
(2) noc <=100
(e)
- bill=0+(noc-100)*2.50
- bill = (noc-100)*3.50
- bill = noc*2.50
Solution
(1) bill=0+(noc-100)*2.50
(f)
- t.input()
- t.calculate()
- 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)
- 0
- 0.0
- 1
Solution
(1) 0
(b)
- n>0
- n < 0
- n>1
Solution
(1) n>0
(c)
- s+d*d
- s*d+d
- s*s+d
Solution
(1) s+d*d
(d)
- Math.sqrt(s)
- Math.SQRT(s)
- 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?
- if and switch
- for and while
- ternary and logical
Solution
(1) if and switch
(b) An if statement within another if statement is termed as
- Nested
- Nested while
- Nested if
Solution
(3) Nested if
(c) Name given for repetitive execution of set of statements.
- Looping
- Decision Control
- Assignment
Solution
(1) Looping
(d) Which one of the following does not execute even once?
- for(k = 1; k<=100;k++);
- for(k=10;k< 1;k++);
- 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