
Question 1
Answer
Question 1
Which of the following are checked exceptions?(Choose all that apply)
class One extends RuntimeException{}
class Two extends Exception{}
class Three extends Error{}
class Four extends One{}
class Five extends Two{}
class Six extends Three{}
A) Three
B) One
C) Six
D) Four
E) Five
F) Two
Answer
class A{
private void printName(){
System.out.println("Value-A");
}
}
class B extends A{
public void printName(){
System.out.println("Name-B");
}
}
public class Test{
public static void main(String[] args){
A a = new B();
a.printName();
}
}
Question 2
Answer
Question 2
Which is the output for the above code?
A) Value-A
B) Name-B
C) Value-A Name-B
D) Compilation fails-private methods can’t be override
E) None of these
Answer
public static void main(String[] args){
String a = "epam";
String b = "epam";
a.concat(b);
System.out.printn(a);
}
Question 3
Answer
Question 3
What will be the output of the above snippet?
A) epam
B) Compilation Error
C) null
D) epamepam
E) Runtime Exception
Answer
Question 4
Answer
Question 4
Which of the following pairs fills in the blanks to make this code compile?
public void read()__________SQLException{
____________new SQLException();
}
A) throws on line 5 and throw on line 6
B) throw on line 5 and throws on line 6
C) None of the above. SQLException is a checked exception and cannot be thrown
D) throws on line 5 and throws on line 6
E) throw on line 5 and throw on line 6
F) None of the above. SQLException is a runtime exception and cannot be thrown
Answer
import java.util.*;
import java.util.stream.IntStream;
class GFG
{
public static void main(String[] args)
{
IntStream stream = IntStream.of(2,3,4);
int answer = stream.reduce(0,(num1,num2)->(num1+num2)*2);
System.out.println(answer);
}
}
Question 5
Answer
Question 5
Which is the output for the above code?
A) Compilation Error
B) 36
C) 14
D) 18
Answer
Question 6
Answer
Question 6
An abstract data type typically comprises a_______and a set of_____
respectively.
A) Data representation, objects
B) Data representation, operations
C) Database, operations
D) Data representation, classes
E) Control structure, operations
Answer
Question 7
Answer
Question 7
Which statement is not true in java language?
A) None of these
B) A public member of a class can be accessed in all the packages.
C) A private member of a class cannot be accessed by the methods of the same class.
D) A protected member of a class can be accessed from its derived class.
E) A private member of a class cannot be accessed from its derived class.
Answer
Question 8
Answer
Question 8
Select the options which is true.
A) Objects can be explicitly destroyed using the finalized method.
B) Objects can be explicitly destroyed using keyword delete.
C) If object obj1 can access object obj2 that is eligible for garbage collection, then obj1 is also eligible for garbage collection.
D) An object will be garbage collected immediately after it becomes unreachable.
E) None of these
Answer
Question 9
Answer
Question 9
Which of the following statements are true about checked an unchecked exceptions?
A) NullPointerException is an example of unchecked exception
B) ClassNotFoundException is an example of unchecked exception.
C) Unchecked exception is required handle at compile time.
D) Both of these exceptions can be handled using try,catch keywords.
E) checked exceptions is required to be handled at compile time.
Answer
Question 10
Answer
Question 10
Selenium can
A) find elements from desktop applications
B) find defects in API specifications
C) generates test reports automatically
D) perform operations on element inside an iframe
Answer