To learn more about string methods click the given link.

This paper is divided into two sections. You are to answer all the questions from section A, and any four from section B.

Section A(40 marks)

Attempt all questions

Question 1.                                                                                                              

  1.  What is function overloading? Explain with example.
  2. Name the primitive data type in Java that is:
    • A 64 bit integer used when you need a range of values wider than those provided by int.
    • A single 16-bit Unicode character whose default value is ‘\u0000’.
  3. Define Polymorphism.
  4. double b=-65.3;

          double a= Math.rint(Math.abs(b));

           System.out.println(” a = “+ a);

5. What is the difference between a static member functions & function which are not static?

Question 2.                                                                                                  

  1. Write statements for the following     
     To create an object of class Teacher with default constructor. 
     To invoke a method of class Teacher i.e Make_Result(int x)
  2. What is the difference between a constant and a variable?
  3. What is a package? Give name of any two packages.
  4. What do you mean by type conversion? How is implicit conversion different from explicit conversion?
  5. State the difference between while loop and do while loop.

Question 3.                                                                                         

  1. What will be the output when the following code segments are executed?        
    String s=”1001”;         
    int   x=Integer.valueOf(s);

         double y=Double.valueOf(s);


        System.out.println(“y=”+y);                                                                         System.out.println(“The king said \” Begin at the beginning ! \” to me.”);

2. Consider the following

Public class Student


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..
  •  Name the variables that are common to all objects of the class.     
                                                                                                                                    3. In the program given below,  state the name and value of the Method argument or argument variable , class variable, local variable,  instance variable

  class myClass

           {         static int x= 7; int y=2;

               public static void main(String args[])


myClass obj = new myClass();



int a=6;



void sampleMethod(int  n)

{           System.out.println(n);



4. What will be the result stored in x after evaluating the following expression?

int x=12;

x+=(x++) + 4 + ( –x);                                                                                           

5. Give one example each of a primitive data type and a composite data type.

Question 4.          

  1. * Name the package that contains Scanner class.       
    *Which unit of the class gets called, when the object of the class is created?

2. What is the role of keyword void in declaring functions?

3. What is a token? Name any two of them.

4. What is the data type returned by the library functions:

compareTo(), equals()

5. Write the Java expressions for:    A2 + B3

Section B

 Attempt any 4 questions from this section. Each program should be written using a variable list so that the logic of the program is clearly depicted.

Question 5.                                                                                     
Write a class fact which takes integer number and check whether it is Automorphic number or not.

An automorphic number is the number which is contained in the last digit(s) of its square.

Example 25 is an automorphic number as its square is 625 and 25 is present as thelast two digits.      

  1. Create a class to take an integer number and check if it is a palindrome number of not.

A palindrome number is a number when reversed also the number remains the same.

Example: 121 is a palindrome number.                                                                     

Question 6.       
Define a class student as described below:

Datamembers/Instance variables:

Name,age,m1, m2,m3 (marks in 3 subjects), maximum, average

Member methods:

  1. A parameterized constructor to initialize the data members
  2. To accept the details of a student
  3. To compute the average and the maximum out of three marks
  4. To display the name, age, marks in three subjects, maximum and average.

 Question 7.             
Write a program to input any given string to calculate the total number of characters and vowels

present in the string and also reverse the string.

Example   :


Enter String                                         :  SNOWY


Total number of characters                :  O5

Number of Vowels                               :  01

Reverse string                                      : YWONS

Question 8.       
Design a class to overload a function polygon( ) as follows:
i) 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
ii) void polygon(int x, int y) with two integer arguments that draws a filled rectangle of length x and breadth y, using the symbol @
iii) void polygon() with no argument that draws a filled triangle below.

Example :
Input value of n=2. Ch=’O’


i) OO


Input value of x=2, y=5









Question 9.       
Write a menu driven program to find the sum of the following series depending on the user choosing 1 or 2

  1. S=1/4+1/8+1/12………+1/n (value of n will be given by the user)
  2. S=1/x1+2/x2+3/x3…….+n/xn(value of x and n will be given by the user)

Question 10.           

Write a program to input and store any ten numbers given by the user in an integer array. Sort and display them in ascending order using any sorting technique (Bubble sort or selection sort).


For java videos click


Please enter your comment!
Please enter your name here