computer paper
computer paper
(a) 14.0
(b) 14
(c) -14
(d) None
(a) packets
(b) blocks
(c) subscripts
(d) compartments
(iv) Name the package that contains the class:
BufferedReader ii Scanner
(a) java.util. *
(b) java.io.*
(c) Both
(d) None
(c) protected
(d) private
() t
(g) t
(h) //n
(vii) if (m>n && n>p) then largest number is:
(a)
(b) p
(c)
(b) 15
(c) 16
(e) 16.0
(x) What is the method to check whether a character is a letter or digit?
(a) isDigit(char)
(b) isLetterOrDigit()
(c) isLetterOrDigit(char)
(d) isLETTERorDIGIT(char)
(a) exe
(b) obj
(c) jvm
(d) java
Automatic conversion of primitive data into an object of wrapper class is called:
(xii)
(a) explicit conversion
(b) autoboxing
(c) shifting
(d) None
(d) None
(xiv) Which of the following are entry controlled loops?
1 for
2 while
3 do..while
4 switch
(a) only 1
(b) land 3
(c) land 2
(e) 3 and 4
(b) EINATION
(c) EXATION
(d) EXNATION
(xvi) If the name of the class is "Alphabet", what can be the possible name for its
constructors?
(a) Alphabet
(b) ALPHABET
(c) Alpha
(d) Alphabet
(xvii) Which of the following mathematical methods returns only an integer?
(a) Math.ceil(n)
(b) Math.round(n)
(c) Math.abs(n)
(d) Math.sqrt(n)
(xvii) The correct statement to create an object named skoda of class car:
(a)
(b) n
(c) 1
(d) None
(a) 5
(b) 6
(c) 3
(d) 2
Question 2
[2]
(iii) A Java program uses a Compiler as well as an Interpreter. Explain.
is the loop [2]
(iv) Give the output of the following program segment. How many times
executed?
for(x=10; x>20;x++)
System.out.println(x);
System.out.println(x*2);
(d) System.out.println(x.equals(y)):
Consider the following two-dimensional array and answer the questions given [2]
(vi)
below:
switch(p)
casel: qFp*2:
break:
case2: q-pt2;
break:
case3: q-p-2:
break:
[2]
(ix) Give the output of the following:
s-afi] + a[3-i]:
System.out.printIn(s);
int a = 0:
whilela >-5){
System.out.println(a +*");
System.out.println((--a * 2));
System.oul.print1n();
--a;
SECTION B(60 Marks)
(Answer any four questions from this Section.)
The answers in this section should consist ofthe programs in either BlueJ environment or any
program environment with Java as the base.
Each program should be written using variable description /mnemonic codes so that the logic of the
program is clearly depicted.
Flowcharts and algorithms are not required.
Question 3 [15]
(a.)
Write a menu driven class to accept a number from the user and check whether it is
Palindrome or a Perfect number.
1. Palindrome number: A number is a Palindrome which when read in reverse order is
same as read in the right order Example: 11, 101, 151, etc.
2. Perfect number: A number is called Perfect if it is equal to the sum of its factors
other than the number itself.
Example: 6 = 1+2+3
(b.)
Write a program in Java to find the sum of the given series:
1+3+7+ 15 +31 +.... +(220- 1) 2-2, 21,
Question 4 [15]
(a.)
string in order of their lengths
Write aprogram to input a sentence and arrange words of the
from shortest to longest.
(b.)
uppercase. Count and output the
Write a program to accept astring. Convert the string to
number of double letter scquences that exist in the string.
Sample Input: APPLE"
"SHE WAS FEEDINGTHE LITTLE RABBIT WITH AN
Sample Output:
4
Question 5
[15]
Define a class to overload the method perform as
follows:
double perform (double r, double h) to calculate and return the value of
Question 6
[15]
Define a class to accept the gmail id and check for its validity.
A gmail id is valid only if it has:
a
(dot)
gmail
Com
Question 7 [l5]
Define a class pin code and store the given pin codes in a single dimensional array. Sort
these pin codes in ascending order using the Selection Sort technique only. Display the
sorted array.