Java Tutorials / Java Placement questions
Java Interview :
Data types, variables and Arrays
16) What is the value of a[3] as the result of the following
array declaration?
1
2
3
4
Ans : d
17) Which of the following are primitive types?
byte
String
integer
Float
Ans : a.
18) What is the range of the char type?
0 to 216
0 to 215
0 to 216-1
0 to 215-1
Ans. d
19) What are primitive data types?
Ans : byte, short, int, long
float, double Boolean char
20) What are default values of different primitive types?
Ans : int – 0
short – 0
byte – 0
long – 0 l
float – 0.0 f
double – 0.0 d
Boolean – false
char – null
21) Converting of primitive types to objects can be explicitly.
a)True
b)False
Ans: b.
22) How do we change the values of the elements of the array?
Ans : The array subscript expression can be used to change the
values of the elements of the array.
23) What is final variable?
Ans : If a variable is declared as final variable, then you can
not change its value. It becomes constant.
24) What is static variable?
Ans : Static variables are shared by all instances of a class.
Ref Link contributor : http://www.hudihudi.com/placement/java/java5.htm
Permanent link to Java Tutorials : http://www.freshersinterviewquestions.com/java-tutorials-java-placement-questions-2/
[…] This post was Twitted by freshersinterv […]