Vidyalelo
Java Programming · all questions

Java Regular Expressions
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

50

Questions

3/3

Page

Pick an option on a question to see the right answer and solution.

Which of these package is used for text formatting in Java programming language?

Select an option to see the answer and solution.

What will be the output of the following Java program?
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));
    }	
}

Note : The program is executed at 3 hour 55 minutes and 4 sec (24 hours time).

Select an option to see the answer and solution.

Which of this class can be used to format dates and times?

Select an option to see the answer and solution.

Which of these class allows us to define our own formatting pattern for dates and time?

Select an option to see the answer and solution.

Which of these formatting strings of SimpleDateFormat class is used to print week of the year?

Select an option to see the answer and solution.

Which of the following matches nonword character using regular expression in java?

Select an option to see the answer and solution.

What will be the output of the following Java program?
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));
    }	
}

Note : The program is executed at 3 hour 55 minutes and 4 sec on Monday, 15 July(24 hours time).

Select an option to see the answer and solution.

Which of these method returns an instance of DateFormat that can format time information?

Select an option to see the answer and solution.

what does public String replaceAll(string replace) do?

Select an option to see the answer and solution.

Object of which class is used to compile regular expression?

Select an option to see the answer and solution.