Professional Documents
Culture Documents
Mock Paper
Mock Paper
Mock Paper
M.M-100 M.T-2hrs
{
marks[i]= i;
}
(a)3 (b)1 (c)0 (d)can’t say
(b)it lets you specify that the * may be replaced by any string
int RedGreenYellow;
change light(){
RedGreenYellow=++RedGreenYellow%3;
14.In the below code, which is the class under which main method is
called: public class HelloObject
void speak(){
Class HelloTester{
anObject.speak();
15. n=10000;
while(n>100){
n=n/10;}
System.out.println(n);
How many times the loop is executed and what is the output?
(a) Loop is executed 2 times and the output is 100
(b) Loop is executed 3 times and the output is 10
(c) Loop is executed 2 times and the output is 10
(d) Loop is executed 2 times and the output is 1000
“JAVA.to Lowercase();
17. all calls to methods must have __after them, even if that methods
takes no arguments. As in:- myObject.methodNoArgs();
18. for the following function definition, what is the return type that
should be specified ? _______isBlack (Color colour)
if(colour ==black)
return(true);
else
return(false);
19. in the below code what are the names of data members of the
class?? class clock
{
hours = h;
minutes=m;
} }
20. what determines both the visibility and lifetime of the variable
names defined within the scope??
QUESTION-2 [2*10=20]
1. FIND THE OUTPUT:-
String st= “MALAYALAM”;
int p= st.indexOf(‘A’,4);
String st1= “COMPUTER”;
int p1= st1.indexOf(‘C’,3);
int sum=p+p1;
System.out.println(sum);
2. Define boxing with an example.
3. Describe the output of:-
“MIDAS”.lastIndexOf(‘ ’);
4. Between the pass by value and pass by reference , what method
will allow lasting changes to the object when passed as arguments
to a method?
5. For the below string how can you find (using a single condition),
whether the last character of the string is a space:-- (‘ ’);
6. Fill in the blanks for the below code:-
Public void update(int x, int y)
{
____________ (1)
____________ (2)
}
The class itself contains two integer members variables, x and y.
Update the x with x and y with y.
7. Evaluate the following java line:- “ATACAMA”.replace(‘A’, ‘B’).concat(“RR”);
8. Rewrite the following program segment using if-else statements instead of the ternary
operator:
c = (x >= 'A' && x<= 'Z') ? "Upper Case Letter" : "Lower Case Letter";
9. State the output when the following program segment is executed:
String a ="Smartphone", b="Graphic Art";
String h=a.substring(2, 5);
String k=b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h));
10. Give the output of the following:
1. Math.floor (-4.7)
2. Math.ceil(3.4) + Math.pow(2, 3)
SECTION-B
{answer any four questions from this section}
Question 3
Use another class Calculate which inherits from class Account with the following
specifications:
Data members — int r,t ; float si,amt;
Member Methods:
Question 4
An Abundant number is a number for which the sum of its proper factors is greater than the number
itself. Write a program to input a number and check and print whether it is an Abundant number or
not.
QUESTION-5
void print(int a, char ch)- if ch=s or S print the square of the number
else if ch=c or C print the cube of the number.
Question 6
Question 7
Write a program to accept a list of 20 integers. Sort the first 10 numbers in ascending
order and next the 10 numbers in descending order by using 'Bubble Sort' technique.
Finally, print the complete list of integers
Question 8
THE END…..