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.

51. What is the output of this program?
    class Output
    {
        public static void main(String args[])
        {
     Double i = new Double(257.578123456789);  
            float x = i.floatValue();
            System.out.print(x);
        }
    }
a. 0
b. 257.0
c. 257.57812
d. 257.578123456789
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).257.57812

52. What is the output of this program?
    class Output
    {
        public static void main(String args[])
        {
            Double y = new Double(257.57812);
     Double i = new Double(257.578123456789);  
            try
            {
         int x = i.compareTo(y);
                System.out.print(x);
            }
            catch(ClassCastException e)
            {
                System.out.print("Exception");
            }
 }
    }
a. 0
b. 1
c. Exception
d. None of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).1

53. Which of these packages contain classes and interfaces used for input & output operations of a program?
a. java.util
b. java.lang
c. java.io
d. all of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).java.io

54. Which of these class is not a member class of java.io package?
a. String
b. StringReader
c. Writer
d. File
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).String

55. Which of these interface is not a member of java.io package?
a. DataInput
b. ObjectInput
c. ObjectFilter
d. FileFilter
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).ObjectFilter

56. Which of these class is not related to input and output stream in terms of functioning?
a. File
b. Writer
c. InputStream
d. Reader
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).File

57. Which of these is specified by a File object?
a. a file in disk
b. directory path
c. directory in disk
d. none of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).directory in disk

58. Which of these is method for testing whether the specified element is a file or a directory?
a. IsFile()
b. isFile()
c. Isfile()
d. isfile()
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).isFile()

59. What is the output of this program?
    import java.io.*;
    class files 
    {
        public static void main(String args[]) 
        {
            File obj = new File("/java/system");
            System.out.print(obj.getName());
        }
    }
a. java
b. system
c. java/system
d. /java/system
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).system

60. What is the output of this program?
    import java.io.*;
    class files 
    {
        public static void main(String args[]) 
        {
            File obj = new File("/java/system");
            System.out.print(obj.getAbsolutePath());
        }
    }
a. java
b. system
c. java/system
d. \java\system
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).\java\system

Page 6 of 22