LinkedIn Java Skill Assessment Answer

In this article, you will find Java LinkedIn Skill Assessment Answer, Use “Ctrl+F” To Find Any Questions Answer. & For Mobile Users, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Options to Get Any Random Questions Answer.

As you already know that this site does not contain only the Linkedin Assessment Answers here, you can also find the solution for other Assessments also. I.e. Fiverr Skills Test answersGoogle Course AnswersCoursera Quiz Answers, and Competitive Programming like CodeChef Problems Solutions, & Leetcode Problems Solutions.

LinkedIn Java Skill Assessment Answer
LinkedIn Java Skill Assessment Answer

100% Free Updated LinkedIn Java Skill Assessment Certification Exam Questions & Answers.

LinkedIn Java Skill Assessment Details:

  • 15 – 20 multiple-choice questions
  • 1.5 minutes per question
  • Score in the top 30% to earn a badge

Before you start:

You must complete this assessment in one session — make sure your internet is reliable.
You can retake this assessment once if you don’t earn a badge.
LinkedIn won’t show your results to anyone without your permission.
After completing the exam, you will get the verified LinkedIn Java Skill Assessment Badge.

LinkedIn Java Skill Assessment Answer

Q1. Given the string “strawberries” saved in a variable called fruit, what would fruit.substring(2, 5) return?

  •  rawb
  •  raw
  •  awb
  •  traw

Reasoning: The substring method is accepting two arguments.

  • The first argument being the index to start(includes that char at 2)
  • and the second the index of the string to end the substring(excludes the char at 5).
  • Strings in Java are like arrays of chars.
  • Therefore, the method will return “raw” as those are the chars in indexes 2,3, and 4.
  • You can also take the ending index and subtract the beginning index from it, to determine how many chars will be included in the substring (5-2=3).

Q2. How can you achieve runtime polymorphism in Java?

  •  method overloading
  •  method overrunning
  •  method overriding
  •  method calling

Q3. Given the following definitions, which of these expression will NOT evaluate to true?

boolean b1 = true, b2 = false; int i1 = 1, i2 = 2;

  •  (i1 | i2) == 3
  •  i2 && b1
  •  b1 || !b2
  •  (i1 ^ i2) < 4

Q4. What is the output of this code?

1: class Main {
2:   public static void main (String[] args) {
3:     int array[] = {1, 2, 3, 4};
4:     for (int i = 0; i < array.size(); i++) {
5:        System.out.print(array[i]);
6:     }
7:   }
8: }
  •  It will not compile because of line 4.
  •  It will not compile because of line 3.
  •  123
  •  1234

Q5. Which of the following can replace the CODE SNIPPET to make the code below print “Hello World”?

interface Interface1 {
    static void print() {
interface Interface2 {
    static void print() {
  •  super1.print(); super2.print();
  •  this.print();
  •  super.print();
  •  Interface1.print(); Interface2.print();

Q6. What does the following code print?

String str = "abcde";
str.substring(3, 4);
  •  CD
  •  CDE
  •  D
  •  “abcde”

Q7. What is the result of this code?

class Main {
    public static void main (String[] args){
    static Exception print(int i){
        if (i>0) {
            return new Exception();
        } else {
            throw new RuntimeException();
  •  It will show a stack trace with a runtime exception.
  •  “java.lang.Exception”
  •  It will run and throw an exception.
  •  It will not compile.

Q8. Which class can compile given these declarations?

interface One {
    default void method() {
interface Two {
    default void method () {
  •  A
class Three implements One, Two {
    public void method() {
  •  B
class Three implements One, Two {
    public void method() {
  •  C
class Three implements One, Two {
  •  D
class Three implements One, Two {
    public void method() {

Q9. What is the output of this code?

class Main {
    public static void main (String[] args) {
        List list = new ArrayList();
        System.out.print(list.get(0) instanceof Object);
        System.out.print(list.get(1) instanceof Integer);
  •  The code does not compile.
  •  truefalse
  •  truetrue
  •  falsetrue

Q10. Given the following two classes, what will be the output of the Main class?

package mypackage;
public class Math {
    public static int abs(int num){
        return num < 0 ? -num : num;
package mypackage.elementary;
public class Math {
    public static int abs (int num) {
        return -num;
import mypackage.Math;
import mypackage.elementary.*;
class Main {
    public static void main (String args[]){
  •  Lines 1 and 2 generate compiler errors due to class name conflicts.
  •  “-123”
  •  It will throw an exception on line 5.
  •  “123”

Explanation: The answer is “123”. The abs() method evaluates to the one inside mypackage.Math class, because The import statements of the form:

import packageName.subPackage.*

is Type-Import-on-Demand Declarations, which never causes any other declaration to be shadowed.

Q11. What is the result of this code?

1: class MainClass {
2:  final String message(){
3:      return "Hello!";
4:  }
5: }
6: class Main extends MainClass {
7:  public static void main(String[] args) {
8:      System.out.println(message());
9:  }
10: String message(){
11:     return "World!";
12:  }
13: }
  •  It will not compile because of line 10.
  •  “Hello!”
  •  It will not compile because of line 2.
  •  “World!”

Explanation: Compilation error at line 10 because of final methods cannot be overridden, and here message() is a final method, and also note that Non-static method message() cannot be referenced from a static context.

Q12. Given this code, which command will output “2”?

class Main {
    public static void main(String[] args) {
  •  java Main 1 2 "3 4" 5
  •  java Main 1 "2" "2" 5
  •  java Main.class 1 "2" 2 5
  •  java Main 1 "2" "3 4" 5

Q13. What is the output of this code?

class Main {
    public static void main(String[] args){
        int a = 123451234512345;
  •  “123451234512345”
  •  Nothing – this will not compile.
  •  a negative integer value
  •  “12345100000”

Reasoning: The int type in Java can be used to represent any whole number from -2147483648 to 2147483647. Therefore, this code will not compile as the number assigned to ‘a’ is larger than the int type can hold.

Q14. What is the output of this code?

class Main {
    public static void main (String[] args) {
        String message = "Hello world!";
        String newMessage = message.substring(6, 12)
            + message.substring(12, 6);
  •  The code does not compile.
  •  A runtime exception is thrown.
  •  “world!!world”
  •  “world!world!”

Q15. How do you write a foreach loop that will iterate over ArrayList<Pencil>pencilCase?

  •  for (Pencil pencil : pencilCase) {}
  •  for ( {}
  •  for (Pencil pencil : pencilCase.iterator()) {}
  •  for (pencil in pencilCase) {}

Q16. What does this code print?

  •  0
  •  positive number
  •  negative number
  •  compilation error

Q17. You have an ArrayList of names that you want to sort alphabetically. Which approach would NOT work?

  •  names.sort(Comparator.comparing(String::toString))
  •  Collections.sort(names)
  •  names.sort(List.DESCENDING)
  •, s2) -> s1.compareTo(s2)).collect(Collectors.toList())

Q18. By implementing encapsulation, you cannot directly access the class’s _ properties unless you are writing code inside the class itself.

  •  private
  •  protected
  •  no-modifier
  •  public

Q19. Which is the most up-to-date way to instantiate the current date?

  •  new SimpleDateFormat("yyyy-MM-dd").format(new Date())
  •  new Date(System.currentTimeMillis())
  •  Calendar.getInstance().getTime()

Explanation: LocalDate is the newest class added in java 8

Q20. Fill in the blank to create a piece of code that will tell whether int0 is divisible by 5:

boolean isDivisibleBy5 = _____

  •  int0 / 5 ? true: false
  •  int0 % 5 == 0
  •  int0 % 5 != 5
  •  Math.isDivisible(int0, 5)

Q21. How many times will this code print “Hello World!”?

class Main {
    public static void main(String[] args){
        for (int i=0; i<10; i=i++){
            System.out.println("Hello World!");
  •  10 times
  •  9 times
  •  5 times
  •  infinite number of times

Explanation: Observe the loop increment. It’s not an increment, it’s an assignment(post).

Q22. The runtime system starts your program by calling which function first?

  •  print
  •  iterative
  •  hello
  •  main

Q23. What code would you use in Constructor A to call Constructor B?

public class Jedi {
  /* Constructor A */
  Jedi(String name, String species){}
  /* Constructor B */
  Jedi(String name, String species, boolean followsTheDarkSide){}
  •  Jedi(name, species, false)
  •  new Jedi(name, species, false)
  •  this(name, species, false)
  •  super(name, species, false)Note: This code won’t compile, possibly broken code sample.

Q24. Which statement is NOT true?

  •  An anonymous class may specify an abstract base class as its base type.
  •  An anonymous class does not require a zero-argument constructor.
  •  An anonymous class may specify an interface as its base type.
  •  An anonymous class may specify both an abstract class and interface as base types.

Q25. What will this program print out to the console when executed?

import java.util.LinkedList;
public class Main {
    public static void main(String[] args){
        LinkedList<Integer> list = new LinkedList<>();
  •  [5, 1, 10]
  •  [10, 5, 1]
  •  [1, 5, 10]
  •  [10, 1, 5]

Q26. What is the output of this code?

class Main {
    public static void main(String[] args){
       String message = "Hello";
       for (int i = 0; i<message.length(); i++){
  •  “Hello”
  •  A runtime exception is thrown.
  •  The code does not compile.
  •  “ello”

Q27. Object-oriented programming is a style of programming where you organize your program around _ rather than _ and data rather than logic.

  •  functions; actions
  •  objects; actions
  •  actions; functions
  •  actions; objects

Q28. What statement returns true if “nifty” is of type String?

  •  "nifty".getType().equals("String")
  •  "nifty".getType() == String
  •  "nifty".getClass().getSimpleName() == "String"
  •  "nifty" instanceof String

Q29. What is the output of this code?

import java.util.*;
class Main {
	public static void main(String[] args) {
		List<Boolean> list = new ArrayList<>();
		System.out.print(list.get(1) instanceof Boolean);
  •  A runtime exception is thrown.
  •  3false
  •  2true
  •  3true

Q30. What is the result of this code?

1: class Main {
2: 	Object message(){
3: 		return "Hello!";
4: 	}
5: 	public static void main(String[] args) {
6: 		System.out.print(new Main().message());
7: 		System.out.print(new Main2().message());
8: 	}
9: }
10: class Main2 extends Main {
11: 	String message(){
12: 		return "World!";
13: 	}
14: }
  •  It will not compile because of line 7.
  •  Hello!Hello!
  •  Hello!World!
  •  It will not compile because of line 11.

Q31. What method can be used to create a new instance of an object?

  •  another instance
  •  field
  •  constructor
  •  private method

Q32. Which is the most reliable expression for testing whether the values of two string variables are the same?

  •  string1 == string2
  •  string1 = string2
  •  string1.matches(string2)
  •  string1.equals(string2)

Q33. Which letters will print when this code is run?

public static void main(String[] args) {
	try {
	} catch (Exception ex) {
	} finally {
public static void badMethod() {
	throw new Error();
  •  A, B, and D
  •  A, C, and D
  •  C and D
  •  A and D

ExplanationError is not inherited from Exception

Q34. What is the output of this code?

class Main {
	static int count = 0;
	public static void main(String[] args) {
		if (count < 3) {
		} else {
		System.out.println("Hello World!");
  •  It will throw a runtime exception.
  •  It will not compile.
  •  It will print “Hello World!” three times.
  •  It will run forever.

Q35. What is the output of this code?

import java.util.*;
class Main {
	public static void main(String[] args) {
		String[] array = {"abc", "2", "10", "0"};
		List<String> list = Arrays.asList(array);
  •  [abc, 0, 2, 10]
  •  The code does not compile.
  •  [abc, 2, 10, 0]
  •  [0, 10, 2, abc]

Explanation: The java.util.Arrays.asList(T... a) returns a fixed-size list backed by the specified array. (Changes to the returned list “write through” to the array.)

Q36. What is the output of this code?

class Main {
	public static void main(String[] args) {
		String message = "Hello";
		message += "World!";
	static void print(String message){
		message += " ";
  •  Hello World!
  •  HelloHelloWorld!
  •  Hello Hello World!
  •  Hello HelloWorld!

Q37. What is displayed when this code is compiled and executed?

public class Main {
	public static void main(String[] args) {
		int x = 5;
		x = 10;
  •  x
  •  null
  •  10
  •  5

Q38. Which approach cannot be used to iterate over a List named theList?

  •  A
for (int i = 0; i < theList.size(); i++) {
  •  B
for (Object object : theList) {
  •  C
Iterator it = theList.iterator();
for (it.hasNext()) {
  •  D

Explanation: for (it.hasNext()) should be while (it.hasNext()).

Q39. What method signature will work with this code?

boolean healthyOrNot = isHealthy("avocado");

  •  public void isHealthy(String avocado)
  •  boolean isHealthy(String string)
  •  public isHealthy(“avocado”)
  •  private String isHealthy(String food)

Q40. Which are valid keywords in a Java module descriptor (

  •  provides, employs
  •  imports, exports
  •  consumes, supplies
  •  requires, exports

Q41. Which type of variable keeps a constant value once it is assigned?

  •  non-static
  •  static
  •  final
  •  private

Q42. How does the keyword volatile affect how a variable is handled?

  •  It will be read by only one thread at a time.
  •  It will be stored on the hard drive.
  •  It will never be cached by the CPU.
  •  It will be preferentially garbage collected.

Q43. What is the result of this code?

char smooch = 'x';
System.out.println((int) smooch);
  •  an alphanumeric character
  •  a negative number
  •  a positive number
  •  a ClassCastException

Q44. You get a NullPointerException. What is the most likely cause?

  •  A file that needs to be opened cannot be found.
  •  A network connection has been lost in the middle of communications.
  •  Your code has used up all available memory.
  •  The object you are using has not been instantiated.

Q45. How would you fix this code so that it compiles?

public class Nosey {
	int age;
	public static void main(String[] args) {
		System.out.println("Your age is: " + age);
  •  Make age static.
  •  Make age global.
  •  Make age public.
  •  Initialize age to a number.

Q46. Add a Duck called “Waddles” to the ArrayList ducks.

public class Duck {
	private String name;
	Duck(String name) {}
  •  Duck waddles = new Duck(); ducks.add(waddles);
  •  Duck duck = new Duck("Waddles"); ducks.add(waddles);
  •  ducks.add(new Duck("Waddles"));
  •  ducks.add(new Waddles());

Q47. If you encounter UnsupportedClassVersionError it means the code was ___ on a newer version of Java than the JRE ___ it.

  •  executed; interpreting
  •  executed; compiling
  •  compiled; executing
  •  compiled, translating

Q48. Given this class, how would you make the code compile?

public class TheClass {
    private final int x;
  •  A
public TheClass() {
    x += 77;
  •  B
public TheClass() {
    x = null;
  •  C
public TheClass() {
    x = 77;
  •  D
private void setX(int x) {
    this.x = x;
public TheClass() {

Explanation: final class members are allowed to be assigned only in three places: declaration, constructor or an instance-initializer block.

Q49. How many times f will be printed?

public class Solution {
    public static void main(String[] args) {
        for (int i = 44; i > 40; i--) {
  •  4
  •  3
  •  5
  •  A Runtime exception will be thrown

Q50. Which statements about abstract classes are true?

1. They can be instantiated.
2. They allow member variables and methods to be inherited by subclasses.
3. They can contain constructors.
  •  1, 2, and 3
  •  only 3
  •  2 and 3
  •  only 2

Q51. Which keyword lets you call the constructor of a parent class?

  •  parent
  •  super
  •  this
  •  new

Q52. What is the result of this code?

  1: int a = 1;
  2: int b = 0;
  3: int c = a/b;
  4: System.out.println(c);
  •  It will throw an ArithmeticException.
  •  It will run and output 0.
  •  It will not compile because of line 3.
  •  It will run and output infinity.

Q53. Normally, to access a static member of a class such as Math.PI, you would need to specify the class “Math”. What would be the best way to allow you to use simply “PI” in your code?

  •  Add a static import.
  •  Declare local copies of the constant in your code.
  •  This cannot be done. You must always qualify references to static members with the class form which they came from.
  •  Put the static members in an interface and inherit from that interface.

Q54. Which keyword lets you use an interface?

  •  extends
  •  implements
  •  inherits
  •  import

Q55. Why are ArrayLists better than arrays?

  •  You don’t have to decide the size of an ArrayList when you first make it.
  •  You can put more items into an ArrayList than into an array.
  •  ArrayLists can hold more kinds of objects than arrays.
  •  You don’t have to decide the type of an ArrayList when you first make it.

Q56. Declare a variable that holds the first four digits of Π

  •  int pi = 3.141;
  •  decimal pi = 3.141;
  •  double pi = 3.141;
  •  float pi = 3.141;


public class TestReal {
    public static void main (String[] argv)
      double pi = 3.14159265;       //accuracy up to 15 digits
      float pi2 = 3.141F;           //accuracy up to 6-7 digits
      System.out.println ("Pi=" + pi);
      System.out.println ("Pi2=" + pi2);
The default Java type which Java will be using for a float variable will be double.
So, even if you declare any variable as float, what the compiler has to actually do is to assign a double value to a float variable,
which is not possible. So, to tell the compiler to treat this value as a float, that 'F' is used.

Q57. Use the magic power to cast a spell

public class MagicPower {
    void castSpell(String spell) {}
  •  new MagicPower().castSpell("expecto patronum")
  •  MagicPower magicPower = new MagicPower(); magicPower.castSpell();
  •  MagicPower.castSpell("expelliarmus");
  •  new MagicPower.castSpell();

Q58. What language construct serves as a blueprint containing an object’s properties and functionality?

  •  constructor
  •  instance
  •  class
  •  method

Q59. What does this code print?

public static void main(String[] args) {
    int x=5,y=10;
    System.out.println(x+" "+y);
static void swapsies(int a, int b) {
    int temp=a;
  •  10 10
  •  5 10
  •  10 5
  •  5 5

Q60. What is the result of this code?

try {
    System.out.println("Hello World");
} catch (Exception e) {
} catch (ArithmeticException e) {
} finally {
  •  Hello World
  •  It will not compile because the second catch statement is unreachable
  •  Hello World!
  •  It will throw runtime exception

Q61. Which is not a java keyword

  •  finally
  •  native
  •  interface
  •  unsigned

Explanation: native is a part of JNI interface

Q62. Which operator would you use to find the remainder after division?

  •  %
  •  //
  •  /
  •  DIV


Q63. Which choice is a disadvantage of inheritance?

  •  Overridden methods of the parent class cannot be reused.
  •  Responsibilities are not evenly distributed between parent and child classes.
  •  Classes related by inheritance are tightly coupled to each other.
  •  The internal state of the parent class is accessible to its children.


Q64. How would you declare and initialize an array of 10 ints?

  •  Array<Integer> numbers = new Array<Integer>(10);
  •  Array[int] numbers = new Array[int](10);
  •  int[] numbers = new int[10];
  •  int numbers[] = int[10];

Q65. Refactor this event handler to a lambda expression:

groucyButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        System.out.println("Press me one more time..");
  •  groucyButton.addActionListener(ActionListener listener -> System.out.println("Press me one more time..."));
  •  groucyButton.addActionListener((event) -> System.out.println("Press me one more time..."));
  •  groucyButton.addActionListener(new ActionListener(ActionEvent e) {() -> System.out.println("Press me one more time...");});
  •  groucyButton.addActionListener(() -> System.out.println("Press me one more time..."));


Q66. Which functional interfaces does Java provide to serve as data types for lambda expressions?

  •  Observer, Observable
  •  Collector, Builder
  •  Filter, Map, Reduce
  •  Consumer, Predicate, Supplier


Q67. What is a valid use of the hashCode() method?

  •  encrypting user passwords
  •  deciding if two instances of a class are equal
  •  enabling HashMap to find matches faster
  •  moving objects from a List to a HashMap


Q68. What kind of relationship does “extends” denote?

  •  uses-a
  •  is-a
  •  has-a
  •  was-a


Q69. How do you force an object to be garbage collected?

  •  Set object to null and call Runtime.gc()
  •  Set object to null and call System.gc()
  •  Set object to null and call Runtime.getRuntime().runFinalization()
  •  There is no way to force an object to be garbage collected


Q70. Java programmers commonly use design patterns. Some examples are the _, which helps create instances of a class, the _, which ensures that only one instance of a class can be created; and the _, which allows for a group of algorithms to be interchangeable.

  •  static factory method; singleton; strategy pattern
  •  strategy pattern; static factory method; singleton
  •  creation pattern; singleton; prototype pattern
  •  singleton; strategy pattern; static factory method

Q71. Using Java’s Reflection API, you can use _ to get the name of a class and _ to retrieve an array of its methods.

  •  this.getClass().getSimpleName(); this.getClass().getDeclaredMethods()
  •  this.getName(); this.getMethods()
  •  Reflection.getName(this); Reflection.getMethods(this)
  •  Reflection.getClass(this).getName(); Reflection.getClass(this).getMethods()

Q72. Which is not a valid lambda expression?

  •  a -> false;
  •  (a) -> false;
  •  String a -> false;
  •  (String a) -> false;

Q73. Which access modifier makes variables and methods visible only in the class where they are declared?

  •  public
  •  protected
  •  nonmodifier
  •  private

Q74. What type of variable can be assigned to only once?

  •  private
  •  non-static
  •  final
  •  static

Q75. How would you convert a String to an Int?

  •  "21".intValue()
  •  String.toInt("21")
  •  Integer.parseInt("21")
  •  String.valueOf("21")

Q76. What method should be added to the Duck class to print the name Moby?

public class Duck {
    private String name;
    Duck(String name) { = name;
    public static void main(String[] args) {
        System.out.println(new Duck("Moby"));
  •  public String toString() { return name; }
  •  public void println() { System.out.println(name); }
  •  String toString() { return; }
  •  public void toString() { System.out.println(; }

Q77. Which operator is used to concatenate Strings in Java

  •  +
  •  &
  •  .
  •  -


Q78. How many times does this loop print “exterminate”?

for (int i = 44; i > 40; i--) {
  •  two
  •  four
  •  three
  •  five

Q79. What is the value of myCharacter after line 3 is run?

1: public class Main {
2:   public static void main (String[] args) {
3:     char myCharacter = "piper".charAt(3);
4:   }
5: }
  •  p
  •  r
  •  e
  •  i

Q80. When should you use a static method?

  •  when your method is related to the object’s characteristics
  •  when you want your method to be available independently of class instances
  •  when your method uses an object’s instance variable
  •  when your method is dependent on the specific instance that calls it

Q81. What phrase indicates that a function receives a copy of each argument passed to it rather than a reference to the objects themselves?

  •  pass by reference
  •  pass by occurrence
  •  pass by value
  •  API call

Q82. In Java, what is the scope of a method’s argument or parameter?

  •  inside the method
  •  both inside and outside the method
  •  neither inside nor outside the method
  •  outside the method

Q83. What is the output of this code?

public class Main {
  public static void main (String[] args) {
    int[] sampleNumbers = {8, 5, 3, 1};
  •  5
  •  8
  •  1
  •  3

Q84. Which change will make this code compile successfully?

1: public class Main {
2:   String MESSAGE ="Hello!";
3:   static void print(){
4:     System.out.println(message);
5:   }
6:   void print2(){}
7: }
  •  Change line 2 to public static final String message
  •  Change line 6 to public void print2(){}
  •  Remove the body of the print2 method and add a semicolon.
  •  Remove the body of the print method.

Explanation: Changing line 2 to public static final String message raises the error message not initialized in the default constructor

Q85. What is the output of this code?

import java.util.*;
class Main {
  public static void main(String[] args) {
    String[] array = new String[]{"A", "B", "C"};
    List<String> list1 = Arrays.asList(array);
    List<String> list2 = new ArrayList<>(Arrays.asList(array));
    List<String> list3 = new ArrayList<>(Arrays.asList("A", new String("B"), "C"));
  •  falsefalse
  •  truetrue
  •  falsetrue
  •  truefalse

Q86. Which code snippet is valid?

  •  ArrayList<String> words = new ArrayList<String>(){"Hello", "World"};
  •  ArrayList words = Arrays.asList("Hello", "World");
  •  ArrayList<String> words = {"Hello", "World"};
  •  ArrayList<String> words = new ArrayList<>(Arrays.asList("Hello", "World"));

Q87. What is the output of this code?

class Main {
  public static void main(String[] args) {
    StringBuilder sb = new StringBuilder("hello");
    sb.deleteCharAt(0).insert(0, "H")." World!";
  •  A runtime exception is thrown.
  •  “HelloWorld!”
  •  “hello”
  •  ????

Q88. How would you use the TaxCalculator to determine the amount of tax on $50?

class TaxCalculator {
  static calculate(total) {
    return total * .05;
  •  TaxCalculator.calculate(50);
  •  new TaxCalculator.calculate(50);
  •  calculate(50);
  •  new TaxCalculator.calculate($50);

Note: This code won’t compile, broken code sample


Code sample

Q89. Which characteristic does not apply to instances of java.util.HashSet=

  •  uses hashcode of objects when inserted
  •  contains unordred elements
  •  contains unique elements
  •  contains sorted elements

Explanation: HashSet makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time.


Q90. What is the output?

import java.util.*;
public class Main {
	public static void main(String[] args)
		PriorityQueue<Integer> queue = new PriorityQueue<>();
		while (queue.isEmpty() == false) {
			System.out.printf("%d", queue.remove());
  •  1 3 2 4
  •  4 2 3 1
  •  1 2 3 4
  •  4 3 2 1

Q91. What will this code print, assuming it is inside the main method of a class?

System.out.println("hello my friends".split(" ")[0]);

  •  my
  •  hellomyfriends
  •  hello
  •  friends

Q92. You have an instance of type Map<String, Integer> named instruments containing the following key-value pairs: guitar=1200, cello=3000, and drum=2000. If you add the new key-value pair cello=4500 to the Map using the put method, how many elements do you have in the Map when you call instruments.size()?

  •  2
  •  When calling the put method, Java will throw an exception
  •  4
  •  3

Q93. Which class acts as root class for Java Exception hierarchy?

  •  Clonable
  •  Throwable
  •  Object
  •  Serializable

Q94. Which class does not implement the java.util.Collection interface?

  •  java.util.Vector
  •  java.util.ArrayList
  •  java.util.HashSet
  •  java.util.HashMap

Explanation: HashMap class implements Map interface.

Q95. You have a variable of named employees of type List<Employee> containing multiple entries. The Employee type has a method getName() that returns te employee name. Which statement properly extracts a list of employee names?

  •  employees.collect(employee -> employee.getName());
  •  employees.filter(Employee::getName).collect(Collectors.toUnmodifiableList());
  • -> e.getName());

Q96. This code does not compile. What needs to be changed so that it does?

public enum Direction {
    private final String shortCode;
    public String getShortCode() {
        return shortCode;
  •  Add a constructor that accepts a String parameter and assigns it to the field shortCode.
  •  Remove the final keyword for the field shortCode.
  •  All enums need to be defined on a single line of code.
  •  Add a setter method for the field shortCode.

Q97. Which language feature ensures that objects implementing the AutoCloseable interface are closed when it completes?

  •  try-catch-finally
  •  try-finally-close
  •  try-with-resources
  •  try-catch-close

Q98. What code should go in line 3?

class Main {
    public static void main(String[] args) {
        array[0] = new int[]{1, 2, 3};
        array[1] = new int[]{4, 5, 6};
        array[2] = new int[]{7, 8, 9};
        for (int i = 0; i < 3; i++)
            System.out.print(array[i][1]); //prints 258
  •  int[][] array = new int[][];
  •  int[][] array = new int[3][3];
  •  int[][] array = new int[2][2];
  •  int[][] array = [][];

Q99. Is this an example of method overloading or overriding?

class Car {
    public void accelerate() {}
class Lambo extends Car {
    public void accelerate(int speedLimit) {}
    public void accelerate() {}
  •  neither
  •  both
  •  overloading
  •  overriding

Q100. Which choice is the best data type for working with money in Java?

  •  float
  •  String
  •  double
  •  BigDecimal


Q101. Which statement about constructors is not ture?

  •  A class can have multiple constructors with a different parameter list.
  •  You can call another constructor with this or super.
  •  A constructor does not define a return value.
  •  Every class must explicitly define a constructor without parameters.

Q102. What language feature allows types to be parameters on classes, interfaces, and methods in order to reuse the same code for different data types?

  •  Regular Expressions
  •  Reflection
  •  Generics
  •  Concurrency

Q103. What will be printed?

public class Berries{
    String berry = "blue";
    public static void main( String[] args ) {
        new Berries().juicy( "straw" );
    void juicy(String berry){
        this.berry = "rasp";
        System.out.println(berry + "berry");
  •  raspberry
  •  strawberry
  •  blueberry
  •  rasp

Q104. What is the value of forestCount after this code executes?

Map<String, Integer> forestSpecies = new HashMap<>();
forestSpecies.put("Amazon", 30000);
forestSpecies.put("Congo", 10000);
forestSpecies.put("Daintree", 15000);
forestSpecies.put("Amazon", 40000);
int forestCount = forestSpecies.size();
  •  3
  •  4
  •  2
  •  When calling the put method, Java will throw an exception

Q105. What is a problem with this code?

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
class Main {
    public static void main( String[] args ) {
        List<String> list = new ArrayList<String>( Arrays.asList( "a", "b", "c" ) );
        for( String value :list ){
            if( value.equals( "a" ) ) {
                list.remove( value );
        System.out.println(list); // outputs [b,c]
  •  String should be compared using == method instead of equals.
  •  Modifying a collection while iterating through it can throw a ConcurrentModificationException.
  •  The List interface does not allow an argument of type String to be passed to the remove method.
  •  ArrayList does not implement the List interface.

Q106. How do you convert this method into a lambda expression?

public int square(int x){
    return x * x;
  •  Function<Integer, Integer> squareLambda = (int x) -> { x * x };
  •  Function<Integer, Integer> squareLambda = () -> { return x * x };
  •  Function<Integer, Integer> squareLambda = x -> x * x;
  •  Function<Integer, Integer> squareLambda = x -> return x * x;

Q107. Which choice is a valid implementation of this interface?

interface MyInterface {
    int foo(int x);
  •  A
public class MyClass implements MyInterface {
    // ....
    public void foo(int x){
  •  B
public class MyClass implements MyInterface {
    // ....
    public double foo(int x){
        return x * 100;
  •  C
public class MyClass implements MyInterface {
    // ....
    public int foo(int x){
        return x * 100;
  •  D
public class MyClass implements MyInterface {
    // ....
    public int foo(){
        return 100;

Q108. What is the result of this program?

interface Foo{
    int x = 10;
public class Main{
    public static void main( String[] args ) {
        Foo.x = 20;
  •  10
  •  20
  •  null
  •  An error will occur when compiling.

Q109. Which statement must be inserted on line 1 to print the value true?

2: Optional<String> opt = Optional.of(val);
3: System.out.println(opt.isPresent());
  •  Integer val = 15;
  •  String val = "Sam";
  •  String val = null;
  •  Optional<String> val = Optional.empty();

Q110. What will this code print, assuming it is inside the main method of a class?

System.out.println(true && false || true);
System.out.println(false || false && true);
  •  false
  •  true
  •  true
  •  false

Q111. What will this code print?

List<String> list1 = new ArrayList<>();
list1.add( "One" );
list1.add( "Two" );
list1.add( "Three" );
List<String> list2 = new ArrayList<>();
list2.add( "Two" );
list1.remove( list2 );
  •  [Two]
  •  [One, Two, Three]
  •  [One, Three]
  •  Two

Q112. Which code checks whether the characters in two Strings,named time and money, are the same?

  •  if(time <> money){}
  •  if(time.equals(money)){}
  •  if(time == money){}
  •  if(time = money){}

Q113. An _ is a serious issue thrown by the JVM that the JVM is unlikely to recover from. An _ is an unexpected event that an application may be able to deal with in order to continue execution.

  •  exception,assertion
  •  AbnormalException, AccidentalException
  •  error, exception
  •  exception, error

Q114. Which keyword would not be allowed here?

class Unicorn {
    _____ Unicorn(){}
  •  static
  •  protected
  •  public
  •  void

Q115. Which OOP concept is this code an example of?

List[] myLists = {
    new ArrayList<>(),
    new LinkedList<>(),
    new Stack<>(),
    new Vector<>(),
for (List list : myLists){
  •  composition
  •  generics
  •  polymorphism
  •  encapsulation

Explanation: switch between different implementations of the List interface

Q116. What does this code print?

String a = "bikini";
String b = new String("bikini");
String c = new String("bikini");
System.out.println(a == b);
System.out.println(b == c);
  •  true; false
  •  false; false
  •  false; true
  •  true; true

Explanation: == operator compares the object reference. String a = "bikini"; String b = "bikini"; would result in True. Here new creates a new object, so false. Use equals() method to compare the content.

Q117. What keyword is added to a method declaration to ensure that two threads do not simultaneously execute it on the same object instance?

  •  native
  •  volatile
  •  synchronized
  •  lock

Java Documentation: Synchronized methods

Q118. Which is a valid type for this lambda function?

_____ oddOrEven = x -> {
    return x % 2 == 0 ? "even" : "odd";
  •  Function<Integer, Boolean>
  •  Function<String>
  •  Function<Integer, String>
  •  Function<Integer>


Q119. What is displayed when this code is compiled and executed?

import java.util.HashMap;
public class Main {
    public static void main(String[] args) {
        HashMap<String, Integer> pantry = new HashMap<>();
        pantry.put("Apples", 3);
        pantry.put("Oranges", 2);
        int currentApples = pantry.get("Apples");
        pantry.put("Apples", currentApples + 4);
  •  6
  •  3
  •  4
  •  7


Q120. What variable type should be declared for capitalize?

List<String> songTitles = Arrays.asList("humble", "element", "dna");
_______ capitalize = (str) -> str.toUpperCase();;
  •  Function<String, String>
  •  Stream<String>
  •  String<String, String>
  •  Map<String, String>


Q121. Which is the correct return type for the processFunction method?

_____ processFunction(Integer number, Function<Integer, String> lambda) {
        return lambda.apply(number);
  •  Integer
  •  String
  •  Consumer
  •  Function<Integer, String>


Q122. What function could you use to replace slashes for dashes in a list of dates?

List<String> dates = new ArrayList<String>();
// missing code
  •  UnaryOperator<String> replaceSlashes = date -> date.replace("/", "-");
  •  Function<String, String> replaceSlashes = dates -> dates.replace("-", "/");
  •  Map<String, String> replaceSlashes = dates.replace("/", "-");
  •  Consumer<Date> replaceSlashes = date -> date.replace("/", "-");

Explanation: replaceAll method for any List only accepts UnaryOperator to pass every single element into it then put the result into the List again.

Q123. From which class do all other classes implicitly extend?

  •  Object
  •  Main
  •  Java
  •  Class


Q124. How do you create and run a Thread for this class?

public class CurrentDateRunnable implements Runnable {
    public void run () {
        while (true) {
            System.out.println("Current date: " + new Date());
            try {
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
  •  Thread thread = new Thread(new CurrentDateRunnable()); thread.start();
  •  new Thread(new CurrentDateRunnable()).join();
  •  new CurrentDateRunnable().run();
  •  new CurrentDateRunnable().start();


Q125. Which expression is a functional equivalent?

List<Integer> numbers = List.of(1,2,3,4);
int total = 0;
for (Integer x : numbers) {
    if (x % 2 == 0)
    total += x * x;
  •  A
int total =
                        .transform(x -> x * x)
                        .filter(x -> x % 2 == 0)
                        .sum ();
  •  B
int total =
                        .filter(x -> x % 2 == 0)
  •  C
int total =
                        .mapToInt (x -> {if (x % 2 == 0) return x * x;})
  •  D
int total =
                        .filter(x -> x % 2 == 0)
                        .mapToInt(x -> x * x)

Explanation: The given code in the question will give you the output 20 as total

numbers                         // Input `List<Integer>` > [1, 2, 3, 4] <br>
    .stream()                   // Converts input into `Stream<Integer>` <br>
    .filter(x -> x % 2 == 0)    // Filter even numbers and return `Stream<Integer>` > [2, 4] <br>
    .mapToInt(x -> x * x)       // Square the number, converts `Integer` to an `int`, and returns `IntStream` > [4, 16] <br>
    .sum()                      // Returns the sum as `int` > 20

Q126. Which is not one of the standard input/output streams provided by java.lang.System?

  •  print
  •  out
  •  err
  •  in

Q127. The compiler is complaining about this assignment of the variable pickle to the variable jar. How woulld you fix this?

double pickle = 2;
int jar = pickle;
  •  Use the method toInt() to convert pickle before assigning it to jar.
  •  Cast pickle to an int before assigning it to jar.
  •  Make pickle into a double by adding + “.0”
  •  Use the new keyword to create a new Integer from pickle before assigning it to jar.

Q128. What value should x have to make this loop execute 10 times?

for(int i=0; i<30; i+=x) {}
  •  10
  •  3
  •  1
  •  0

Q129. The _ runs compiled Java code, while the _ compiles Java files.

  •  IDE; JRE
  •  JDK; IDE
  •  JRE; JDK
  •  JDK; JRE


Q130. Which packages are part of Java Standard Edition

  •  java.util
  •  java.lang
  •  All above


Q131. What values for x and y will cause this code to print “btc”?

String buy = "bitcoin";
System.out.println(buy.substring(x, x+1) + buy.substring(y, y+2))
  •  int x = 0; int y = 2;
  •  int x = 1; int y = 3;
  •  int x = 0; int y = 3;
  •  int x = 1; int y = 3;

Q132. Which keyword would you add to make this method the entry point of the program?

  •  exception
  •  args
  •  static
  •  String


Q133. You have a list of Bunny objects that you want to sort by weight using Collections.sort. What modification would you make to the Bunny class?

  •  Implement the comparable interface by overriding the compareTo method.
  •  Add the keyword default to the weight variable.
  •  Override the equals method inside the Bunny class.
  •  Implement Sortable and override the sortBy method.


Disclaimer:  Hopefully, this article will be useful for you to find all the LinkedIn Java Skill Assessment Answer and grab some premium knowledge with less effort. If this article really helped you in any way then make sure to share it with your friends on social media and let them also know about this amazing Skill Assessment Test.  the solution is provided by Chase2learn. This tutorial is only for Educational and Learning purpose.

Please share our posts on social media platforms and also suggest to your friends to Join Our Groups. Don’t forget to subscribe. 


What is Linkedin Assessment?

The LinkedIn Skill Assessments feature allows you to demonstrate your knowledge of the skills you’ve added to your profile by completing assessments specific to those skills. LinkedIn skills evaluations are a means to demonstrate the skills of job hunters. This is how LinkedIn Skill Assessments can be used.

Is this Skill Assessment Test is free?

Yes, LinkedIn Java Skill Assessment Answer is totally free on LinkedIn for you. The only thing is needed i.e. your dedication toward learning.

When I will get Skill Badge?

Yes, if will Pass the Skill Assessment Test, then you will earn a skill badge that will reflect in your LinkedIn profile. For passing in LinkedIn Skill Assessment, you must score 70% or higher, then only you will get your to skill badge.

How to participate in skill quiz assessment?

It’s good practice to update and tweak your LinkedIn profile every few months. After all, life is dynamic and (I hope) you’re always learning new skills. You will notice a button under the Skills & Endorsements tab within your LinkedIn Profile: ‘Take skill quiz.‘ Upon clicking, you will choose your desired skill test quiz and complete your assessment.

LinkedIn Skill Assessments are a series of multiple-choice exams that allow you to prove the skills that are stated in your profile.

How to get Linkedin Skill Badge?

For getting Linkedin Badge in your profile, you need to score at least 70% and above for getting recognition of skill badges.

If you “grade in the 70th percentile or above”—according to LinkedIn—you officially pass and get a LinkedIn skill badge. The social media site will display your badge on your profile.

How long is Skill Assessment valid for?

Skills assessments that do not specify an expiry date are valid for 3 years from the date of the assessment. If more than 3 years have passed by the time the visa application is made, the skills assessment will no longer be valid.

What is the Benefit of Linkedin Skill Assessment?

  • Chances of getting hired will be increased.
  • You will earn Linkedin Skill Badge.
  • Your Linkedin Profile will rank on top.
  • You have a chance to get jobs earlier.
  • This Skill Assessment will enhance your technical skills, helps you to get recognized by top recruiters, and advanced your knowledge by testing your mind.

Who can give this Linkedin Skill Assessment Test?

Any Linkedin User, Any engineer, developer, or programmer, who wants to improve their Programming Skills
Anyone interested in improving their whiteboard coding skills
Anyone who wants to become a Software Engineer, SDE, Data Scientist, Machine Learning Engineer, etc.
Any students in college who want to start a career in Data Science
Students who have at least high school knowledge in math and who want to start learning data structures
Any self-taught programmer who missed out on a computer science degree.

How to do LinkedIn skill assessment

The LinkedIn Skill Assessments feature allows you to demonstrate your knowledge of the skills you’ve added on your profile by completing assessments specific to those skills.

A typical assessment consists of 15 multiple choice questions and each question tests at least one concept or subskill. The questions are timed and must be completed in one session. You can view the full list of available Skill Assessments and sample questions for each.

Available Skill Assessments on LinkedIn

.NET FrameworkAgile Methodologies, Amazon Web Services (AWS), Android, AngularJS, Angular, AutoCAD, AWS, Bash, C, C#, C++, CSS, GIT, Hadoop, HTML, Java, JavaScript, jQuery, JSON, Maven, and MS Vision, QuickBooks, Revit, etc.

What You Need to Know About LinkedIn Skill Assessments

During a job search, wouldn’t it be great to have a way to prove your proficiency in a specific skill to hiring managers?

Well, now there is. On September 17, LinkedIn launched its new Skill Assessments feature. These are online assessments you can take to demonstrate your proficiency in an area such as MS Excel or jQuery. All assessments have been designed by subject matter and LinkedIn Learning experts, and they’re based on an in-depth content creation and review process. Moreover, these assessments seem to be well received: Research shows that job seekers who’ve completed LinkedIn Skill Assessments are approximately 30 percent more likely to get hired than those who haven’t.

How LinkedIn Skill Assessments work
To take an assessment, all you have to do is navigate to the skills section of your profile and select the relevant Skill Assessment. Note that the test is timed. If you have a disability, you can activate the accessibility for the Skill Assessment feature. This will allow you additional time to complete each question.

Your score is private by default, meaning that you can control the visibility of the results. If you score in the 70th percentile or higher, you’ll pass the assessment and have the option of displaying a “verified skill” badge on your profile. If you don’t pass, you can take the assessment again once you’ve brushed up your skills. However, keep in mind that you can only take each assessment once per three months

When you’ve completed an assessment, LinkedIn provides you with an outline of your results. In addition, for a limited time, it offers relevant LinkedIn Learning courses for free so you can improve further. You’ll also receive relevant job recommendations.

According to Andrew Martins in his Business News Daily article “LinkedIn Users Can Now Showcase Skill Assessments,” the following assessments are currently available:

Adobe Acrobat, Angular, AWS, Bash, C, C#, C++, CSS, GIT, Hadoop, HTML, Java, Javascript, jQuery, JSON, Maven, MongoDB, MS Excel, MS PowerPoint, MS Project, MS SharePoint, MS Visio, Node.js, Objective-C, PHP, Python, QuickBooks, Ruby, Ruby on Rails, Scala, Swift, WordPress, and XML. Experts believe that there are also more, non-technical assessments in the making.

A good way to showcase your skills
LinkedIn Skill Assessments offer a brilliant way for you to showcase your abilities to potential employers while at the same time giving you the opportunity to hone your skills even further. So, take advantage of what’s offered — and use it to maximize your employability!


Leave a Comment