Object Oriented Programming - I (3140705) MCQs

MCQs of Binary I/O ,Recursion and Generics

Showing 1 to 10 out of 34 Questions
1.
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
Answer:

Option (c)

2.
Which of these class is not a member class of java.io package?
(a) String
(b) StringReader
(c) Writer
(d) File
Answer:

Option (a)

3.
Which of these interface is not a member of java.io package?
(a) DataInput
(b) ObjectInput
(c) ObjectFilter
(d) FileFilter
Answer:

Option (c)

4.
Which of these class is not related to input and output stream in terms of functioning?
(a) File
(b) Writer
(c) InputStream
(d) Reader
Answer:

Option (a)

5.
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
Answer:

Option (c)

6.
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()
Answer:

Option (b)

7.
What will be the output of the following Java code?
    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
Answer:

Option (b)

8.
What will be the output of the following Java program? (Note: file is made in c drive.)
    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) javasystem
Answer:

Option (d)

9.
What will be the output of the following Java program? (Note: file is made in c drive.)
    import java.io.*;
    class files 
    {
        public static void main(String args[]) 
        {
            File obj = new File("/java/system");
            System.out.print(obj.getParent());
            System.out.print(" " + obj.isFile());
        }
    }
(a) java true
(b) java false
(c) java false
(d) java true
Answer:

Option (c)

10.
Which of these classes is used for input and output operation when working with bytes?
(a) InputStream
(b) Reader
(c) Writer
(d) All of the mentioned
Answer:

Option (a)

Showing 1 to 10 out of 34 Questions