A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

71. Which of these class is used to read characters in a file?
a. FileReader
b. FileWriter
c. FileInputStream
d. InputStreamReader
View Answer Report Discuss Too Difficult!
Answer: (a).FileReader

72. Which of these method of FileReader class is used to read characters from a file?
a. read()
b. scanf()
c. get()
d. getInteger()
View Answer Report Discuss Too Difficult!
Answer: (a).read()

73. 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
View Answer Report Discuss Too Difficult!
Answer: (c).CharArrayReader

74. Which of these classes can return more than one character to be returned to input stream?
a. BufferedReader
b. Bufferedwriter
c. PushbachReader
d. CharArrayReader
View Answer Report Discuss Too Difficult!
Answer: (c).PushbachReader

75. What is the output of this 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
View Answer Report Discuss Too Difficult!
Answer: (d).abcdef

76. What is the output of this 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
View Answer Report Discuss Too Difficult!
Answer: (a).abc

77. What is the output of this 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
View Answer Report Discuss Too Difficult!
Answer: (d).None of the mentioned

78. Which of the following is not a segment of memory in java?
a. Stack Segment
b. Heap Segment
c. Code Segment
d. Register Segment
View Answer Report Discuss Too Difficult!
Answer: (d).Register Segment

79. Does code Segment loads the java code?
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (a).True

80. What is JVM?
a. Bootstrap
b. Interpreter
c. Extension
d. Compiler
View Answer Report Discuss Too Difficult!
Answer: (b).Interpreter