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

Section A (20 marks)

Attempt all questions                                        

  1. What is function overloading? Explain with example.
  2. What is a package? Give name of any two packages.
  3. What will be the result stored in Z after evaluating the following expression?

int a=5;   Z= (++a*(a–+3));

  1. Write the Java expressions for:   

√A2 -M

  1. Write a statement 
    1. to create an object of Scanner class called keyboard. 
    2. To take a string as input and assign it to a variable called name.
  2. What is fall through. Explain with an example.

    1. What is the purpose of default in switch case
    2. Explain the job of return keyword?   
  3. Give the difference between call by value and call by reference 
  4. Differentiate hasNextInt() and  nextInt()function.
  5. Give the difference between actual parameter and formal parameter.

Section B

Attempt any three programs.          

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

Q 2 

Write a menu driven program:

i) To check and display whether a number input by the user is a palindrome number or not (A number is said to be palindrome, if it remains same after reversing it also. ). Example 121,191,222…..

ii) To find the biggest digit of an integer that is input.

Sample input : 195

Sample output : Biggest digit is 9

For an incorrect choice, an appropriate error should be displayed.

Q 3

Define a class called Library with the following descriptions. 

Instance variables/Data members:

int acc_num                             stores the accession number of the book. 

String title                                stores the title of the book.

String author                            stores the name of the author

Member methods:

i)         void input()            to input and store the accession number, title and author. 

ii)        void compute()       to accept the number of days late, calculate and display the fine

                                          charged at the rate of Rs.2/- per day.

iii)       void display()          to display the details in the following format. 

Accession Number                   Title Author

Write a main method to create an object of the class and call the above member methods.

LEAVE A REPLY

Please enter your comment!
Please enter your name here