1) How can you determine if String has all Unique Characters?
Input string: mock interview preparations
2) Java program to print perfect numbers from 1 to 1000
Perfect Number: a perfect number is a positive integer that is equal to the sum of its proper positive
divisors, that is, the sum of its positive divisors excluding the number itself.
3) If a page contains 1000 images, how can you fetch 100th image?
4) What will this Java code print: String x = “Latest version”; String y = “of Selenium”; int z = 3;
System.out.println(“We are learning Selenium”+” and the “+x+” “+y+” is “+z); ?
5) How can you determine if String has all Unique Characters?
6) How to convert String to integer without using any direct method
in Java.
7) What is Abstraction in java and how Abstract class is different from Interface?
8) What are access modifiers in java explain with examples?
9) What is super keyword and explain the usage?
10) Difference between Instance Variable and Class Variable?
1.String reverse. Write a method that will take one string as an argument and will return the reverse
version of this string.
2.Array reverse. Write a method that will take an array as an argument and reverse it.
3.Reverse words. Write a method that will take a string as an argument. The method will reverse the
position of words and return it.
4.String palindrome. A palindrome is a word, phrase, number, or sequence of words that reads the same
backward as forward.
5.Number palindrome. A palindrome is a word, phrase, number, or sequence of words that reads the
same backward as forward.
6.Max/min number from an array. Write a method that will accept an array of int as an argument and it
returns the max/min number from a given array.
7.Find the second min/max number from an array. Write a method that accepts int array as an argument
and returns second or n min/max number from the given array.
8.Static keyword in Java. The static keyword is a very popular question in the interviews.
9.String Pool and == operator to compare references in Java. Let’s see an example, what’s output from
this program? Why this output?
10.Swap values of two variables without direct reassignment and without creating any extra variables.
11.Two string anagram. An anagram is when all the letters in one string exist in another but the order of
letters does not matter. Write a method that accepts two string arguments and returns true if they are
anagram and false if they are not.
12.Remove duplicates from a string. Write a method that accepts one string argument and returns it
without duplicates.
Given a string s, find the length of the longest substring without repeating characters.
Example:
Input: s = "pwwkew"
Output: 3
Explanation: The answer is "wke", with a length of 3.
Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals and return an
array of the non-overlapping intervals that cover all the intervals in the input.
Example:
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].
Write a function to reverse a given string.
Example:
Input: Stringinput="hello";
Output: "olleh"
What will this Java code print: String x= "Latest version";
String y = "of Selenium": int z = 3; System.out.printin("We arelearning Selenium"+" and the "+x+""+y+" is
"+z);?