Java Technical Aptitude Questions and Answers
Java Technical Aptitude Questions and Answers
(Theory)
1. Microsoft
2. Oracle
3. Apple
4. Sun Microsystem
Answer
Correct Answer: 4
Sun Microsystem
1. Greentalk
2. Oak
3. Java
4. Gosl
Answer
Correct Answer: 1
Greentalk
Correct Answer: 4
Correct Answer: 3
1. Only A)
2. Only C)
3. Both A) and C)
4. All
Answer
Correct Answer: 2
Only C)
7) Which is not a valid type of variable?
1. Global variable
2. Local variable
3. Class variable
4. Instance variable
Answer
Correct Answer: 1
Global variable
1. String
2. Character
3. Float
4. byte
Answer
Correct Answer: 4
byte
All primitive data types have their own classes, here String, Character and Float are classes but
byte is primitive data type.
1. Yes
2. No
Answer
Yes
Correct Answer: 2
1. AB
2. 195
3. 131
4. Error
Answer
Correct Answer: 3
131
Here, ‘A’ and ‘B’ are not strings they are characters. ‘A’ and ‘B’ will not concatenate. The
Unicode of the ‘A’ and ‘B’ will add. The Unicode of ‘A’ is 65 and ‘B’ is 66. Hence Output will
be 131.
1. ABA
2. AB65
3. Error
4. AB
Answer
Correct Answer: 1
ABA
If you try to concatenate any type of data like integer, character, float with string value, the result
will be a string. So 'A' will be concatenated with "AB" and answer will be "ABA".
1. 201.34AB
2. 201.34fAB
3. 21.34AB
4. Error
Answer
Correct Answer: 3
21.34AB
20 and 1.34f will be added and then 21.34 will be concatenated with “A” and “B”, hence output will
be 21.34AB.
1. includehelp
2. Error
3. [C@19e0bfd (Memory Address)
4. NULL
Answer
Correct Answer: 3
str is a character array, if you try to print str.toString() it will not converted to string because str
is an object of character array that will print an address in string format.
1. HelloGuys!
2. Hello Guys!
3. Hello
Guys!
Correct Answer: 1
HelloGuys!
1. AB-AB
2. AB-131
3. AB-ERROR
4. A B -131
Answer
Correct Answer: 2
AB-131
a+"" and b+"" will be converted into string, .toString() or +"" after variable or value converts
value into the string and a+b will be added because they are not converted into string. Hence
output will be AB-131.
7) What should be the name of java program file containing this program?
public class MyPrg
{
public static void main(String args[])
{
System.out.print("IncludeHelp");
}
}
1. MyPrg.class
2. MyPrg.java
3. MyPrg
4. Any file name with java extension
Answer
Correct Answer: 2
MyPrg.java
In this program class MyPrg is public, so we cannot take any file name, we must save this
program by MyPrg.java file name otherwise Compilation error is occurred.
1. It is another name for java source file that contain the information about the hardware.
2. It is a binary code generated by the Java Virtual Machine for operating system.
3. It is an intermediate code generated by the java compiler for Java Virtual Machine.
4. None of these
Answer
Correct Answer: 3
It is an intermediate code generated by the java compiler for Java Virtual Machine.
Correct Answer: 1
1. 10
2. a
3. Unprintable Character
4. Error
Answer
Correct Answer: 4
Error:
illegal start of expression.
1. -1
2. 255
3. 65535
4. 0xff
Answer
Correct Answer: 1
-1
0xff is the maximum value of a byte. And in Decimal maximum value of a byte is -1.
1. -1
2. 255
3. 65535
4. 0xff
Answer
Correct Answer: 3
65535
1. boolean isAdult='false';
2. boolean isAdult=0;
3. boolean isAdult="false";
4. boolean isAdult=false;
Answer
Correct Answer: 4
boolean isAdult=false;