0% found this document useful (0 votes)
14 views31 pages

Java Programming Challenges and Solutions

The document contains a series of programming questions and their corresponding answers, primarily focused on Java. The questions cover various topics such as checking for odd/even numbers, string manipulations, anagrams, and calculating averages. Each question is numbered and includes specific requirements for the coding tasks.

Uploaded by

ragerspirit037
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views31 pages

Java Programming Challenges and Solutions

The document contains a series of programming questions and their corresponding answers, primarily focused on Java. The questions cover various topics such as checking for odd/even numbers, string manipulations, anagrams, and calculating averages. Each question is numbered and includes specific requirements for the coding tasks.

Uploaded by

ragerspirit037
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Question
[Link] a number
[Link] it contains more than 2 odd numbers print “TRUE”.

3. else print “FALSE”.

Answer

import [Link];

class HelloWorld {

public static void main(String[] args){

Scanner sc=new Scanner([Link]);

String ip=[Link]();

int count=0;

char[] ch=[Link]();

for (char chr:ch){

int num=[Link](chr);

if(num%2==1){

count++;

if(count > 3){

[Link]("True");

}else{

[Link]("False");

}
[Link]
[Link] the largest and smallest substring as per the value of k.
[Link] the smallest and largest one, data should be String and integer for k.
[Link]
[Link] a string and it’s reverse should be same.
[Link] same print “True” else “False”.

[Link]
[Link] the 2 words are anagram or not.
2. Both words are needed to be String.
[Link] anagram print “True” else “False”.
[Link]
[Link] int to string.
2. and then check if the int and String(needs to be changed) is equal or not.
[Link] correct print ”Good Job” else “Wrong”.

[Link]
[Link] an input in a type of String.
[Link] the each and every odd numbers from the input and print it.
[Link](Java 2)
[Link] a number in a type of array format.
[Link] the sum of digits for the input.
[Link] the sum divides by 3 print “True” else “False”.

[Link](Java 3)
[Link] a number in an array format.

2. add only the odd numbers.

[Link] sum is greater than 8 AND less then 50 print “True” else “False”.
[Link] (Java 1)(Video 10).
[Link] 5 numbers in an integer format.
[Link] give 2 limits.
3. we need to find average for the sum of numbers between the 2 limits.

[Link]
[Link] the number of lowercase letter in a given string.
[Link]
[Link] all the odd index character from the given string.

[Link]
[Link] the number of words in a given string or sentence.

And we also use trim() in split() line to make the array w/o any spaces.
[Link]
[Link] how many even numbers in the given number.
[Link] count > 2 print “True” else “False”.

[Link]
[Link] the words in a given String.
[Link] (OWN).
[Link] the words in a given string.
2. and also in the words each and every letter’s needs to be reversed.

[Link]
[Link] the every first letters of the words in the given string.
[Link]
[Link] a string and a character.
[Link] print a sequence characters by removing the given character from the
given word.

[Link]
1. print all the last letters of the words as a string.
[Link]
[Link] the given number is perfect number.
[Link]… 6 , Perfect Number, How, divisors of 6 are 1,2,3. Where 1+2+3=6.
[Link]… 8 , Not a Perfect Number, How, divisors of 8 are 1,2,4. Where 1+2+4=7.

[Link]
[Link] the number of spaces in the string.

2. we can also add Conditions like if spaces count are greater than 3 then
print ”True” else “False”.
[Link]
[Link] the duplicates in the string.

[Link]
[Link] the number of vowels, consonants and number in the given string.
[Link]
[Link] a input string.
[Link] the string in that remove the characters when we get 1st repeated
letter .
[Link] we get 1st repeated letter we can store. If we saw a repeated letter
the break it.
[Link]
[Link] a string.
[Link] the given string contains “CHN” then print the last 3 letters of the string in
reverse.

[Link] a string.
[Link] the given string only starts with “CHN” then print the last 3 letters in
reverse.
[Link].
[Link] a string.
[Link] the word which has a higher length in the given string.

[Link]
[Link] two numbers as a limit.
[Link] in that limit identify the sum and count of the numbers which are
divisible by 2 & 3.
35 Mark Question
[Link]:

[Link]:
[Link]

[Link]
[Link]
[Link]
[Link]

[Link]
[Link]
[Link]
[Link]
[Link]

You might also like