Read the questions as text
ICSE Class 10 Sample Paper 3 (MCQ)
Q1. What are the default values of the primitive data types int and float ?
a) default value of int is 1 and that of float is 0.0d b) default value of int is 0 and that of float is 0.0f c) default value of int is 0 and that of float is 1.1f
Q2. Select the correct definition of the term Byte code.
a) It is a machine instruction that can be interpreted and executed only by a Java processor called the JVM.
b) It converts the high-level instructions, line by line, into machine language. c) It is the high-level code that is generated by the programmer.
Q3. break, continue, return are the 3 jump statements in Java. State true or false
a) true b) false
Q4. Which of the following are valid comments?
(i) /* comment */ (ii) /* comment (iii) // comment (iv) */ comment */
a) (i) & (iii) b) (i) & (ii) c) All of the above d) None of the above
Q5. 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. (BUBCLTA)
(i) || (ii) % (iii)<= (iv) - -
a) (iv), (i), (iii), (ii) b) (iv), (iii), (ii), (i) c) (iv), (ii), (iii), (i) d) (i), (ii), (iii), (iv)
Q6. String x = (age>= 18) ? "can vote" : "cannot vote"; when a = 19
a) can vote b) cannot vote c) can vote cannot vote
Q7. int x=5; while (x>10) { x=x*5; } System.out.println(x);
How many time the loop is executed and what is the output?
a) Loop is executed 2 times and the output is 125 b) Loop is executed 0 times and the output is 5 c) Loop is executed 3 times and the output is 625
Q8. What is the result stored in x, after evaluating the following expression : int x = 5; x=x++*2+3* – -x;
a) 17 b) 25 c) 27
Q9. Non-static variables take different values with each object/instance. State True or False.
a) True b) False
Q10. What will be the output of the following code: int m=2; int n=15; for(int i = 1; i<5; i++); m++; –-n; System.out.println(“m=”+m); System.out.println(“n-”+n);
a. m=3 n=14 b. m=6 n=11 c. m=6 n=14
Q11) Give the prototype of a function check which receives a character ch and an integer n and returns true or false.
a) false check(char ch, int n) b) true check(char ch, int n) c) boolean check (char ch, int n)
Q12) This keyword is used to import the source code already designed and kept under some package in the form of a class.
a) import b) void c) public
Q13) What are the types of casting shown by the following examples? double x = 15.2; i) int y = (int)x; ii)int x = 12; long y = x;
a) i) implicit ii) explicit b) i)explicit ii)implicit c) i)explicit ii)explicit
Q14) State whether the following is True or False The continue statement transfers the control out of the loop body and thus stops the loop iteration.
a) True b) False
Q15) How many times will the following loop execute? What value will be returned? int x = 2, y = 50; do{ ++x; y-=x++; }while(x<=10); return y;
a) The loop will execute 4 times. The value returned will be 26. b) The loop will execute 5 times. The value returned will be 15. c) The loop will execute 0 times. The value returned will be 50.
Q16) Name the methods of the Scanner class that: i) Is used to input an integer from standard input stream ii) Is used to input a string data from standard input stream
a) i) nextInt() ii) next() and nextLine() b) i) isNextInt() ii)next() and nextLine() Q17) Name the primitive data type in Java that is a 64-bit integer and is used when you need a range of values wider than those provided by int.
a) long b) double c) byte d) int
Q18) Name the primitive data type in Java that is a single 16-bit Unicode character whose default value is ‘\u0000'
a) String b) char c) int
Q19) Arrange the following operators in the order of their precedence form higher to lower (i) < (ii) + (iii) ++ (iv) && (BUBCLTA)
a)++ , + , < , && b) && , + , < , ++ b))++ , < , + , &&
Q20) Related classes are grouped together as a
a) method b) package c) object
Q21) This is a loop whose body executes continuously.
a) Infinite loop b) Finite loop
Q22) List the variables from those given below that are composite data types. (i) static int x; (ii) obj.display(); (iii) boolean b; (iv) private char chr; (v) String str;
a) (i),(iv),(v) b) (ii),(iv)(v) c) (ii),(v)
Q23) public class myClass
{ public static int x = 3, y = 4; public int a = 2, b = 3;
} Name the variables for which each object of the class will have its own distinct copy.
a) a and b b) x and y c) a and x
Q24) _________________is the name given to a variable, function or a class
a) literal b) identifier c) separator
Q25) Identify the literals listed below : (i)0.5 (ii)’A’ (iii)false (iv)”a”
a) (i) Real (ii)character (iii)boolean (iv)String b) (i) double (ii)char (iii)boolean (iv)character c) (i) Real (ii)char(iii)boolean (iv)character
Q26) while() is an example of this type of loop.
a) Entry controlled- while(), for() b) Exit controlled- do…while()
Q27) What are the values of a and b after the following function is executed, if the values passed are 30 and 50 : void paws(int a,int b) //a=30,b=50 { a=a+b; // a=80 b=a-b; //b=30 a=a-b; //a=50 System.out.println(a+” , “+b);// 50 30 }
a) The value of a will be 30 and that of b will be 80 b) The value of a will be 50 and that of b will be 30 c) The value of a will be 80 and that of b will be 30
Q28) The access specifier that gives most accessibility is and the least accessibility is
a) public , private b) protected , private c) public , protected Q29) Name the package that contains the Scanner class
a) java.util b) java.io c) java.lang
Q30) Write the output of the following code segment : char ch; int x = 97; do
{ ch = (char)x; System.out.print(ch+” “); if(x%10==0) break; ++x; } while(x<=100);
a) a c b) a b c d c) b d
Q31) If int y = 10 then find int z = (++y*(y++ +5)); a)
a. 176
b. 187
c. 190
Q32) Name the 4 OOPs principles
a) Abstraction, Encapsulation, Polymorphism, Inheritance b) Class, Object, Variables and Functions c) Abstraction, Class, Polymorphism, Data
Q33) Binding up of data and associated functions together into a single unit called (class) is called:
a) Abstraction b) Encapsulation c) Polymorphism d) Inheritance
Q34) Name the type of error for the following: int a;b;c;
a) Syntax b) Logical c) Runtime Q35) (b) What are the types of casting shown by the following examples: (i) char c = (char)120; (ii) int x = ‘t’;
a) (i) primitive (ii) reference b) (i) implicit (ii) explicit c) (i) explicit (ii) implicit
Q36) Select the correct answer: switch ( m ) { case 'a' : System.out.println("Computer"); case 'b' : System.out.println ("Applications"); break; case 'c' : System.out.println("Computer Science"); default : System.out.println("Wrong Input"); }
when m='c'
a) Computer Applications
b) Computer Science Wrong Input
c) Computer Science
Fill in the blanks in the Programs Q37) Shasha Travels Pvt. Ltd. gives the following discount to its customers: Ticket amount Discount Above Rs 70000 – 18% Rs 55001 to Rs 70000 – 16% Rs 35001 to Rs 55000 – 12% Rs 25001 to Rs 35000 – 10% less than Rs 25001 – 2% Write a program to input the name and ticket amount for the customer and calculate the discount amount and net amount to be paid. Display the output in the following format for each customer :
SL.NO. Name Ticket charges Discount Net amount 1
-
-
-
-
-
-
(Assume that there are 15 customers, first customer is given the serial no (SlNo.) 1,
next customer 2 … and so on.
Fill in the blanks of the given program with appropriate java statements –
import java.util.Scanner;
public class Travels
{ public static void main()
{
int sno , tAmount , discountPercentage = 0;
String name;
double discount, netAmount;
Scanner kb = new Scanner(System.in); System.out.print("Enter serial no.: "); sno =
kb.(a) ; System.out.print("Enter name: ");
name = kb.next(); System.out.print("Enter
ticket amount: "); tAmount = kb.nextInt();
if(tAmount > (b)
)
{ discountPercentage = 18;
} else if(tAmount >= 55001 && tAmount <= 70000)
{
discountPercentage = 16;
}
else if(tAmount >= 35001 && tAmount <= 55000)
{
discountPercentage = 12;
} else if (tAmount >= 25001 && tAmount <= 35000)
{
discountPercentage = 10;
}
else if (tAmount < 25001)
{ discountPercentage = 2;
}
discount = c)
* tAmount / 100.0;
netAmount = tAmount - discount;
System.out.println("Sl. No.\t Name \t Charges \t Discount \t Net Amount");
System.out.println(sno + "\t" + name +"\t" + tAmount + "\t" + discount + "\t" +
netAmount);
}
}
a) 1. .nextInt() 2. .nextFloat() 3. .nextLine()
b) 1. 25000 2. 55000 3. 70000
c) 1. discountPercentage 2. Discount 3. tAmount
Q38) Write a Program to print the following series: 2,
5, 10, 17, 26
n terms */
import java.util.*;
class prog14
{
public static void main()
{
Scanner sc=new Scanner(System.in); int
i, p, n;
System.out.println("Enter a number");
n=(a)
();
for(i=1; (b)
; i++)
{
p=(c)
;
System.out.print(p+",");
}
}
}
a) 1. sc .nextInt() 2. sc.nextFloat() 3. sc.nextLine()
b)
1. i<n
2. i=n
3 i<=n
c) 1. I*i-1 2. i+1 3. i*i+1
Q39) Write a Program to print the given fibonacci series: 1,1,2,3,5,8,13,21,34,55, class fibonacci1 {
public static void main() {
int m=1, n=1,p,i;
for((a)
;(b)
; i++)
{
p=m+n; System.out.print(m+",");
(c)
;
n=p;
}
}
}
a) 1. i=3 2. i=1 3. i=2
b) 1. i<10 2. i=10 3 i<=10
c) 1. m=n
2. m=p 3. m=1
Q40) Write a Program to input a number. Check and print whether it is
an armstrong number or not. A number is said to be an armstrong number if sum of the cube of each digit is equal to the given number. eg: 153 import java.util.*; class arm {
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter any number"); int
n=sc.nextInt();
int d, s=(a)
, n1=n;
while(n>0)
{
d=(b); s=s+d*d*d; n=n/10; }
if((c) )
System.out.println("It is an Armstrong number"); else System.out.println("It is not an Armstrong number");
}
}
a)1. 0
2. 1
3. 2
b) 1. n/10 2. n%10 3. n*10
c) 1. s==n1 2. s==n 3. s==d
Q41)
Write a Program to input a number. Check and print whether it is a neon number or not. A number is said to be a neon number if the sum of the digits of the square of a number is equal to the given number (eg 9 : 9* 9 = 81 and 8+1=9)
import java.util.*; class neon {
public static void main()
{
Scanner sc=new Scanner(System.in); System.out.println("Enter any number"); int n=sc.nextInt();
int d, sq=(a) while(sq>0) {
, s=0;
d=(b) s=s+d; sq=sq/10;
%10;
}
if((c)
)
System.out.println("The number is a neon number"); else System.out.println("The number is not a neon number");
} }
a) 1. n*n 2. n+n 3. n+1
b) 1. sq+10 2. sq%10 3. sq*10
c) 1. s==n 2. s==sq 3. s==d
――――――――――
ICSE Class 10 Sample Paper 4
SECTION A (30 Marks)
Q I. Choose the correct answer:
10X1=10
1.Which language does the CPU understand?
a. Machine language
b. High level language
c. Assembly language
d. English language
2. What is the extension of a java source code file?
a. .java
b. .class
c. .txt
d. .bluej
3. Choose the correct statement.
a. Applets can be executed in web browser only
b. Applets can be executed in an applet viewer only
c. Applets can be executed in both web browser and applet viewer.
d. Applet cannot be executed
4. Suppose you compile the class CoolClass. What will be the name of the
Bytecode file?
a. CoolClass.java
b. CoolClass.class
c. CoolClass.byte
d. CoolClass.int
5. While declaring the main method, which keyword comes first?
a. Class
b. Keyword
c. Public
d. Main
6. Which of the following is not a token?
a. Keyword
b. Operator
c. Identifier
d. Procedure
7. Which of the following is not a legal identifier?
a. _room
b. 10thClass
c. $PayAmount
d. nullValue
8. which of the following is an invalid integer?
a. 5555
b. 555 55
c. 55555
d. 555
9. Which of the following is not a primitive data type in java?
a. boolean
b. float
c. short
d. class
10. what is the size of a long data type in java?
a. 32 bits
b. 48 bits
c. 64 bits
d. Long data type is not supported in java
Q II. Fill in the blanks with correct option:
10X1=10
1. A program that translates code written in a high level language into machine
code is called _______ a. Assembler b. Compiler c. Linker d. None of these
2. Java can be used to write _______ a. Stand-alone applications only b. Internet applications only c. Both stand-alone and internet applications d. None of these
3. A java program can run as a stand-alone application only if it has _____ a. a void method b. a main method c. an overloaded method d. no methods
4. A set of instructions written in a high-level programming language is called _____ a. Object code b. Byte code c. Source code d. All of these
5. ASCII is ______ a. 6-bit set of codes b. 7-bit set of codes c. 8-bit set of codes d. 16-bit set of codes
6. The ASCII codes of A-Z are represented by decimal range ______ a. 65-90 b. 97-122
c. 66-91 d. 98-123 7. ______ characters are represented by ASCII character set. a. 27=128 characters b. 102 = 128 characters c. 82 = 127 characters d. 162=130 characters 8. All characters in a java program are grouped into symbol called ______ a. new b. keyword c. tokens d. operators 9. Keywords are also known as ______ words a. Literal words b. Reserved words c. Integer d. Methods 10. Single line comments can be added using ______. a. // b. \\ c. /* */ d.Both a and b
Q III. State whether the given statements are true or false: 1.Java compiler is used to compile your code. a. True b. False 2. Ctrl+D key is used to delete the pre-written code already in it.
5X1=5
a. True b. False 3. Java offers five types of tokens. a. True b. False 4. Default value of char data type is ‘\u0000’ a. True b. False 5. A variable can be used in a Java program even if it has not been declared. a. True b. False
Q IV. Name the Size and Range for the following: 1. What is the size of short data type in java? a. 16 bits (2 bytes) b. 16 bits (1 bytes) c. 16 bits (3 bytes) d. 16 bits (4 bytes) 2. What is the size of int data type in java? a. 32 bits (3 bytes) b. 32 bits (1 bytes) c. 32 bits (4 bytes) d. 32 bits (0 bytes)
5X1=5
3. What is the size of double data type in java? a. 64 bits (4 bytes) b. 64 bits (8 bytes) c. 64 bits (2 bytes)
d. 64 bits (1 bytes) 4. What is the range of byte data type in java?
a. -128 to 127 b. -32768 to 32767 c. -2147483648 to 2147483647 d. None of the mentioned 5. What is the range of char data type in java? a. 0-65535 b. 0-45335 c. 0-23535 d. All of these
SECTION B (20 Marks) Q V. Choose the valid option for the following:
1. Which one is a valid identifier in Java? a. total amount b. total_percentage_% c. total amount d. total_amount_$
2. Which one is a valid integer literal? a. 1455 b. 67 678 c. $565 d. 876, 456
3. Which one is a valid real literal? a. 67.E7 b. 55.5E c. .23E7
4X1=4
d. $3E7 4. Which one is a valid string literal?
a. “KIPS” b. ‘COMPUTER’ c. Z+ ‘COMPUTER’ d. ‘K’I’P’S
Q VI. Choose the odd one: 1. a. Machine language b. Assembly language c. Java language d. High-level language 2. a. Windows b. Byte code c. Unix d. Macintosh 3. a. final b. Public c. Class d. Unicode 4. a. + b. – c. % d. << 5. a. byte b. long c. int d. non-primitive
5X1=5
Q VI. Give the output for the following:
5X1=5
1. System.out.println(“Incredible” + “\n” + “world”;
a. Print
b. ln
c. incredible
d. world
2. What is the result of evaluating the following expression?
(3+6*7)/3+2
a. 24
b. 17
c. 20
d. 19
3. What is the result stored in x, after evaluating the following expression?
int x=5;
x = x++ *2+3*--x;
a. 30
b. 40
c. 25
d. 51
4. public class prefixIncrement
{
public static void main(String args[])
{
int y =15;
int z = ++y;
System.out.println(“Y: “ + Y);
System.out.println(________);
a. “y=15”
b. “z: “ + z
c. z+y
d. z=++y
5. Identify the literals listed below:
i. 0.5
_______
4X1=4
ii. false
_______
iii. ‘A’
_______
iv. “a”
_______
a. boolean b. char c. string d. real 6. Arrange the following primitive data types in the ascending order 2X1=2 of their size. i. char
ii. byte
iii. double
iv. int
******************
――――――――――
ICSE Class 10 1st Practice Test (50 marks)
1st Practice Test 21-22 Grade: X Subject: COMPUTER APPLICATIONS
Duration:1 Hrs Marks: 50
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 (30 Marks)
Question 1
Choose the correct answer
[5×1]
a)
is the technique of binding both data and methods together to
keep them safe from unauthorized access and misuse.
1. Abstraction
2. Inheritance
3. Encapsulation 4. Polymorphism
b) Procedure Oriented Programming mainly uses ...........
1.Top-down approach
2. Top-down and bottom-up approach 3.Bottom-up approach 4. None of these
c) The smallest individual component in a program is called ........... 1. Token 2. Identifier 3. Keyword 4. Method d) The expression 4 + 8 % 2 gives the output
1. 6 2. 8 3. 4 4. None of these
e) Math.random () returns a double value r such that
1. 0.0 <= r < 1.0
2. 0.0 <= r <= 1.0 3. 0.0 < r <= 1.0 4. 0.0 < r < 1.0
Question 2
Fill in the blanks with the correct option (a) A class is ...........
1. An object factory
2. A blueprint to create objects
3. A specification for objects (b) The full form of JRE is ...........
4. All of these
1. Java Runtime Editor
2. Java Runtime Environment
3. Java Runtime Expression
4. Java Runtime Enabler
(c) Java applications can run on ........... 1. Windows platform 2. 2. Macintosh platform
3. UNIX platform
4. All of these
(d) Feature(s) of Java include ........... 1. robust 2. object oriented 3. 3. Secure 4. 4. All of these
(e) refers to the act of representing essential features without including the background details. 1. Abstraction 2. Inheritance 3. Encapsulation 4. Polymorphism
[5×1]
Question 3 Name the following (a) Name the logical operator from the given list
1. <
2. + +
[5×1]
3. &&
(b) Name the type of error ( syntax, runtime or logical error) in each case given below: (i) Math.sqrt (36 – 45) 1. Syntax Error
2. Logical Error
3. Runtime Error (c) The method with the same name as of the class and which does not have a
return datatype is called as 1. Constructor 2. Function 3. Method
(d) Name the primitive data type in Java that is :
A single 16-bit Unicode character whose default value is ‘\u0000’. 1. Float 2. String 3. char (e) Name the keyword which: indicates that a method has no return type. 1.return
2. void
3. break
Question 4 State True Or False
[5×1]
(a) The expressions 6 + 7 and "6" + "7" evaluate to the same value. 1. True 2. False
(b) Explicit type conversion is also known as coercion. 1.True 2. False
(c) Objects interact with each other through messages. 1. True 2. False
(d) The default statement is optional in switch- case. 1. True 2. False
(e) Identifiers in Java may be of any length. 1. True 2. False
Question 5 Choose the odd one
(a) 1.Public 2. : 3. , 4. {}
(b) 1. > 2. >= 3. || 4. <
(c) 1. Return 2. Break 3. Continue 4. System.exit(0)
(d) 1. Int 2. Float 3. Char 4. String
(e) 1. + 2. % 3. / 4. &&
[5×1]
Question 6
Give the output of the following (a) If a = 5, b = 9, calculate the valueof: a += a++ - ++b + a
1. 9 2. 12 3. 6
(b) What will be the output of the following code?
int size =2; if (size < 0) System.out.println("Small");
else if (size == 0) System.out.println("Medium");
else System.out.printIn("Large");
1. Small
2. Large
3. Medium c) What will be the output of the following code? int fruit = 3; switch (fruit + 1) { case 1: System.out.println("Banan a "); break ; case 2: System.out.println("Apple" ); break ; case 3: System.out.println("Orange"
[5 × 1]
); break ; default : System.out.println("Fruitless"); }
1. Orange
2. Banana
3. Apple
4.Fruitless
d) If x = 3, y = 7, calculate the value of:x -= x++ - ++y
1. 9 2. 13 3. 8
(e) public class PredictOutput1 { public static void main (String args[]) {
int a = 4, b = 2, c = 3; System.out.println("Output 1: " + (a = b * c)); System.out.println("Output 2: " + (a = (b * c))); } }
1. 6,6 2. 7,8 3. 9,12
Question 7
SECTION B (20 Marks)
Design a class overload a function area( ) as follows: (i) double area (double a, double b, double c) with three double arguments, returns the area of a scalene triangle using the formula:
area = ( − )( − )( − ), where S = a+b+c /2
(ii) double area (int a, int b, int height) with three integer arguments, returns the area of a trapezium using the formula: area = ½ height (a+b)
(iii) double area (double diagonal 1, double diagonal 2) with two double arguments, returns the area of a rhombus using the formula: area = ½ (diagonal1 x diagonal2)
Fill in the blanks of the given program with appropriate java statements –
class
a)
{
double area(double a, double b, double c) {
double s, r;
s=(a+b+c)/2
;
r=s*(s-a)*(s-b) *(s-c);
double ar =
b)
return ar;
}
double area(int a, int b, int height)
{
double ar=0.5*height*(a+b);
return
c);
}
double area (double diagonal1,
d))
{
double area=
e);
f) area;
}
(a)
1. OVERLOAD
2. overload
3. class
[1]
(b)
1. ar=Math.sqrt (r);
2. 2. area=Math.sqrt (r);
3. 3. ar= Math.sqrt (area);
(c) 1. area
2. Area
(d) 1. double diagonal1 (e) 1. double diagonal1 (f) 1. void
2. double diagonal2 2. double n 2. Return
[1]
3. ar [1]
3. int diagonal 2
[1]
3. (diagonal1*diagonal2)/2;[1]
3. return
[1]
Question 8 :
The following program is based on the specification given below. Fill in the blanks with appropriate java statements. class name : SalaryCalculation member variables : name (String type data) basicPay, specialAlw, conveyanceAlw, gross, pf, netSalary AnnualSal (All double type data)
Member methods : i. void input( ) -To input name of employee (name), basic salary (basicPay) and conveyance allowance (conveyanceAlw) As ` 1000.00 ii. void SalaryCal( ) - to calculate other allowances and salaries as given: specialAlw = 25% of basic salary. gross = basicPay + specialAlw + conveyanceAlw. netSalary = gross - pf. AnnualSal = 12 months netSalary. iii. void display( ) - to print the name and other calculations with suitable
heading void main ( ) – to create an object of the class and invoke the functions of
the class
class (a) { String name; double basicPay, specialAlw, conveyanceAlw, gross, pf, netSalary, AnnualSal Scanner ob = (b)Scanner(System.in);
void input( ) {
System.out.println(“Enter the name:”); name=sc. ;(c ) System.out.println(“Enter the basic pay:”); basicPay=sc.nextDouble(); conveyanceAlw=1000.00; }
void SalaryCal( )
{
specialAlw=
(d)
pf=10/100.0*basicPay;
gross = basicPay + specialAlw +conveyanceAlw;
netSalary=
; (e)
AnnualSal=12*netSalary;
} void display( ) {
System.out.println(“Name:”+name);
System.out.println(“Basic Pay:”+basicPay);
System.out.println(“Special Allwance:”+specialAlw);
System.out.println(“Conveyance allowance :”+conveyanceAlw);
System.out.println(“Gross:”+gross);
System.out.println(“Provident fund:”+pf);
System.out.println(“Net Salary:”+netSalary);
System.out.println(“Annual Salary:”+AnnualSal); } void main () {
SalaryCalculation ob=newSalaryCalculation();
ob.input();
ob.SalaryCal();
ob.
;
(f)
}
}
(a) 1. Telephone
2. Class
3. SalaryCalculation
[1]
(b) 1. old
2. new
3. void
[1]
(c) 1. ob.nextDouble() 2. ob.nextLine() 3. ob.nextInt()
[1]
(d) 1. 25/100.0*basicPay;
2.
25/1000.0*basicPay;
3. 25/100.0*gross;
[1]
(e) 1. gross-pf; 2. basicPay-pf
3. pay = *2.50
[1]
(f) 1. ob.display( ) 2. display( ) 3. OB.display( )
[1]
Question 9 A tech number has even number of digits. If the number is split in two equal halves, then
the square of sum of these halves is equal to the number itself. Write a program to generate and print all four-digit tech numbers. Example :
Consider the number 3025 Square of sum of the halves of 3025 = (30+25)2
= (55)2 = 3025 is a tech number.
Fill in the blanks with appropriate java statements.
import java.io.*; import java.util.*; class _ a)
{ public static void main()
{ int i, a, b, sum; String n; System.out.println(“Four Digits Tech Numbers are:”); for(i = b); i < _ c); _ d))
{ n = i +””; a = lnteger,parselnt(n.substring(0, 2)); b = Integer.parselnt(n.substring(2)); sum = (int) Math.pow ((a + b), 2); if (sum == i) System.out.println(i); } } }
(a) 1. TechNumber
2. Nu
3. numb
[1]
(b) 1. i = 10; (c) 1. i < 99; (d) 1. i--
2. i = 1000;
3. i=100;
[1]
2. i<999;
3. i<=9999;
[1]
2. i+=
3. i++
[1]
Question 10 Read the paragraph given below and answer the questions given below:Case study 1
Iterative process means repeating a set of actions a certain number of times to perform
some task. Loops in programming languages like Java enable us to repeat a single statement or a set of statements as long as the desired condition remains true. An entry-controlled loop checks the condition at the time of entry. Only if the condition is true, the program control enters the body of the loop. for and while loops are entry-controlled loops. An exit- controlled loop checks the condition after executing its body. If the condition is true, loop will perform the next iteration otherwise program control will move out of the loop. do- while loop is an exit-controlled loop.
(a) What are the two types of loops in java?
[1]
1. if and switch
2. for and while
3. ternary and logical
(b) Which process means to repeat a set of actions a certain number of times to perform some task. [1]
1. Nested
2. Iteration
3. Nested if
(c) If the condition is true, loop will perform the next iteration loop works [1]
1. for
2. While
3. do….while
(d) How many times the loop, for (i=1; ;i++), will execute, if there is no statement to
terminate the loop?
1. 1
2. 0
3. infinite
[1]
*******************
――――――――――
ICSE Class 10 Model Paper (80 marks)
CLASS : X
Maximum Marks: 80 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 (50 Marks)
Choose the correct answer 1. Which from the operators (%, (), &, &&) has highest precedence
B. & C. && D. ()
2. Class variables begin with a _______ keyword A. public B. static C. class D. private
3. ___________ class is in java.util package A. DataInputStream B. BufferedReader C. InputStream D. Scanner
4. Which of the following option leads to the portability and security of Java? A. Bytecode is executed by JVM B. The applet makes the Java code secure and portable C. Use of exception handling D. Dynamic binding between objects
5.Which of the following is not a Java features? A. Dynamic B. Architecture Neutral C. Use of pointers D. Object-oriented
6. What does the expression float a = 35 / 0 return? A. 0
COMP/X/SGC
This paper consists of 18 printed page
[50 X 1 = 50] A. %
Page 1
B. Not a Number C. Infinity D. Run time exception
7. Evaluate the following Java expression, if x=3, y=5, and z=10: ++z + y – y + z + x++ A. 24 B. 23 C. 20 D. 25
8. Which of the following for loop declaration is not valid? A. for ( int I = 99; I >= 0; I / 9 ) B. for ( int I = 7; I <= 77; I += 7 ) C. for ( int I = 20; I >= 2; - -I ) D. for ( int I = 2; I <= 20; I = 2* I )
9. Which keyword is used for accessing the features of a package? A. Package B. import C. extends D. export
10. What is the range of short data type in Java? A. -128 to 127 B. -32768 to 32767 C. -2147483648 to 2147483647 D. None of the mentioned
11. Which of these can not be used for a variable name in Java? A. identifier B. keyword C. identifier & keyword D. none of the mentioned
12. Which of these are selection statements in Java? A. if() B. for() C. continue D. break
13. Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
A. do-while B. while C. for D. none of the mentioned
14. What will be the output of the following Java program? Class selection_statements
{ Public static void main(String args[])
COMP/X/SGC
This paper consists of 18 printed page
Page 2
{ Int var1 = 5; Int var2 = 6; If ((var2 = 1) == var1) System.out.print(var2); Else System.out.print(++var2);
} }
A. 1 B. 2 C. 3 D. 4
15. Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?
A. break
B. return C. exit D. continue
16. Which of this statement is incorrect? A. switch statement is more efficient than a set of nested ifs B. two case constants in the same switch can have identical values
C. switch statement can only test for equality, whereas if statement can evaluate any type of boolean expression
D. it is possible to create a nested switch statements
17. What will be the output of the following Java program? Class comma_operator
{ Public static void main(String args[]) { Int sum = 0; For (int I = 0, j = 0; I < 5 & j < 5; ++I, j = I + 1) Sum += I; System.out.println(sum); }
} A. 5 B. 6 C. 14 D. compilation error
18. From where break statement causes an exit? a) Only from innermost loop b) Terminates a program c) Only from innermost switch
COMP/X/SGC
This paper consists of 18 printed page
Page 3
d) From innermost loops or switches
19. What is the order of precedence (highest to lowest) of following operators? 1. & 2. ^ 3. ?:
a) 1 -> 2 -> 3 b) 2 -> 1 -> 3 c) 3 -> 2 -> 1 d) 2 -> 3 -> 1
20. What will be the output of the following Java code? Class operators
{ Public static void main(String args[]) { Int var1 = 5; Int var2 = 6; Int var3; Var3 = ++ var2 * var1 / var2 + var2; System.out.print(var3); }
} a) 10 b) 11 c) 12 d) 56
21. What will be the output of the following Java code? Class Output {
Public static void main(String args[]) {
Int x=y=z=20;
} }
a) compile and runs fine b) 20 c) run time error d) compile time error
22. What is the prototype of the default constructor of this Java class?
Public class prototype { } a) prototype( ) b) prototype(void) c) public prototype(void)
… (see the PDF for the full paper)