Multiple Choice Question

Quiz Guidelines

 

QID: 
146
Question: 

Consider that str is a variable of class java.lang.String.
Which of the following lines of code may throw a NullPointerException in certain situations?

Or a tougher version of the question could be :
Which of the following lines of code are not an example of robust design?

Select 3 options

A. if ( (str != null) | ( i == str.length() ) )
B. if ( (str == null) | ( i == str.length() ) )
C. if ( (str != null) || (i == str.length() ) )
D. if ( (str == null) || (i == str.length() ) )

Q&A Set: