Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Which design pattern suggest multiple classes through which request is passed and multiple but only relevant classes carry out operations on the request?
Correct Answer is : Chain of responsibility pattern
2. Which design pattern represents a way to access all the objects in a collection?
Correct Answer is : Iterator pattern
3. What does MVC pattern stands for?
Correct Answer is : Model view Controller
4. Is design pattern a logical concept.
Correct Answer is : TRUE
5. Which design pattern works on data and action taken based on data provided?
Correct Answer is : Command pattern
6. Which of these is wildcard symbol?
Correct Answer is : ?
7. What is use of wildcards?
Correct Answer is : It is used in cases when type being operated upon is not known
8. Which of these keywords is used to upper bound a wildcard?
Correct Answer is : extends
9. Which of these is an correct way making a list that is upper bounded by class Number?
Correct Answer is : List extends Number>
10. Which of the following keywords are used for lower bounding a wild card?
Correct Answer is : super
11. What should the return type of method where there is no return value?
Correct Answer is : Empty collection
12. What data structure should be used when number of elements is fixed?
Correct Answer is : Array
13. What causes the program to exit abruptly and hence its usage should be minimalistic?
Correct Answer is : Exit
14. Which one of the following causes memory leak?
Correct Answer is : Not using Finally block often
15. Which of the following is a best practice to measure time taken by a process for execution?
Correct Answer is : System.nanoTime()
16. Which of the below is true about java class structure?
Correct Answer is : The class should only contain those attribute and functionality which it should; hence keeping it short
17. Which of the below is false about java coding?
Correct Answer is : variable names should be short
18. Which is better in terms of performance for iterating an array?
Correct Answer is : for(int i=99; i>=0; i–)
19. Which of the following is good coding practice to determine oddity?
i)
public boolen abc(int num)
{
return num % 2 == 1;
}
ii)
public boolean xyz(int num)
{
return (num & 1)!= 0;
}
Correct Answer is : ii
20. What one of the following is best practice to handle Null Pointer exception?
i) int noOfStudents = line.listStudents().count;
ii) int noOfStudents = getCountOfStudents(line);
public int getCountOfStudents(List line)
{
if(line != null)
{
if(line.listOfStudents() != null)
{
return line.listOfStudents().size();
}
}
throw new NullPointerException("List is empty");
}