Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Echostar' - 3 question(s) found - Order By Newest | ||||
Advanced level question. Frequently asked in High end product companies. Frequently asked in Google , Cognizant and Deloitte ( Based on 2 feedback ) | ||||
| ||||
Ans. 1. String Pool - When a string is created and if it exists in the pool, the reference of the existing string will be returned instead of creating a new object. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references. Example - String str1 = "String1"; String str2 = "String1"; // It doesn't create a new String and rather reuses the string literal from pool // Now both str1 and str2 pointing to same string object in pool, changing str1 will change it for str2 too 2. To Cache its Hashcode - If string is not immutable, One can change its hashcode and hence it's not fit to be cached. 3. Security - String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Making it mutable might possess threats due to interception by the other code segment. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   string   string class   immutable  immutability   advanced Asked in 39 Companies expert   frequent | ||||
Try 4 Question(s) Test | ||||
Related Questions | ||||
Why Char array is preferred over String for storing password? | ||||
How does making string as immutable helps with securing information ? How does String Pool pose a security threat ? | ||||
How is string object immutable if we can concat a string to it ? | ||||
How to implement an immutable class ? | ||||
What is an immutable class ? | ||||
What is an Immutable Object ? | ||||
Does Declaring an object "final" makes it immutable ? | ||||
Is String final in Java ? | ||||
What are stateless objects ? How are they different from immutable objects ? Which of these two is thread safe ? | ||||
Frequently asked question for intermediate developers. Frequently asked in HCL Technologies and EPAM. | ||||
| ||||
Ans. Volatile is a declaration that a variable can be accessed by multiple threads and hence shouldnt be cached. | ||||
Sample Code for volatile | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   synchronization   volatile   java keywords Asked in 42 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
Related Questions | ||||
How does volatile affect code optimization by compiler? | ||||
how is the internal code for the "volatile" implemented ? | ||||
What are the different ways to avoid multi Threading related problems in Java ? | ||||
Can we make array volatile in Java ? | ||||
Have you heard of volatile Table in Teradata ? | ||||
what is volatile and atomic | ||||
| ||||
Ans. https://en.wikipedia.org/wiki/Database_normalization | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  normalization  database Asked in 35 Companies intermediate   frequent | ||||
Related Questions | ||||
Difference between Normalization and Denormalization ? | ||||
Which of the two Normalization / Denormalization facilitate better performance ? Which of the two facilitate better space management ? | ||||