Saturday, 5 January 2019

Practice Programming Questions In Java ( Part 3 )




Today I am going to give you more programming questions based on String.
These programs are very important and useful for  Interview and Viva.

Try to solve these Questions in both ways -- using with/without string pre-defined methods.


Question 1 - WAP to read a string from the user and print it in double quotes?

input -- I am Java From Basics
output -- " I am Java From Basics "
Hint -- escape characters


Question 2 - WAP to reverse String in Java using Iteration and Recursion?


Question 3 - How to check if a String contains only digits?


Question 4 - How to find duplicate characters in a String?
Input - "Programming"
output -
g : 2
r : 2
m : 2


*Question 5 - How to count the occurrence of a given character in String?

[Hint -- This can be easily done using Map(Collection in java kind of Data Structure) and it is very important Ques for Interview]


Question 6 - How to check if String is Palindrome?


Question 7 - Also Check palindrome for the number?


Question 8 - WAP to reverse words in a sentence with/without using the method?

  1. Input -- I am a boy.      Output -- boy a am I
  2. Input -- I am a boy.      Output -- yob a ma I




This is one more site -- to solve more question on strings -- " javarevisited.blogspot.com "




No comments:

Post a Comment