You are on page 1of 12

ST.

FRANCIS XAVIER SCHOOL


HALF YEARLY EXAMINATION
SESSION: 2021- 2022
COMPUTER APPLICATIONS
CLASS X
Maximum Marks: 50

Time allowed: One hour (inclusive of reading time)

ALL QUESTIONS ARE COMPULSORY

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


Upload the PDF form of the answer sheet in the Google Classroom.

Select the correct option from each of the following questions.


______________________________________________________________________________
SET- D
SECTION A (30 Marks)

Question 1

Choose the correct answer [1 x 5 =5]


a) What does the expression float c= 120/0 return?
1) 0
2) Infinity
3) 120
4) Run time exception

b) Which of the following is not a valid jump statement?


1) break
2) goto
3) continue
4) return

c) What is the number of bytes occupied by char data type?


1) 2 byte
2) 4byte
3) 8 byte
4) 16 byte

d) Arrange the operators given below in order of lower precedence to higher precedence:
i) || ii) ++ iii) % iv) ( )

1) (iv), (ii),(iii), (i)


2) (iii), (i),(ii), (iv)

Page 1 This paper consists of 12 pages.


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

5) From where break statement causes an exit?


1) Only from innermost loop
2) Terminates a program
3) Only from innermost switch
4) From innermost loops or switches.

Question 2

Fill in the blanks with the correct option. [1 x 5 =5]

a) A ____________ has no return type.


1) Constructor
2) Method
3) Operators
4) Variables

b) ____________ is the ability of a method or an object to take on multiple forms.

1) Abstraction
2) Inheritance
3) Polymorphism
4) Function

c) _____________ is a default value of Boolean data type.

1) True
2) false
3) 0
4) 1

d) _____________ Operators operate only on Boolean operands.

1) Relational
2) Logical
3) Arithmetic
4) Increment

e) ____________ are symbols used for grouping or separating the code.

1) Operators
2) Separators
3) Escape sequence

Page 2 This paper consists of 12 pages.


Question 3

Solve the following


[2 x 5 =10]
a) Find the output:

int i=5;
while(i<=8)
{
System.out.print(i+ “ “);
i++;
break;
}
System.out.println(i);

1) 5 4
2) 5 6
3) 5 5
4) None of the above

b) Write the output of the given code snippet:


int i = 1, j=7;
while(i++ <= - - j)

{
i++;
System.out.print(i + " " );
}
System.out.print(i);

1) 3 5 7 9 10
2) 5 7 9 10
3) 3579
4) 5 7 9 10 11

c) What will be the output of the following code?


int x=1, i=1;
while (i++ <5)
{
if (i==2)
continue;
x*=i;
}System.out.println(x);

Page 3 This paper consists of 12 pages.


1) 120
2) 60
3) 30
4) 40

d) What will be the output of the following program snippet?


int x = 1000, y =9, z = 5;
do
{
x = x/y;
z= z++ + 1;
}while (y<=x);
System.out.println(“Value of z is “ +z);
1) Value of z is 8
2) Value of z is 6
3) Value of z is 7
4) Value of z is 9

e) Find the output:


int a=10, x=7;
do {
a++;
x+=2;
} while (a%x>0);
System.out.println(a+ “\t” +x);

1) 14 13
2) 13 13
3) 12 13
4) 13 14

Question 4

Give the output of the following [1 x 5 =5]

a) If (( -7 >-9) | | (12<=10))
1) True
2) False

b) S* = S ++ + --S / 2 - ++S + (-S); [S= -3]

1) Value of S is 10
2) Value of S is 0
3) Value of S is 2

Page 4 This paper consists of 12 pages.


4) Value of S is 20

c) switch (cc)
{
case 4: System.out.print(“SEMESTER”);

case 6: System.out.print( “EXAMINATION”);

case 7: System.out.print(“2021”);
break;
}
Where cc=4;

1) SEMESTER
2) SEMESTER EXAMINATION
3) SEMESTER EXAMINATION 2021
4) 2021

d) Char ch= „D‟;


intans= ch + 5;

What will be the value of ans?

1) 72
2) 74
3) 73
4) None of the above

e) char answer = ((75%7 > =5) ? „Y‟ : „N‟;


1) Y
2) N
3) YN

Question 5

Answer the following [1 x 5 =5]

a) State the output of the following:


System.out.printl (“FOUR TWO ” +4 +2);
System.out.println(“ four” +(2 + 2));

1) FOUR TWO 42
Four 22
2) FOUR TWO42four4

Page 5 This paper consists of 12 pages.


3) FOUR TWO 6four4
4) None of the above

b) A java statement to define the variable name “charge” as constant of double data type
having value 33.24.
1) float charge = 33.24;
2) const double charge= 33.24;
3) final Double charge= 33.24;
4) final double charge= 33.24;

c) State the types of errors present in the statement:


switch((c+n) > 2)
1) Syntax error
2) Runtime error
3) Logical error

d) Find the answer:


System.out.println(Math.floor( 13.8 ));
1) 14
2) 14.0
3) 13.0
4) 13

e) double x = Math.abs(Math.ceil(-6.39));
1) -6.00
2) 6.00
3) -7.00
4) 7.00

SECTION B (20 MARKS)

Question 6

The following program is based on the specification as given below. Fill in the blanks with
appropriate java statements.
Instance variables/data members:
int days – to store the number of days the bike is taken on rent
int charge – to calculate and store the rental charge
Member methods:
void input( ) – to input and store the detail of the customer.
void computer( ) – to compute the rental charge.
The rent for a motorbike is charged on the following basis.
First five days Rs 500 per day;
Next five days Rs 400 per day
Rest of the days Rs 200 per day

Page 6 This paper consists of 12 pages.


void display ( ) – to display the details in the following format:
Bike No. PhoneNo. No. of days Charge

import java . util. Scanner;


class Mobike
{
intbno, days, charge;

void input ( )
{
Scanner obj= new Scanner(System.in);
System.out.println(“ ENTER NUMBER OF DAYS “);
days= ____1_____ = nextInt( );
}

void compute ( )
{
if ( 2 )
charge= 500 * days;

else if( days <= ___3___)


charge= ________4__________ ;

else
charge= _______5___________;
}

void display( )
{
System.out.println(“ NUMBER OF DAYS THE BIKE IS RENTED IS “ +days);
System.out.println(“ THE CHARGE IS “ +charge);
}

1) [1]
a) sc
b) obj
c) ob
d) scan
2) [1]
a) days<4
b) days<=5
c) days <6
d) days <3
3) [1]

Page 7 This paper consists of 12 pages.


a) 8
b) 10
c) 7
d) 9
4) [1]

a) 2500+(days-4) * 400;
b) 2000+(days -5 ) * 400;
c) 2500 +(days – 5)* 400
d) None of the above
5) [1]
a) 2500 + 2000+ (days-10) *200;
b) 250 + 2000+ (days-10) *200;
c) 2500 + 2000+ (days-9) *200;
d) None of the above

Question 7

a) Given below is a class with the following specification:


Class name:Student

Instance variables:
intro;
String name;
Member methods:

Student(int roll )- to store the roll and marks of the student


Student(intro,String nm) – to store the roll and marks of the student

Fill in the blanks of the program with appropriate java statements:

class (1)_________________
{

intro;
String name;

Student(int roll )
{
____2_ = roll;
name=” ROHIT”;
}

Page 8 This paper consists of 12 pages.


Student(intro,String nm)
{
___________3 = ro;
name=nm;

}
void print( )
{
System.out.println(“ ROLL IS “ +roll + “\t “ +”NAME IS “ + name);
}
public static void main(String args [ ])
{
Studentob = new __________4;
ob. _____5____;
Student ob1= new Student(33,” RITAM”);
ob1.print( );
}
}

1) [1]
a) Student
b) Students
c) student
2) [1]
a) lroll
b) ro
c) roll.l
3) [1]
a) this.ro
b) this.ROLL
c) roll
4) [1]
a) Student(7);
b) Student(21.6,4.6);
c) Area (44)
5) [1]
a) print( );
b) Prints( );

Page 9 This paper consists of 12 pages.


Question 8

Given below are the methods defined inside a single class with the following specification:

i) double area (int a , int b, int height) – with three integer arguments , returns the area of a
trapezium using the formula:
area= 0.5 * height * (a+b)
ii) void area1 (double diagonal1 , double diagonal2) – with two double arguments , returns the area
of a rhombus using the formula:
area = 0.5 *( diagonal1 * diagonal2)
Create a main method to call the above defined methods.

class Calculate
{

double area( int a, int b, int height)


{
intarea_t = 0.5 * height * (a+b);
______1_______ area_t;

}
void area (double diagonal1 , double diagonal2)
{

doublearea_r = 0.5 *( _______2_______);


System.out.println(“ THE AREA IS : “ +area_r);
}

public static void main (String args[])


{
_____3_____ ob= new Calculate( );
ob._________4____________;
ob._______5_____( 7.98, 8.09);
}
}

Page 10 This paper consists of 12 pages.


1) [1]
a) System.out.println( );
b) return
c) print( );

2) [1]
a) d1 *d2
b) diagonal1 * diagonal2
c) diagonal1 / diagonal2

3) [1]
a) Calculate
b) Calculation
c) Calculating
4) [1]

a) area( 6,8, 9);


b) areas( 6,8, 9);
c) area( 6.9,8, 9);

5) [1]
a) Area
b) area

Question 9

The following program is written to input a number and check and print whether it is a
Pronic number or not. (Pronic number is the number which is the product of two
consecutive integers)
Examples : 12 = 3 × 4 .
20 = 4 × 5
42 = 6 × 7

Fill in the blanks with appropriate java statement.

import java.util. ____1_____;


class Pronic
public static void main(String args[ ])
{
Scanner sc = new Scanner(System.in);
System.out.print(“Enter the number: “);
int n = sc.______2____();
int i = 0;
while(_____3_____) < n)

Page 11 This paper consists of 12 pages.


{
i++;
}
if______4________== n)
{
System.out.println(n + ” is a Pronic Number.”);
}
______5________
{
System.out.prindn(n + ” is not a Pronic Number.”);
}
}
}
1) [1]

a) Scanner
b) BufferedReader
c) Scan
d) Scans

2) [1]
a) nextint( );
b) nextInt( );
c) nextInteger( );
3) [1]

a) i
b) i + (i + 1)
c) x

4) [1]

a) i*(i+1)
b) i+(i*1)
c) i+1

5) [1]
a) else
b) else if
c) if
--------------------------------------------------------------------------------------------------------------------

Page 12 This paper consists of 12 pages.

You might also like