Programr Code Exercises

179
4500 reads
Find Day of Given Date


Language:Java
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Write a program to takes input date as [dd/mm/yyyy] formate and find out the day of entered date.

for e.g.:
1. If user gives input date 12/12/1988 then the output will be in this formate:

130
4792 reads
Number Sequence


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Complete the following program which will take a number as input and prints its sequence as output.
For example if input number is 3 then program should print
12321

185
4359 reads
Consecutive number


Language:Java
Difficulty Level:Medium
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Complete the following program or write you own code for checking the given number is
consecutive OR not. To understand better two examples are given below

203
6789 reads
Arrays and Collections


Language:Java
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Write a Java program with the following things done.
1.) Complete the logic of the program by sorting the array in ascending order.
2.) Display the output.

183
5016 reads
Exception Handling


Language:Java
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Correct the Java program with the following things done.
1.) Create an own exception such that if variable sum is greater than 100 it should raise an exception.

153
4171 reads
Method for finding maximum number amongst three


Language:Java
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Please complete the function for finding maximum number amongst the given three number.
The empty function is given in program which takes the three input integers and return the maximum number

152
4712 reads
Print traingle of * using loops


Language:Java
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Write down the simple program to print traingle of ' * '
Depending on the user size using loops.
Eg:
please enter the size:3
the traingle is:
*
**
***

5
4136 reads
5
5217 reads
9
3763 reads
-1
3649 reads
25
6307 reads
32
7542 reads
43
4920 reads
123
4845 reads
37
16782 reads
171
528 reads
fetch chars


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Write a static method f that accepts an ArrayList containing String objects. The method should return a String containing the first character of each string in the

179
430 reads
So


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: Have you ever paid attention to the way programmers talk ? They often start their lines with 'So'.

185
409 reads
DeleteWorldCapitals


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem:
In this exercise, we have created a variable of type Map, called 'worldCapitals'. It contains the names of countries as keys and their corresponding capital as the value.

155
393 reads
Vertical Visuallization Sets


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

When this exercise is run, it will ask you to enter a line of text. We will split the line into words and put the words in a Set called 'words'.

176
467 reads
Unique


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: You recently got assigned to a new project. The project is a scientific analysis on how we write.

192
471 reads
Domain


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: Your company often gets email from college students. As a policy they would like to track all the colleges from where students are sending correspondence to your company.

205
653 reads
array reverse


Language:Java
Difficulty Level:Easy
Questions:3
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Complete the following empty recursive void method, reverse, that accepts an integer array, a starting index and an ending index, and reverses the array.
Reversing an array involves:

175
485 reads
Talking Parrot


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: You recently bought a parrot who loves to talk - a lot. You decide to write a small program where you can enter what he talks and the program tells you the number of words spoken.

180
554 reads
Grades Again


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem:
At the end of the semester, you receive an email from your teacher. She wants to meet you to discuss grades. For a moment you think she wants to admonish you for getting bad grades.

145
5465 reads
Find Maximum and Minimum Temperature


Language:Java
Difficulty Level:Medium
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Write a program that takes input array daily temperatures, as floats and finds out the maximum and minimum values.

Example:

123
4242 reads
TrimSpace


Language:Java
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Write a program which takes input as string and then implement the logic to remove all the spaces in this string.

For Example :
1.If string is "This Is Programr" then the output should be:

153
4523 reads
Name search


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

Complete the following program:
two string arrays are given one is for names and other is for equivalent last names of the celebrities.

140
4865 reads
Abundant Numbers


Language:Java
Difficulty Level:Medium
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:0:30:00
Start exercise

An abundant number is a number for which the sum of its proper divisors is greater than that number.
the sum of the proper divisors of 12 would be 1 + 2 + 3 + 4 + 6 = 18,

10
3944 reads
10
4245 reads
10
6701 reads
2
3357 reads
6
3671 reads
283
6168 reads
145
462 reads
Vertical Visuallization


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

When this exercise is run, it will ask you to enter a line of text. We will split the line into words and put the words in an array called 'words'.

161
384 reads
Unnecessary


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: Your programming teacher loves creating simple problems and asking you to do them in complicated ways.

159
409 reads
Anonymous


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Anonymous inner classes are used as "one time use" classes, when we need to encapsulate some logic in a class, which is going to be used only once.

162
369 reads
Sorted Vertical Visualization


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

In this exercise we would like to read items from a Set in sorted order (not the order in which they were inserted, but in sorted order).

180
453 reads
Angry Chief


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: So, the parody we did in the last exercise, aggravated the chief scientist of your company.

137
632 reads
Operating Systems


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

1 - Linux
2 - Mac OS X
99 - Windows 7

150
589 reads
Infinity


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem:

7
4678 reads
5
4507 reads
7
3865 reads
5
4718 reads
5
4300 reads
5
3618 reads
179
4611 reads
45
4073 reads
158
472 reads
Smelling rats


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: You have been asked by your department head to smell rats. They want to find out how often the word ‘rat’ appears as part of a larger word.

157
657 reads
find duplicates


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

You are given two int variables j and k , an int array zipcodeList that has been declared and initialized by taking the inputs, and a boolean variable duplicates.

-4
4182 reads
2
4065 reads
4
5010 reads
6
4258 reads
8
4062 reads
4
3915 reads
125
509 reads
EmailVerifyer - Regular Expressions


Language:Java
Difficulty Level:Hard
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: A few months back you built the contact form for your company’s website. Your company is doing really well and a lot of people are using the contact form. However, there is a slight problem.

163
577 reads
Atleast one


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem:

3
5276 reads
5
4032 reads
126
4297 reads
113
516 reads
Rome


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Problem: Rome wasn’t built in a day, and Facebook wasn’t coded in the main method.

-2
3493 reads
2
3522 reads
4
3437 reads
60
4894 reads
106
611 reads
negative numbers


Language:Java
Difficulty Level:Easy
Questions:1
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Time limit:0:30:00
Start exercise

Given a boolean variable named isNegative and a 2-dimensional array of ints that has been created and assigned to a2d.

3
3272 reads
3
4272 reads
5
3732 reads
197
5792 reads
226
3025 reads
triangular star


Language:Java
Difficulty Level:Hard
Questions:1
Attempts allowed:Unlimited
Available:Always
Time limit:1:00:00
Start exercise

Complete the following program for displaying the triangular output of the stars depending upon given odd input number.

Enter the number: 3

traingle is:

*-*

***

2
3639 reads
4
3390 reads
4
3582 reads
4
3350 reads
3
3265 reads
3
3419 reads
3
3940 reads
3
3395 reads
3
4029 reads
2
3171 reads
2
3765 reads
0
3328 reads
0
3244 reads
2
3066 reads
36
408 reads