You are on page 1of 3

Computer Dot Com

A complete computer education


Under W.B. Gov Registered
An ISO 9001:2015 Certified Institute
Name __________________________ Date _________________ A/C _________________

Unit – 1 [Fill the blanks ] any 5 5x2=10

1. ___________ is a collection of classes.


2. By default, ______________ package is imported in a Java program.
3. The user can create a data type by using a __________.
4. The data type int is included in ______________ wrapper class.
5. Wrapper class uses first letter in ___________ case.
6. String data is converted to float type by using _________________function.
7. Conversion from primitive type to wrapper object is called as _____________
8. Each character oriented function uses a wrapper tag ____________

Unit – II [State True / False ] 5x1=5

1. Java class library includes all the packages


2. Wrapper classes belong to java.util package.
3. Array is a non-primitive data type.
4. Class is a composite data type.
5. Integer.toString() converts integer data to String.

Unit – III [Choose appropriate option for the following statements ] 5x1=5

1. A package contains:

1. tags
2. classes
3. data
4. arrays

2.Each primitive data type belongs to a specific:

1. block
2. object
3. wrapper class
4. none

3.Automatic conversion of primitive data into an object of wrapper class is called:


1. autoboxing
2. explicit conversion
3. shifting
4. none

4.The parseInt() function is a member of:

1. integer wrapper class


2. character wrapper class
3. boolean wrapper class
4. none

5.valueOf() function converts:

1. Primitive type to String


2. String to primitive type
3. character to String
4. None

Unit – IV [Write the answer ] any 2 2x5=10

1.What is a package?

2. What is the significance of '*' while importing a package?

3. Define a wrapper class.

4. Differentiate between:

(a) isUpperCase() and toUpperCase()


(b) primitive type and composite type data

Unit – V [Write the purpose of the following functions ] 5x1=5

1. Float.parseFloat()
2. Double.toString()
3. Integer.valueOf()
4. Character.isDigit()
5. Character.isWhitespace()
Unit – V [ Find the output of the following program snippets] any 6 6x1=6
1.char ch = '*';
boolean b = Character.isLetter(ch);
System.out.println(b);

2.char c = 'A';
int n = (int) c + 32;
System.out.println((char)n);

3.String s= "7";
int t =Integer.parseInt(s);
t=t+1000;
System.out.println(t);

4.char c = 'B';
int i = 4;
System.out.println(c+i);
System.out.println((int)c+i);

5.char ch = 'y';
char chr = Character.toUpperCase(ch);
int p = (int) chr;
System.out.println(chr + "\t" + p);

6.int n = 97;
char ch = Character.toUpperCase((char)n);
System.out.println(ch + " Great Victory");

7.char ch = 'x'; int n = 5;


n = n + (int)ch;
char c = (char)n;
System.out.println((char)((int)c-26));

8.char ch = 'A';
char chr = Character.toLowerCase(ch);
int n = (int)chr-32;
System.out.println((char)n + "\t" + chr);

Unit – VI [Write the program ] any 3 3x3=9

1. Write a program in Java to input a character. Find and display the next 10th character in
the ASCII table.
2. Write a program in Java to input a character. Display next 5 characters.
3. Write a program in Java to generate all the alternate letters in the range of letters from A
to Z.
4. Write a program to input a set of 20 letters. Convert each letter into upper case. Find and
display the number of vowels and number of consonants present in the set of given
letters.
5. Write a program in Java to accept an integer number N such that 0<N<27. Display the
corresponding letter of the alphabet (i.e. the letter at position N).
[Hint: If N =1 then display A]

You might also like