Java SE - Sample Interview Question (Junior Level)

What will be the result of the below code?

import java.util.List;

public class Test1 {
public static void main(String[] args) {
List<String> names = populateNames();;
for(String name:names){
System.out.println(name);
}
}
public static List<String>populateNames(){
return null;
}
}

  1. The code will run well, there will be no output
  2. The code will not compile
  3. There will be a run-time exception
  4. None of the above
Tests in Java SE for Juniors

Test Name Difficulty Time (minutes) No. of Questions
Java Online Test for Juniors Java Junior 60 30

More Specific Tests in Java SE for Juniors

Test Name Difficulty Time (Minutes) No. of Questions
Java-SE-I/O Online Test for Juniors Java - I/O Junior 20 10
Java-SE-Concurrency-Utilities Online Test for Juniors Java - Concurrency Utilities Junior 20 10
Java-SE-Security Online Test for Juniors Java - Security Junior 20 10
Java-SE-Algorithms Online Test for Juniors Java - Algorithms Junior 20 10
Java-SE-Collections-Framework Online Test for Juniors Java - Collections Framework Junior 20 10
Java-SE-Language-Fundamentals Online Test for Juniors Java - Language Fundamentals Junior 20 10
Java-SE-Generics Online Test for Juniors Java - Generics Junior 20 10