18 real Strings & Equality questions from the Java bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is String immutability?
Junior
A.the property that a String object's contents can never change after creation, so any modification yields a new object
B.the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections
C.the comparison that tests whether two references point to the exact same object in memory rather than equal content
D.the method that compares two objects for logical content equality rather than reference identity
A.String immutability — a mutable sequence of characters used to efficiently build or modify text without creating many intermediate objects
B.String immutability — the JVM-managed cache of interned string literals that lets identical literals share a single object
C.String immutability — the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections
D.String immutability — the property that a String object's contents can never change after creation, so any modification yields a new object
A.equals method — the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections
B.equals method — a mutable sequence of characters used to efficiently build or modify text without creating many intermediate objects
C.equals method — the method that compares two objects for logical content equality rather than reference identity
D.equals method — the property that a String object's contents can never change after creation, so any modification yields a new object
A.== operator on objects — the comparison that tests whether two references point to the exact same object in memory rather than equal content
B.== operator on objects — the JVM-managed cache of interned string literals that lets identical literals share a single object
C.== operator on objects — the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections
D.== operator on objects — the method that compares two objects for logical content equality rather than reference identity
14. Which term means: "the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections"?
A.hashCode contract — a mutable sequence of characters used to efficiently build or modify text without creating many intermediate objects
B.hashCode contract — the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections
C.hashCode contract — the method that compares two objects for logical content equality rather than reference identity
D.hashCode contract — the comparison that tests whether two references point to the exact same object in memory rather than equal content
A.StringBuilder — the method that compares two objects for logical content equality rather than reference identity
B.StringBuilder — the rule that two objects considered equal must return the same integer hash, required for correct behavior in hash-based collections
C.StringBuilder — a mutable sequence of characters used to efficiently build or modify text without creating many intermediate objects
D.StringBuilder — the comparison that tests whether two references point to the exact same object in memory rather than equal content
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.