Interview Questions and Answers - Order By Newest Q3411. 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 Q3412. 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 Q3413. Can we specify that a particular variable may have either of the two data types in Typescript ? Typescript
Ans. let result: string | boolean; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3414. How can we specify that a particular variable may have either of the two data types in Typescript ? Typescript
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3415. How can we specify that a particular variable may have either of the two data types in Typescript ? Typescript
Ans. let result: string | boolean; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3416. What does the following declaration mean
let result: string | number; Typescript
Ans. It means we can assign either a string or a number to result. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3417. Will the following code give any error
let result: string | number;
result = true; Typescript
Ans. Yes, result can either be string or a number but not boolean. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3418. Will the following code give any error
let result: string | number;
result = 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3419. Will the following code give any error
let result: string | number;
result = 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3420. Will the following code give any error
let result: boolean;
result = false | true; Typescript
Ans. Yes, | is a bitwise operator and not boolean or. Use || instead Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3421. Will this code give any error ?
let result: boolean;
result = false || true; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3422. Will this code give any error ?
let result: boolean | string;
result = false || 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3423. Will this code give any error ?
let result: string;
result = false || 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3424. 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   Q3425. 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   Q3426. 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   Q3427. 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   Q3428. 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   Q3429. 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   Q3430. 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   Q3431. 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   Q3432. 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 Q3433. 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 Q3434. 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 Q3435. What would you use the span element for ? HTML
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   Q3436. When String literals are compared using ==, they always returns true if the string values are same because .. Reference Core Java
a. of overridden compareTo method b. of overridden compare method c. of String Pool d. == means that the object contents are equalAns.c. of String Pool
Q3437. Which of the following is true ? Core Java
a. Composition is Tightly Bound b. Inheritance is Tightly Bound c. Object can only hold reference of only one other object d. A Class cannot be extended by multiple classesAns.b. Inheritance is Tightly Bound
a. x==y on all literals always returns false b. x.equals(y) on all literals always returns false c. if x.equals(y) returns true, x==y returns true too d. if x.equals(y) returns false, x==y returns trueAns.c. if x.equals(y) returns true, x==y returns true too
a. Constructor without parameters declared by user b. Constructor provided by Java if no constructor is declared c. Constructor with empty body d. All of the aboveAns.b. Constructor provided by Java if no constructor is declared
Q3440. How can we create objects if we make the constructor private ? Core Java
a. We can't create objects if constructor is private b. We can only create objects if we follow singleton pattern c. We can only create one object d. We can create new object through static method or static blockAns.d. We can create new object through static method or static block