Saturday, 16 June 2018

Bhawani Model Question Paper for Std X first term 2018 SET No 2


Section A
[Answer all Questions]
  1. State the Java concept that is implemented through:
i)                     A super class and a subclass.
ii)                   The act of representing essential features without including background details.
2.       State the package that contains the class :
(i)  BufferedReader
(ii)  Scanner
3.       Find the output of the following program segment, when:
i) val = 500 ii) val = 1600
        int val, sum, n=550;
        sum = n + val > 1750 ? 400 : 200;
        System.out.println(sum);
  1. What is the output of the following?
i) System.out.println ("four :" + 4 + 2);
ii) System.out.println ("four :" + (2+2));
5.       What is the data type that the following library functions return?
i) isWhitespace(char ch)
ii) Math.random()
  1. Identify the statements listed below as assignment, increment, method invocation or object creation statements.
(i) System.out.println(“Java”);
(ii) costPrice = 457.50;
(iii) Car hybrid = new Car();
(iv) petrolPrice++;
  1. Arrange the following primitive data types in an ascending order of their size:
(i) char (ii) byte  (iii) double   (iv) int
8.       Rewrite the following using ternary operator :
if(x%2 == 0)
System.out.print(“EVEN”);
else
System.out.print(“ODD”);
9.       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);
  1. Study the method and answer the given questions.
public void sampleMethod()
{ for( int i=0; i<3; i++ )
{ for( int j=0; j<2; j++)
{ int number = (int)(Math.random() * 10);
System.out.println(number); } } }
(i) How many times does the loop execute?
(ii) What is the range of possible values stored in the variable number?
  1. Convert following do-while loop into for loop.
int i=1;
int d=5;
do{
d=d*2;
System.out.println(d);
i++;
}while(i<=5);
  1. Differentiate between Binary Search and Linear Search.
13.    If int n[] ={1, 2, 3, 5, 7, 9, 13, 16} what are the values of x and y? [2]
x=Math.pow(n[4],n[2]);
y=Math.sqrt(n[5]+[7]);
14.    Write a statement each to perform the following task on a string:
                                 i.         Extract the second last character of a word stored in the variable wd.
                                ii.         Check if the second character of a string str is in uppercase.
15.    State  the output when the following program  segment is executed :
String  a="Smartphone", b="Graphic Art";
String h=a.substring(2,5);
String k= b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h)) ;
16.    State the method that:
                                                               i.      Converts a string to a primitive float data type
                                                              ii.      Determines if the specified character is an uppercase character

Section B
[Answer any four Questions]
1.       A oblong number, is a number which is the product of two consecutive integers, that is, n(n + 1).
Few oblong numbers are:
2 =1x2
6 =2x3
12 =3x4
Accept a number and check whether it is an oblong number or not

2.       An electronics shop has announced the following seasonal discounts on the purchase of certain items.
Purchase Amount in Rs.
Discount on Laptop
Discount on Desktop PC
0-25000
0.0%
5.0%
25001 – 57000
5.0%
7.5%
57001 – 100000
7.5%
10.0%
More than 100000
10.0%
15.0%
Write a program based on the above criteria, to input name, address, amount of purchase and the type of purchase (L for Laptop and D for Desktop) by a customer. Compute and print the net amount to be paid by a customer along with his name and address.
(Hint: discount = (discount rate/100)* amount of purchase
Net amount = amount of purchase – discount)

3.       The annual examination results of 50 students in a class are tabulated as follows.
Roll no. Subject A Subject B Subject C
Write a program to read the data, calculate and display the following:
         Average marks obtained by each student.
         Print the roll number and average marks of the students whose average mark is above 80.
         Print the roll number and average marks of the students whose average mark is below 40.

  1. The International Standard Book Number (ISBN) is a unique numeric book identifier which is printed on every book. The ISBN is based upon a 10-digit code. The ISBN is legal if 1*digit1 + 2*digit2 + 3*digit3 + 4*digit4 + 5*digit5 + 6*digit6 + 7*digit7 + 8*digit8 + 9*digit9 + 10*digit10 is divisible by 11.
    Example: For an ISBN 1401601499
    Sum =1*1 + 2*4 + 3*0 + 4*1 + 5*6 + 6*0 + 7*1 + 8*4 + 9*9 + 10*9 = 253 which is divisible by 11.
    Write a program to:
Input the ISBN code as a 10-digit number
If the ISBN is not a 10-digit number, output the message  Illegal ISBN  and terminate the program
If the number is 10-digit, extract the digits of the number and compute the sum as explained above. If the sum is divisible by 11, output the message Legal ISBN. If the sum is not divisible by 11, output the message Illegal ISBN.

5.       Write a program to input an integer array A[] of n size. Sort the array in ascending order. 
Then input another number from the user and replace all the numbers less than that inputted number by their reverse.
Example       :
If A[] = {38, 25, 16, 91, 5, 12} then, array after sorting is {5, 12, 16, 25, 38, 91} 
If the number entered = 20 then, after replacing all the numbers less than 20 with their reverse,
final Output is {5, 21, 61, 25, 38, 91}

6.       Write two separate programs for
a.        Write a java program to input a string and print frequency of each character of the string.
Example  Input  :  COMPUTER APPLICATION
OUTPUT
A occurs 2 times
C occurs 2 times
E occurs   1 times
I occurs    2 times
L occurs   1 times
M occurs 1 times
N occurs 1 times
O occurs   2 times
P occurs   3 times
R occurs   1 times
T occurs   2 times
b.       Write a program to accept a string. Convert the string to uppercase. Count the number and output the double letter sequences that exist in the string.
Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE”
Sample Output: 4


SOLVE THE QUESTIONS AND SUBMIT BY 25/06/2018



No comments:

Post a Comment