Sunday, 17 June 2018

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

Section A
[Answer all Questions]
1.       Do as directed
a)      Give one example each of a primitive data type and a composite data type.
b)      Give one point of difference between unary and binary operators.
2.       Write a Java statement to input / read the following from the user using the keyboard:
i) Character ii) String
3.       What will be the output for the following program segment?
int a=0, b=30, c=40;
a = --b + c++ + b;
System.out.println("a=" + a);
4.       Write one word answer for the following:
i) A method that converts a string to a primitive integer data type
ii) The default initial value of a boolean variable data type
5.       Name the primitive data type in Java that is:
(i) a 64-bit integer and is used when you need a range of values wider than those provided by int.
(ii) a single 16-bit Unicode character whose default value is ‘\u0000'
  1. Give the output
System.out.println("The King said \"Begin at the beginning!\" to me.");
7.       What are the types of casting shown by the following examples:
(i) char c = (char)120;
(ii) int x = ‘t’;
  1. Differentiate between if and switch statement
9.       Give the output of the following code segment when (i) opn = ‘b’ (ii) opn = ‘x’ (iii) opn = ‘a’.
switch(opn)
{
    case 'a':
      System.out.println("Platform Independent");
      break;
    case 'b':
      System.out.println("Object Oriented");
    case 'c':
      System.out.println("Robust and Secure");
      break;
    default:
      System.out.println("Wrong Input");
}
10.   What is the difference between break and continue statements when they occur in a loop.
11.   What is an infinite loop? Write an infinite loop statement.
12.   Give the output of the following program segment and also mention the number of times the loop is executed:
int a,b;
for(a=6,b=4;a<=24;a=a+6)
{
if(a%b==0)
break;
}
System.out.println(a);
  1. Find and correct the errors in the following program segment:-
int n[] = (2,4,6,8,10);
for(int i=0; i<=5; i++)
System.out.println("n[" + i + "] = " + n[i]);
14.   Name the search or sort algorithm that:
(i)         Makes several passes through the array, selecting the next smallest item in the array each time and placing it where it belongs in the array.
(ii)       At each stage, compares the sought key value with the key value of the middle element of the array.
  1. What is a constructor? When is it invoked?
  2. State the difference between function and constructor.
  3. Enter any two values through constructor with parameters and write a program to swap and print the values.
18.   What are the two ways of invoking functions?
  1. Why do we need a constructor as a class member?
  2. Create a class with one integer instance variable. Initialize the variable using:
    1. default constructor
    2. parameterized constructor.

Section B
[Answer any five Questions]


1.       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)
 ..            ..            ..            ..

2.       Write a class with the name volume using function overloading that computes the volume of a cube, a sphere and a cuboid.
volume of a cube             (vc) = s*s*s
volume of a sphere         (vs) = 4/3*Π*r*r*r (where Π = 3.14 or 22/7)
volume of a cuboid         (vcd) = l*b*h

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.

4.       Define a class called mobike with the following description:
Instance variables/data members:
int bno – to store the bike’s number
int phno – to store the phone number of the customer
String name – to store the name of the customer
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 compute( ) – to compute the rental charge.
The rent for a mobike is charged on the following basis:
First five days `500 per day.
Next five days `400 per day.
Rest of the days `7200 per day.
void display( ) – to display the details in the following format:
Bike No. Phone No. Name No. of days Charge
5.       Using the switch statement, write a menu driven program to:
             Generate and display the first 10 terms of the Fibonacci series
0, 1, 1, 2, 3, 5, 
The first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two.
             To find the smallest digit of an integer that is input:
Sample input: 6524
Sample output: Smallest digit is 2
For an incorrect choice, an appropriate error message should be displayed

6.       Write a program in to input and store all roll numbers, names and marks in 3 subjects of n number of students in five single dimensional arrays and display the remark based on average marks as given below
Average marks = total marks/3
Average marks                                                           Remark
85 – 100                                                                       EXCELLENT
75 – 84                                                                         DISTINCTION
60 – 74                                                                         FIRST CLASS
40 – 59                                                                         PASS
Less than 40                                                                POOR

7.       Design a class to overload a function area( ) as follows:
        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 =
        double area(int a, int b, int height) with three integer arguments, returns the area of a trapezium using the formula: area =
        double area(double diagonal1, double diagonal2) with two double arguments, returns the area of a rhombus using the formula: area =

To be Submitted by 3rd July 2018

No comments:

Post a Comment