Interview Questions and Answers for 'A' - 3077 question(s) found - Order By Rating Q1. What is Array.Map function ? What will be output of following ?
const myArray = [1, 4, 9, 16];
const result = myArray.map(x => x * 2); Javascript
Ans. It will create an array with each value as x*2
[2, 8, 18, 32] Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q2. What is systemd in Unix ? Unix
This question was recently asked at 'Broadcom, Symantec'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q3. Why cannot we initialize a final field within the constructor if the initialization is within try block ? Core Java
Ans. What if the initialization throws an exception. In that case , it will let it move forward without initializing the final field. So it's a way to enforce that either the field is initialized or it fails completely. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops Q4. Can we initialize final fields within the constructor ? Why ? Core Java
Ans. Yes, Because final fields needs to be initialized before the construction of the object completes. Not necessarily at the time of class loading. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops Q5. Can we have a directive that get's applied based on an attribute on a field ? Angular
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q6. How can we add a particular styling to a field based on a condition ? Angular
Ans. We can create a directive to do that. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q7. What is the use of ElementRef in angular ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q8. What is the use of Renderer class in angular ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q9. What is the use of NgControl ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q10. Can we have multiple selectors for a directive in Angular ? Angular
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q11. How can we add a text in front of all input fields in an application ? Angular
Ans. We can create a directive with selector as 'input' and then onInit of the directive , we can append the text to the input control html. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q12. Can we get the validators for a control in angular ? How ? Angular
Ans. No - https://github.com/angular/angular/issues/13461 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q13. Is it safe to use session storage ? Javascript
Ans. Session storage can be accessed from XSS (Cross site Scripting) attacks but cookies (if set with "HttpOnly" and "Secure" flags) are more safer against these attacks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  session storage  security Q14. How can you trim all strings in an array ?
Ans. array.map(s => s.trim()) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   angular   typescript   javascript Q15. What does this warning message for the unit test means
WARN: 'Spec has no expectations.' Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Junit   Jasmine   Karma Q16. Do you ever merge changes from one feature branch to another ? Why ? SCM
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  SCM  Source Code Management  Configuration Control  Git  Svn This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory management  heap memory   heap allocation expert Q18. What resources are shared between threads ? Threads
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory management  heap memory expert Q20. How can we sort an observable of a user array on user name ( name being one of the field of user ) ? RxJs
Ans. userArrayObservable.pipe(
map(userArray => {
return userArray.sort(comparator);
});
) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Angular Q21. Can we specify multiple maps within pipe ? RxJs
Ans. Yes, it's same as passing multiple methods within pipe. Output of one map is passed to second and so on. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Angular Q22. Can we specify multiple functions in the pipe ? What happens if we do it ? RxJs
Ans. Yes, We can specify multiple functions within pipe method. In that case first function get's called with the observable , the response if then passed to the second method and so on. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Angular Q23. Why do we do transformation on the observable itself rather than doing it in the subscriber ? RxJs
Ans. Because that way we just need to do that transformation at one place and not within each subscriber. Single source of truth. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Angular   Observable  Suscriber Q24. What do we specify within the pipe method ? RxJs
Ans. Operator function to which an observable is passed for transformation. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Angular Q25. What does pipe does on an observable ? RxJs
Ans. With pipe we specify the operator function to which this observable is passed for transforming the observable. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Angular   Observable Q26. What is the difference between Subject and Observable ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  subject vs observable Q27. What is the difference between subscribe and unsubscribe ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  RxJs   subscribe vs unsubscribe Q28. What is the difference between subscribe and emit ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  subscribe vs emit Q29. Have you ever faced problem because of some listener / observers / subscriber performing action on the subscription which you don't want ? How did you fix the problem ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q30. What is the difference between closing and completing the observer / listener ? Angular
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  observer   listener