Search Interview Questions | Click here and help us by providing the answer. Click Correct / Improve and please let us know. |
|
|||
|
| ||||
| Interview Questions and Answers for 'Knoldus software' - 10 question(s) found - Order By Newest | ||||
| ||||
| Ans. Overloading - Similar Signature but different definition , like function overloading. Overriding - Overriding the Definition of base class in the derived class. | ||||
| Ans. It is the process of examining / modifying the behaviour of an object at runtime. | ||||
| ||||
| 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); } } } | ||||
| ||||
| 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)); } | ||||
| ||||
| 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); } } | ||||
| ||||
| 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; } | ||||
| ||||
| 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); } } | ||||
| ||||
| 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); } } | ||||
| ||||
| Ans. if you are creating your own exception is known as custom exception. | ||||
| ||||
| 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. | ||||