Exam Paper Print – Computer Sir Ki Class

Login


Lost your password?

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


Shop
siteicon
Exam Paper: Exam Paper Print (JAVA) No. of Q.26
Q.01A 2

Define abstraction.



Q.01B 2

Differentiate between searching and sorting.



Q.01C

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



Q.01D 2

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



Q.01E 2

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



Q.02A 2

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

(ii) Name the package that contains wrapper classes.



Q.02B 2

State the difference between while and do while loop.



Q.02C 2

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



Q.02D 2

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



Q.02E 2

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



Q.03A 2

Write a Java expression for the following:



Q.03B 2

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



Q.03C 2

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



Q.03D 2

Write two characteristics of a constructor.



Q.03E 2

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



Q.03F 2

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”);



Q.03G 2

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



Q.03H 2

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));



Q.03I 2

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



Q.03J 2

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);



Q.04A 15

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.



Q.05A 15

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



Q.06A 15

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



Q.07A 15

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



Q.08A 15

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.



Q.09A 15

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]