java (3)
java (3)
1. Compilation Error
2. Run time Exception -NullPointer Exception in the second line of main
method
3. Will print nullnull on the screen
4. print an empty line on screen
Correct Answer : 3
Your Answer : 2
QuestionID : 9319 Subject Name Core Java
Q11. Objects are always passed by _______.
1. Value
2. Reference
3. Either Value Or Reference
4. Using Pointers
Correct Answer : 2
Your Answer : 2
QuestionID : 9326 Subject Name Core Java
Q12. if("string".trim()=="string")
System.out.println("Equal");
else
System.out.println("Not Equal");
1. the code will compile and print "Equal"
2. the code will compile and print "Not Equal"
3. the code will cause compiler error
4. none
Correct Answer : 1
Your Answer : 2
QuestionID : 9333 Subject Name Core Java
Q13. Which of these field declarations are legal within the body
of an interface?
select the correct answers.
1. public static int answer=42;
2. private final static int answer=42;
3. final static int answer =42;
4. all of the above
Correct Answer : 4
Your Answer : 1
QuestionID : 9451 Subject Name Core Java
Q14. Attribute of an Object is also known as its ________.
1. state
2. method
3. behavior
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 3/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
4. procedures
Correct Answer : 1
Your Answer : 1
QuestionID : 9473 Subject Name Core Java
Q15. Read the following code carefully
public abstract class AbstractClass
{
public AbstractClass()
{
System.out.println("this is an abstract class constructor");
}
public void amethod()
{
System.out.println("This is in the method in the abstract class");
}
}
1. Compiler error-abstract classes cannot have constructors.
2. Compiler error-the method AbstractClass does not have a valid return
type.
3. Compiler error-the class is pracically not an abstract class as it does not
have any unimplementd methods.
4. No compiler error-the class cannot be instantiated directly.It has to be
extended to an non-abstract class.The constructors of the extended class will
call the constructor of the abstract class.
Correct Answer : 4
Your Answer : 4
QuestionID : 9478 Subject Name Core Java
Q16. give the following source code, which comment line can be
uncommented without introducing errors ?
abstract class MyClass {
abstract void f();
final void g() {}
// final void h() {} // (1)
protected static int i ;
private int j;
}
final class MyOtherClass extends MyClass {
// MyOtherClass(int n) { m = n } //(2)
}
void f() {}
void h() {}
// void k() { i++ ; } //(3)
Correct Answer : 3
Your Answer : 0
QuestionID : 9537 Subject Name Core Java
Q17. Given the following code within a method, which statement is true?
int a,b;
b=5;
1. a & b
2. c & d both
3. a,d,e
4. c only
Correct Answer : 4
Your Answer : 4
QuestionID : 9552 Subject Name Core Java
Q18. Name the Collection interface implemented by the hash set class
1. Hash Set
2. Set
3. Hash
4. List
Correct Answer : 2
Your Answer : 2
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 5/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
if("string".replace(t,t)=="string")
System.out.println("Equal");
else
System.out.println("Not Equal");
1. the code will compile and print "Equal"
2. the code will compile and print "Not Equal"
3. compiler will cause an error
4. none of the above
Correct Answer : 1
Your Answer : 3
QuestionID : 9708 Subject Name Core Java
Q25. public class Q10
{
public static void main(String [] args)
{
int i=10;
int j=10;
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 7/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
boolean b=false;
if(b=i==j)
System.out.println("True");
else
System.out.println("False");
}
}
1. Compilation error at line 9
2. runtime Exception at line 9
3. True
4. False
Correct Answer : 3
Your Answer : 1
QuestionID : 9782 Subject Name Core Java
Q26. You need to create a class that will store unique object elements.
you do not need to sort these elements but they must be unique.
what interface might be most suitable to meet this need?
1. set
2. list
3. map
4. vector
Correct Answer : 1
Your Answer : 3
QuestionID : 9790 Subject Name Core Java
Q27. What will happen to Exception object after exception handling.
1. Nothing
2. At times it may get garbage collected
3. it always get garbage collected
4. none of the above
Correct Answer : 2
Your Answer : 1
QuestionID : 9816 Subject Name Core Java
Q28. Given the following class definitions, which expression identifies
whether the
object referred to by obj was created by instatiating class B rather
than classes A,C, and D?
class A{}
class B extends A{}
class C extends B()
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 8/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
try {
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 9/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
int c = a / b;
} catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
switch (x) {
case 1:
System.out.println(1);
case 2:
case 3:
System.out.println(3);
case 4:
System.out.println(4);
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 10/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
ReturnDemo 1 2 3 4
public class ReturnDemo
{
public static void main(String[] args)
{
if(checkValue(args.length)>3)
System.out.println("Hello World!");
return;//Line x
}
static int checkValue(int i)
{
if(i>3)
return i;
else
return 2.0;//line y
}
}
1. Hello world!
2. Compile time error on line x
3. Compile time error on line y
4. Both 2 and 3
Correct Answer : 2
Your Answer : 1
QuestionID : 10281 Subject Name Core Java
Q39. What is the correct ordering for the import, class and package
declarations when found in a single file?
1. package, import, class
2. class, import, package
3. import, package, class
4. package, class, import
Correct Answer : 1
Your Answer : 1
QuestionID : 10487 Subject Name Core Java
Q40. To create the TCP-IP stream transport layer is responsibe
Correct Answer : F
Your Answer : T
QuestionID : 10495 Subject Name Core Java
Q41. getCause() are methods of which class.
1. Throwable
2. IOException
3. RunTimeException
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 12/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
output is :
1. 30
2. 27
3. compile time error Variable a is already declared
4. none of the above
Correct Answer : 1
Your Answer : 1
QuestionID : 10504 Subject Name Core Java
Q44. in _______ , everything is undefined
1. interface
2. abstract class
3. final class
4. none of the above
Correct Answer : 1
Your Answer : 4
QuestionID : 10511 Subject Name Core Java
Q45. Enumarator has method to remove method to remove elements.
Correct Answer : F
Your Answer : F
QuestionID : 10976 Subject Name Core Java
Q46. What will be the result of compiling and running the given program?
Select one correct answer.
1 class Q
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 13/14
12/14/2018 Result:- SunBeam Infotech Pvt LTD, Pune
2{
3 public static void main(String args[])
4{
5 System.out.println(Math.abs(-2147483648));
6}
7}
1. Program compiles correctly and prints 2147483648 when executed.
2. Program compiles correctly and prints -2147483648 when executed.
3. Program compiles correctly and prints 2147483647 when executed.
4. The program will not compile.
Correct Answer : 2
Your Answer : 0
QuestionID : 11004 Subject Name Core Java
Q47. Dictinary is a class of java.util package
Correct Answer : T
Your Answer : F
QuestionID : 11017 Subject Name Core Java
Q48. Which is not an interface
1. Blob
2. SavePoint
3. Struct
4. None of the above
Correct Answer : 4
Your Answer : 3
QuestionID : 11019 Subject Name Core Java
Q49. When an applet begins awt call following sequence of method.
1. init(),paint(),destroy
2. init(),start(),paint(),stop(),destroy
3. init(),service(),destroy
4. init(),start(),stop(),destroy
Correct Answer : 2
Your Answer : 1
QuestionID : 11044 Subject Name Core Java
Q50. When we create object of outer class the object of inner class is
automaticaly created.
Correct Answer : F
Your Answer : F
file:///D:/STUDY%20MATERIAL/sample%20paper/cdac%20dumps/cdac%20dumps/imp_multiple_question/imp%20multiple%20question/Mix/java.htm 14/14