81. What should the return type of method where there is no return value?
82. What data structure should be used when number of elements is fixed?
83. What causes the program to exit abruptly and hence its usage should be minimalistic?
84. 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;
}
i)
public boolen abc(int num)
{
return num % 2 == 1;
}
ii)
public boolean xyz(int num)
{
return (num & 1)!= 0;
}
85. Which one of the following causes memory leak?
86. Which of the following is a best practice to measure time taken by a process for execution?
87. 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");
}
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");
}