adplus-dvertising

Welcome to the Miscellaneous Topics in Java MCQs Page

Dive deep into the fascinating world of Miscellaneous Topics in Java with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Miscellaneous Topics in Java, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Miscellaneous Topics in Java, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Miscellaneous Topics in Java. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Miscellaneous Topics in Java. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Miscellaneous Topics in Java MCQs | Page 3 of 23

Q21.
Which of these package is used for text formatting in Java programming language?
Discuss
Answer: (a).java.text
Q22.
Which of this class can be used to format dates and times?
Discuss
Answer: (c).DateFormat
Q23.
Which of these method returns an instance of DateFormat that can format time information?
Discuss
Answer: (b).getTimeInstance()
Q24.
Which of these class allows us to define our own formatting pattern for dates and time?
Discuss
Answer: (b).SimpleDateFormat
Q25.
Which of these formatting strings of SimpleDateFormat class is used to print AM or PM in time?

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (a).a
Q26.
Which of these formatting strings of SimpleDateFormat class is used to print week of the year?

a.

w

b.

W

c.

s

d.

S

Discuss
Answer: (a).w
Q27.
What is the output of this program?

Note : The program is executed at 3 hour 55 minutes and 4 sec (24 hours time).
    import java.text.*;
    import java.util.*;
    class Date_formatting
    {  
        public static void main(String args[])
        {
     Date date = new Date();
     SimpleDateFormat sdf;
            sdf = new SimpleDateFormat("mm:hh:ss");
            System.out.print(sdf.format(date));
        } 
    }
Discuss
Answer: (c).55:03:04
Q28.
What is the output of this program?

Note : The program is executed at 3 hour 55 minutes and 4 sec (24 hours time).
    import java.text.*;
    import java.util.*;
    class Date_formatting
    {  
        public static void main(String args[])
        {
     Date date = new Date();
     SimpleDateFormat sdf;
            sdf = new SimpleDateFormat("hh:mm:ss");
            System.out.print(sdf.format(date));
        } 
    }
Discuss
Answer: (d).03:55:04
Q29.
What is the output of this program?

Note: The program is executed at 3 hour 55 minutes and 4 sec on Monday, 15 July(24 hours time).
    import java.text.*;
    import java.util.*;
    class Date_formatting
    {  
        public static void main(String args[])
        {
     Date date = new Date();
     SimpleDateFormat sdf;
            sdf = new SimpleDateFormat("E MMM dd yyyy");
            System.out.print(sdf.format(date));
        } 
    }
Discuss
Answer: (a).Mon Jul 15 2013
Q30.
What is the output of this program?

Note : The program is executed at 3 hour 55 minutes and 4 sec on Monday, 15 July(24 hours time).
    import java.text.*;
    import java.util.*;
    class Date_formatting
    {  
        public static void main(String args[])
        {
     Date date = new Date();
     SimpleDateFormat sdf;
            sdf = new SimpleDateFormat("z");
            System.out.print(sdf.format(date));
        } 
    }
Discuss
Answer: (d).PDT
Page 3 of 23

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!