Quiz on Java Date and Time
Free Java courses with 37 real-time projects - Learn Java
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
- Question 1 of 15
1. Question
Which method in Java is used to return the Hashcode of the invoked object ?
CorrectIncorrect - Question 2 of 15
2. Question
class Time {
public static void main ( String args [ ] )
{
Time object = new Time.now();
System.out.println(object);
}
}
What will be the output of the program ?
CorrectIncorrect - Question 3 of 15
3. Question
class Formatter {
public static void main ( String args [ ] )
{
Date date = new Date();
simpleDateFormat form = new simpleDateFormat(“dd:ss;yyyy”);
System.out.println(form.format(date));
}
}
Date = 25th august 2021
What will be the output of the program ?
CorrectIncorrect - Question 4 of 15
4. Question
Which of the following classes is used to format the Date and time in Java ?
CorrectIncorrect - Question 5 of 15
5. Question
class Yesterday {
public static void main ( String args [ ] )
{
Date date = new Date.now();
Date yesterday = date.minus(1);
System.out.println(yesterday);
}
}
Date = 25/08/2021
What will be the output of the program ?
CorrectIncorrect - Question 6 of 15
6. Question
class LeapYear {
public static void main ( String args [ ] )
{
Date date = new Date(“20:08.2020”);
System.out.println(date.isLeapYear());
}
}
What is the output of the program ?
What is the output of the program ?
CorrectIncorrect - Question 7 of 15
7. Question
Which of the following is not a package for Date and Time ?
CorrectIncorrect - Question 8 of 15
8. Question
Class Testing {
public static void main ( String args [ ] )
{
Date date = new Date(“25/08/2021”);
boolean value = date.isLeapyear();
if(value==true)
{
System.out.println(“The given date is a leap year”);
}
else {
System.out.println(“The given date is not a leap year”);
}
}
}
What is the output of the program ?
CorrectIncorrect - Question 9 of 15
9. Question
class Timing {
public static void main ( String args [ ] )
{
Time time = new Time.of(21,54,50);
System.out.println(time);
}
}
What will be the output of the program ?
CorrectIncorrect - Question 10 of 15
10. Question
What is the function of the String toString() method in Java ?
CorrectIncorrect - Question 11 of 15
11. Question
class Date {
public static void main ( String args [ ] )
{
LocalDate date = new Date.now();
LocalDate date2 = date.plusDays(2);
System.out.println(date2);
}
}
What is the output of the program ?
CorrectIncorrect - Question 12 of 15
12. Question
class DateFormatter {
public static void main ( String args [ ] )
{
Date date = new Date.now();
SimpleDateFormat syntax = new SimpleDateFormat(“yyyy.MM.dd”);
System.out.println(“syntax.format(date));
}
}
If today is 25th august of 2021 how will the date be printed ?
CorrectIncorrect - Question 13 of 15
13. Question
Which of the following is the parameter to be passed for a String format() method ?
CorrectIncorrect - Question 14 of 15
14. Question
class Demo {
public static void main ( String args [ ] )
{
System.out.println(Date);
}
}
What is the error in the program ?
CorrectIncorrect - Question 15 of 15
15. Question
Class Date {
public static void main ( String args [ ] )
{
Date dateobj = new Date();
System.out.println(dateobj.toString());
}
}
What will be the output of the program ?
CorrectIncorrect
Did we exceed your expectations?
If Yes, share your valuable feedback on Google