Vidyalelo
Java Programming · all questions

Java Autoboxing
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

90

Questions

5/5

Page

Pick an option on a question to see the right answer and solution.

What should the return type of method where there is no return value?

Select an option to see the answer and solution.

What data structure should be used when number of elements is fixed?

Select an option to see the answer and solution.

What causes the program to exit abruptly and hence its usage should be minimalistic?

Select an option to see the answer and solution.

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;
 }

Select an option to see the answer and solution.

Which one of the following causes memory leak?

Select an option to see the answer and solution.

Which of the following is a best practice to measure time taken by a process for execution?

Select an option to see the answer and solution.

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");
}

Select an option to see the answer and solution.

Which of the below is true about java class structure?

Select an option to see the answer and solution.

Which of the below is false about java coding?

Select an option to see the answer and solution.

Which is better in terms of performance for iterating an array?

Select an option to see the answer and solution.