486). Which of these stream contains the classes which can work on character stream?

[A]InputStream
[B]OutputStream
[C]Character Stream
[D]All of the mentioned

Show Answer

489). Which of these class can be used to implement the input stream that uses a character array as the source?

[A]BufferedReader
[B]FileReader
[C]CharArrayReader
[D]FileArrayReader

Show Answer

490). Which of these classes can return more than one character to be returned to input stream?

[A]BufferedReader
[B]Bufferedwriter
[C]PushbachReader
[D]CharArrayReader

Show Answer

491). What will be the output of the following Java program?
    import java.io.*;
    class Chararrayinput 
    {
        public static void main(String[] args) 
        {
	    String obj  = "abcdef";
            int length = obj.length();
            char c[] = new char[length];
            obj.getChars(0,length,c,0);
            CharArrayReader input1 = new CharArrayReader(c);
            CharArrayReader input2 = new CharArrayReader(c, 0, 3);
            int i;
            try 
            {
		while ((i = input1.read()) != -1) 
                {
                    System.out.print((char)i);
                }
       	    } 
            catch (IOException e) 
            {
	        // TODO Auto-generated catch block
                e.printStackTrace();
	    }
	}
    }

[A]abc
[B]abcd
[C]abcde
[D]abcdef

Show Answer

492). What will be the output of the following Java program?
    import java.io.*;
    class Chararrayinput 
    {
        public static void main(String[] args) 
        {
	    String obj  = "abcdef";
            int length = obj.length();
            char c[] = new char[length];
            obj.getChars(0, length, c, 0);
            CharArrayReader input1 = new CharArrayReader(c);
            CharArrayReader input2 = new CharArrayReader(c, 0, 3);
            int i;
            try 
            {
		while ((i = input2.read()) != -1) 
                {
                    System.out.print((char)i);
                }
       	    } 
            catch (IOException e) 
            {
	        // TODO Auto-generated catch block
                e.printStackTrace();
	    }
	}
    }

[A]abc
[B]abcd
[C]abcde
[D]abcdef

Show Answer

493). What will be the output of the following Java program?
    import java.io.*;
    class Chararrayinput 
    {
        public static void main(String[] args) 
        {
	    String obj  = "abcdefgh";
            int length = obj.length();
            char c[] = new char[length];
            obj.getChars(0, length, c, 0);
            CharArrayReader input1 = new CharArrayReader(c);
            CharArrayReader input2 = new CharArrayReader(c, 1, 4);
            int i;
            int j;
            try 
            {
		while ((i = input1.read()) == (j = input2.read())) 
                {
                    System.out.print((char)i);
                }
       	    } 
            catch (IOException e) 
            {
	        // TODO Auto-generated catch block
                e.printStackTrace();
	    }
	}
    }

[A]abc
[B]abcd
[C]abcde
[D]none of the mentioned

Show Answer