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 'Knoldus Software' - 10 question(s) found - Order By Rating | ||||
| ||||
Ans. An exception is an unwanted or unexpected event, which occurs during the execution of a program that is at run time, that disrupts the normal flow of the program?s instructions. these are different types arithmetic exceptions, class not found exception, interrupted exception, run time exception etc. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. if you are creating your own exception is known as custom exception. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. Class lengofstring { Public static void main(String[] arr) { int i = 0; String s = "hello world!"; for (char C: s.toCharArray()) i; System.out.println("Length: " i); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. import java.util.Scanner; public class Prime { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter n to compute the nth prime number: "); int nth = sc.nextInt(); int num, count, i; num=1; count=0; while (count < nth){ num=num 1; for (i = 2; i <= num; i ) { if (num % i == 0) { break; } } if ( i == num) { count = count 1; } } System.out.println("Value of nth prime: " num); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. int main () { int a []={1..n}; int miss=getMiss (a,n); Printf ("%d",miss); } getMiss (int a [],int n){ int I,total; total=(n 1)*(n 2); for (i = 0; i < n; i++) total -= a[i]; return total; } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. class Rotate{ void leftRotate(int arr[], int d, int n) { for (int i = 0; i < d; i ) leftRotatebyOne(arr, n); } void leftRotatebyOne(int arr[], int n) { int i, temp; temp = arr[0]; for (i = 0; i < n - 1; i ) arr[i] = arr[i 1]; arr[i] = temp; } void printArray(int arr[], int n) { for (int i = 0; i < n; i ) System.out.print(arr[i] " "); } public static void main(String[] args) { Rotate rotate = new Rotate(); int arr[] = { 1, 2, 3, 4, 5, 6, 7 }; rotate.leftRotate(arr, 2, 7); rotate.printArray(arr, 7); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. public class BuggyBread { public static void main(String args[]) { System.out.println(factorial(5)); } private static int factorial(int number){ if(number == 1){ return 1; } else { return number * factorial(number - 1); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  recursion Asked in 25 Companies | ||||
| ||||
Ans. public static Stream permutations(String str) { if (str.isEmpty()) { return Stream.of(""); } return IntStream.range(0, str.length()).boxed() .flatMap(i -> permutations(str.substring(0, i) str.substring(i 1)).map(t -> str.charAt(i) t)); } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 2 Companies | ||||
Very Frequently asked to fresh graduates and less experienced. Favorite question in Walk in drives. Frequently asked in Indian Services companies. | ||||
| ||||
Ans. Overloading - Similar Signature but different definition , like function overloading. Overriding - Overriding the Definition of base class in the derived class. | ||||
Sample Code for overloading Sample Code for overriding | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   overloading   overriding   oops concepts   basic interview question   overloading vs overriding Asked in 86 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. It is the process of examining / modifying the behaviour of an object at runtime. | ||||
Sample Code for reflection | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   reflection   reflection api   ebay   mindtree Asked in 29 Companies basic   frequent | ||||