wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Wrapper Class

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Wrapper classes are found in _____ package

a)

java.lang

b)

java.util

c)

java.io

d)

java.net

2.

The data type wrapper classes are in……….package

a)

java.lang

b)

java.io

c)

java.util

d)

java.applet

3.

Which of these is a wrapper for data type int?

a)

Integer

b)

Long

c)

Byte

d)

Double

4.

Which of these is a super class of wrappers Long, Character & Integer?

a)

Long

b)

Digits

c)

Float

d)

Number

5.

Which of these is a wrapper for simple data type char?

a)

Float

b)

Character

c)

String

d)

Integer

6.

Which of the following is method of wrapper Integer for converting the value of an object into int?

a)

bytevalue()

b)

int intValue();

c)

Bytevalue()

d)

Byte Bytevalue()

7.

Which of these methods is used to obtain value of invoking object as a long?

a)

long value()

b)

long longValue()

c)

Long longvalue()

d)

Long Longvalue()

8.

Consider the following two statements


int x = 25;

Integer y = new Integer(33);

What is the difference between these two statements?

a)

Primitive data types

b)

primitive data type and an object of a wrapper class

c)

Wrapper class

d)

None of the above

9.

Where does the primitive data type values be stored?

a)

Heap Memory

b)

Stack Memory

c)

Both A & B

d)

None of the above

10.

Converts string "24" into integer and stores it in integer variable n

a)

int n=Integer.parseInt("24");

b)

int n=Integer.ParseInt("24");

c)

Integer.parseInt("24");

d)

int n=integer.parseInt("24");

11.

Converts string "24" into integer and stores it in integer variable n

a)

int n=Integer.parseInt("24");

b)

int n=Integer.ParseInt("24");

c)

Integer.parseInt("24");

d)

int n=integer.parseInt("24");

12.

State True or False;A data type starts with lowercase letter whereas its wrapper class starts with an upper case letter

a)

True

b)

false

13.

what is the value of n here; double n=Double.valueOf("24.31546")

a)

"24.31546"

b)

Number Format error

c)

24.31546

d)

24

14.

I want to convert integer n to string s, I will use

a)

Integer.valueOf(s);

b)

s=Integer.toString()

c)

n=integer.parseInt(s)

d)

s=Integer.toString(n)

15.

Syntax to get character from user is

a)

char ch=sc.nextchar();

b)

ch=sc.nextChar();

c)

char ch=in.next().charAt(0);

d)

char ch=in.next().charAt();

16.

state which statements are true

a)

String data type char along with all the functions related to character manipulations belong to Character wrapper class.Hence,the character oriented functions start with keyword Character.

b)

Primitive data type char along with all the functions related to character manipulations belong to String wrapper class.Hence,the character oriented functions start with keyword String.

c)

Primitive data type char along with all the functions related to character manipulations belong to Character wrapper class.Hence,the character oriented functions start with keyword Character.

d)

All the above

17.

What is the return type of the snippet, Character.isLetterOrDigit("*");

a)

None

b)

False

c)

true

d)

boolean

18.

The snippet to check existing blank or gap in a string.

a)

boolean b=Character.iswhitespace(character);

b)

boolean b=Character.isWhitespace(character);

c)

boolean b=character.isWhitespace(character);

d)

Character.isWhitespace(character);

19.

which is correct statement

a)

boolean c= Character.toLowerCase('G');

b)

char c= Character.ToLowerCase('G');

c)

Boolean c= Character.toLowerCase('G');

d)

char c= Character.toLowerCase('G');

20.

Which is correct statement

a)

boolean b=Character.isLetterOrDigit('9');

b)

boolean b=character.isLetterOrDigit('9');

c)

boolean b=Character.IsLetterOrDigit('9');

d)

boolean b=Character.isLetterorDigit('9');

21.

What will be output of x and y if , String s= "1001";int x=Integer.valueOf(s);double y=Double.valueOf(s);

a)

x="1001";y=1001

b)

x="1001";y=1001.0

c)

x=1001;y=1001.0

d)

x=1001.o;y=1001

22.

State a method that converts string to primitive float data type

a)

Float.parseString(String);

b)

Float.parsefloat(String);

c)

float.parseFloat(String);

d)

Float.parseFloat(String);

23.

State the values of n and ch;char c='A'; int n=c+1;char ch=(char)n;

a)

n=6 ; ch=B

b)

n=66 ; ch=B

c)

n=6 ; ch=b

d)

n=96 ; ch=b

24.
This is the act of creating an object.
a)
overflow
b)
instantiation
c)
encapulsation
d)
objection
25.
A template for a new type of object.
a)
method
b)
object
c)
class
d)
return