Sunday, 17 June 2018

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


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.   Consider the following code and answer the questions that follow:
class academic
{
    int x, y;
    void access()
    {
        int a, b;
        academic student = new academic();
        System.out.println("Object created");
    }
}
i) What is the object name of class academic?
ii) Name the class variables used in the program?
iii) Write the local variables used in the program.
iv) Give the type of function used and its name.
15.   In the program given below, state the name and the value of the
(i) method argument or argument variable
(ii) class variable
(iii) local variable
(iv) instance variable
class myClass {
static int x = 7;
int y = 2;
public static void main(String args[]) {
myClass obj = new myClass();
System.out.println(x);
obj.sampleMethod(5);
int a = 6;
System.out.println(a);
}
void sampleMethod(int n) {
System.out.println(n);
System.out.println(y);
}
}
16.   Consider the following class:
public class myClass {
public static int x = 3, y = 4;
public int a = 2, b = 3; }
(i) Name the variables for which each object of the class will have its own distinct copy.
(ii) Name the variables that are common to all objects of the class.
17.   List the variables from those given below that are composite data types.
(i) static int x;
(ii) arr[i] = 10;
(iii) obj.display();
(iv) boolean b;
(v) private char chr;
(vi) String str;
18.   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=a+b;
b=a-b;
a=a-b;
System .out.println(a+","+b);  
}
19.   Write a function prototype of the following:
20.   What is a parameterized constructor?

Section B
[Answer any five Questions]
1.       Write a class with name employee and basic as its data member, to find the gross pay of an employee for the following allowances and deduction. Use meaningful variables.
Dearness Allowance = 25% of the Basic Pay
House Rent Allowance = 15% of Basic Pay
Provident Fund = 8.33% of Basic Pay
Net Pay = Basic Pay + Dearness Allowance + House Rent Allowance
Gross Pay = Net – Provident Fund

2.       The marks obtained by 50 students in a subject are tabulated as follows:-
Name    Marks
—–         —–
—–         —–
—–         —–
—–         —–
Write a program to input the names and marks of the students in the subject. Calculate and display:-
             The subject average marks (subject average marks = )
             The highest mark in the subject and the name of the student.
(The maximum marks in the subject are 100)

3.       Design a class to overload a function num_calc ( ) as follows:
             void num_calc (int mini, char ch) with one integer argument and one character argument, computes the square of integer argument if choice ch is ‘s’ otherwise finds its cube.
             void num_calc (int a, int b, char ch) with two integer arguments and one character argument. It computes the product of integer arguments if ch is ‘p’ else adds the integers.
             void num_calc (String si, String s2) with two string arguments, which prints whether the strings are equal or not.

4.       Write a program to store 6 elements in an array P, and 4 elements in an array Q and produce a third array R, containing all the elements of array P and Q. Display the resultant array.
EXAMPLE INPUT
P[6]        Q[4]       OUTPUT R[10]
4              19           4
6              23           6
1              7              1
2              8              2
3                              3
10                           10
                                19
                                23
                                7
                                8

5.       Design a class to overload a function polygon( ) as follows:
             void polygon(int n, char ch) – with one integer argument and one character type argument that draws a filled square of side n using the character stored in ch.
             void polygon(int x, int y) – with two integer arguments that draws a filled rectangle of length x and breadth y, using the symbol  @
             void polygon( ) – with no argument that draws a filled triangle shown below.
Example:
             Input value of n = 2, ch =  O
Output:
OO
OO
             Input value of x = 2, y = 5
Output:
@@@@@
@@@@@
             Output:
*
**

6.       Design a class to overload a function series( ) as follows:
             double series(double n) with one double argument and returns the sum of the series.
sum = 1/1 + 1/2 + 1/3 +   1/n
             double series(double a, double n) with two double arguments and returns the sum of the series.
sum = 1/a2 + 4/a5 + 7/a8 + 10/a11   to n terms

7.       Using the switch statement, write a menu driven program to calculate the maturity amount of a Bank Deposit.
The user is given the following options:
        Term Deposit
        Recurring Deposit
For option (i) accept principal(P), rate of interest(r) and time period in years(n). Calculate and output the maturity amount(A) receivable using the formula
A = 
For option (ii) accept Monthly Installment (P), rate of interest(r) and time period in months(n). Calculate and output the maturity amount(A) receivable using the formula
A =
For an incorrect option, an appropriate error message should be displayed.



To be Submitted by 3rd July 2018

No comments:

Post a Comment