Interview Questions and Answers - Order By Newest Q3141. How do you achieve String immutability ? Core Java
This question was recently asked at 'Polaris'.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 1 Companies This question was recently asked at 'Fujitsu'.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 1 Companies Q3143. Write a program to find the 10th prime number. Ruby
Ans. def isPrimeNumber(n):
if(n<=1):
return False:
for i range(2,n):
if(n%i==0):
return False
return True
n=isPrimeNumber(11)
print(n) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3144. What is the time complexity and space complexity of reversing a Linked List ? Data Structure
Ans. o(n) for time complexity
o(1) for space complexity Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3145. Write a program to rotate a matrix. Core Java
Ans. public class Matrix {
public static void main(String[] args) {
int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
Matrix.rotateMatrix(matrix);
for (int i = 0; i < matrix.length; i ){
for (int j = 0; j < matrix.length; j ){
System.out.print(matrix[i][j] " ");
}
System.out.println();
}
}
public static void rotateMatrix(int[][] matrix){
int row = matrix.length;
//first find the transpose of the matrix.
for (int i = 0; i < row; i ){
for (int j = i; j < row; j ){
int temp = matrix[i][j];
matrix[i][j] = matrix[j][i];
matrix[j][i] = temp;
}
}
//reverse each row
for (int i = 0; i< row; i ){
for(int j = 0; j< row/2; j ){
int temp = matrix[i][j];
matrix[i][j] = matrix[i][row - 1 - j];
matrix[i][row - 1 - j] = temp;
}
}
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q3146. Given 3 arrays - A, B and C, Write all elements from C that are a sum of 1 element from A and 1 from B.
For example -
A -[1,2,4,6]
B-[3,9]
C-[2,4,5,6,7,9,10,12,15]
Output - 4,5,7,9,15
Ans. public class MyClass {
static boolean binarySearch(int [] c, int start, int end, int value) {
while (start <= end) {
int mid = (start end) / 2;
if (c[mid] == value) {
return true;
}
if (c[mid] > value) {
end = mid - 1;
} else {
start = mid 1;
}
}
return false;
}
public static void main(String args[]) {
int [] a = new int[] {1,2,4,6};
int [] b = new int[] {3,9};
int [] c = new int[] {2,4,5,6,7,9,10,12,15};
for (int i = 0; i < a.length; i ) {
for(int j = 0; j < b.length; j ) {
int value = a[i] b[j];
boolean find = binarySearch(c, 0, c.length - 1, value);
if (find) {
System.out.print(value " ");
}
}
}
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q3147. Write an algorithm to shift a linked list n positions. Data Structure
This question was recently asked at 'Amdocs'.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 1 Companies Q3148. What are FPGA's ?
This question was recently asked at 'Intel'.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 1 Companies Q3149. What are the pros and cons of Lambda expressions ? Core Java
This question was recently asked at 'Number 8'.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 1 Companies This question was recently asked at 'Barclays'.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  Google Cloud Platform (GCP)  Amazon Web Services (AWS) Asked in 1 Companies Q3151. What kind of deployable is created for the angular project ? Angular Js
This question was recently asked at 'Barclays'.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 1 Companies Q3152. What would you do if your rest services aren't responding fast enough ? Rest
This question was recently asked at 'Symantec,Barclays'.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 Q3153. If you see a terrible code, Would you rewrite it. If yes , Why ?
This question was recently asked at 'McLead Software'.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 1 Companies Q3154. If you are given a stack trace , what would you look for ?
This question was recently asked at 'Mcleod Software'.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 1 Companies Q3155. Write a program to make a triangle of stars.
This question was recently asked at 'Oracle'.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 1 Companies Q3156. Explain SOLID principles. Design
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   Q3157. Explain the lifecycle methods of a Dojo widget. Dojo
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   Q3158. What are the ways we can get over XSS or cross site scripting vulnerability ? Security
Ans. The counter measures of XSS are input validation and implementing a CSP (Content Security Policy). Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Cross Site Scripting  XSS Asked in 1 Companies Q3159. How can an XSS attack harm a system ? Security
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  xss Q3160. Write a code to detect the longest palindromic substring Core Java
This question was recently asked at 'Google'.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 1 Companies Q3161. What is headless mode in Java ? Why is it used ? Core Java
Ans. It’s a mode that can be used for creating Back end application without the front end UI.
The advantage is that it reduces the number of packages that needs to be loaded ( by ignoring ui packages ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java headless Q3162. What are the distinguished qualities in Java that no other language possess ? Core Java
Ans. Java is widely adopted as an enterprise standard technology across business domains and technical domains ( Web , Desktop , mobile , data science etc ) and has a vast ecosystem of frameworks and libraries. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3163. What is ServerSocket in Java ? Core Java
Ans. This class implements server sockets. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3164. Can anonymous class implement interface and extend a class Core Java
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  Ans. Private, Public, Hybrid, Community Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Google Cloud Platform (GCP) Asked in 1 Companies Q3166. Explain switch and router
This question was recently asked at 'Reliance Jio'.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 1 Companies Q3167. How to get collections from a Stream Core Java
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  Java 8Ans. class:- A class describe the contents of an object, an it describe the detail of data field called instance variable and defines the operations called method.
Object:-An object is an element of a class. Object have the behaviors of their class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q3169. Difference between merge and update in hibernate Hibernate
This question was recently asked at 'Nucleus Software'.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 1 Companies Q3170. What is the programming language used to build Jenkins? Jenkins
Ans. There is a diverse set of programming languages used in Jenkins, including but not limited to: Java, JavaScript, Groovy, Golang, Ruby, Shell scripts Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies