Questions – Exam Papers – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
Exam Paper: Questions - Exam Papers (JAVA) siteicon No. of Q.26


Differentiate between searching and sorting.




Write a difference between the functions isUpperCase() and toUpperCase().




How are private members of a class different from public members?




Classify the following as primative or non-primative datatypes:
(i) char
(ii) arrays
(iii)int
(iv) classes




(1) int res = ‘A’;
What is the value of res?

(ii) Name the package that contains wrapper classes.




State the difference between while and do while loop.




System.out.print(“BEST”);
System.out.println(“OF LUCK”);
Choose the correct option for the output of the above statements
(i)
BEST OF LUCK
(ii)
BEST
OF LUCK




Write the prototype of a function check which takes an integer as an argument and returns a character.




Write the return data type of the following function.
(i) endsWith()
(ii)log()




Write a Java expression for the following:




What is the value of y after evaluating the expression given below?
y+=++y + y– + –y;  when int y=8




Give the output of the following:
(i) Math.floor(-4.7)
(ii)Math.ceil(3.4)+Math.pow(2,3)




Write two characteristics of a constructor.




Write the output for the following:
System.out.println(“Incredible”+”n”+”world”);




Convert the following if else if construct into switch case
if( var==1)
System.out.println(“good”);
else if(var==2)
System.out.println(“better”);
else if(var==3)
System.out.println(“best”);
else
System.out.println(“invalid”);




Give the output of the following string functions:
(i) “ACHIEVEMENT”.replace(‘E’,’A’)
(ii)”DEDICATE”.compareTo(“DEVOTE”)




Consider the following String array and give the output
String arr[]= {“DELHI”, “CHENNAI”, “MUMBAI”, “LUCKNOW”, “JAIPUR”};
System.out.println(arr[0].length()>arr[3].length());
System.out.print(arr[4].substring(0,3));




Rewrite the following using ternary operator:
if (bill>10000)
discount=bill*10.0/100;
else
discount = bill*5.0/100;




Give the output of the following program segment and also mention how many times the loop is executed:
int i;
for (i=5;i>10;i++)
System.out.println(i);
System.out.println(i*4);




Design a class RailwayTicket with following description:

Instance variables/data members :
String name : To store the name of the customer
String coach : To store the type of coach customer wants to travel
long mobno : To store customer’s mobile number
int amt : To store basic amount of ticket
int totalamt : To store the amount to be paid after updating the original amount
Member methods :
void accept () – To take input for name, coach, mobile number and amount.
void update() – To update the amount as per the coach selected
(extra amount to be added in the amount as follows)

Type of Coaches Amount
First_AC 700
Second_AC 500
Third_AC 250
sleeper None

void display() – To display all details of a customer such as name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.




Write a program to input a number and check and print whether it is a Pronic number or not. (Pronic number is the number which is the product of two consecutive integers)
Examples: 12 = 3 x 4
20 = 4 x 5
42 = 6 x 7




Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string.
Sample input: we are in cyber world
Sample output: We Are In Cyber World




Design a class to overload a function volume() as follows:

(i) double volume (double R) ¡V with radius (R) as an argument, returns the volume of sphere using the formula.
V = 4/3 x 22/7 x R^3
(ii) double volume (double H, double R) ¡V with height(H) and radius(R) as the arguments, returns the volume of a cylinder using the formula.
V = 22/7 x R^2 x H
(iii) double volume (double L, double B, double H) ¡V with length(L), breadth(B) and Height(H) as the arguments, returns the volume of a cuboid using the formula.
V = L x B x H




Write a menu driven program to display the pattern as per user’s choice.
Pattern 1 Pattern 2
ABCDE       B
ABCD         LL
ABC            UUU
AB              EEEE
A
For an incorrect option, an appropriate error message should be displayed.




Write a program to accept name and total marks of N number of students in two single subscript array name[ ] and totalmarks[ ].
Calculate and print:
(i) The average of the total marks obtained by N number of students.
[average = (sum of total marks of all the students)/N]
(ii) Deviation of each student’s total marks with the average.
[deviation = total marks of a student – average]



Total Marks.128