1. The .................. and .................... classes are abstract classes that support reading and writing of byte streams.
A) reader, writer
B) inputstream, outputstream
C) objectinputstream, objectoutputstream
D) none
2. What is the error in the following code?
class Test
{
abstract void display( );
}
A) No error
B) Method display( ) should be declared as static
C) Test class should be declared as abstract
D) Test class should be declared as public
3. A package is a collection of
A) classes
B) interfaces
C) editing tools
D) classes and interfaces
4. Which of the following methods belong to the string class?
A) length( )
B) compare To ( )
C) equals ( )
D) All of them
5. What will be the output of the following code?
byte x=64, y;
y= (byte) (x<<2);
System.out.println(y);
A) 0
B) 1
C) 2
D) 64
6. If m and n are int type variables, what will be the result of the expression
m%n
when m=5 and n=2 ?
A) 0
B) 1
C) 2
D) None of the above
7. Which of the following control expressions are valid for an if statement?
A) An integer expression
B) A Boolean expression
C) Either A or B
D) Neither A nor B
8. The concept of multiple inheritance is implemented in Java by
A) extending two or more classes
B) extending one class and implementing one or more interfaces
C) implementing two or more interfaces
D) both B and C
9. Which of the following do not represent legal flow control statements?
A) break;
B) return;
C) exit();
D) continue outer;
10. Data input is
A) an abstract class defined in java.io
B) a class we can use to read primitive data types
C) an interface that defines methods to open files.
D) an interface that defines methods to read primitive data types.
Answers:
1. B) inputstream, outputstream
2. C) Test class should be declared as abstract
3. D) classes and interfaces
4. D) All of them
5. A) 0
6. B) 1
7. B) A Boolean expression
8. D) both B and C
9. C) exit();
10.D) an interface that defines methods to read primitive data types.
You Might also view the following Related Posts
- Solved MCQ of Java Set-1
- MCQ of Java with answer set-2
- Solved MCQ of Java for Java Proficiency test set-3
- Solved MCQ of Java set-4
- Java MCQ Questions and Answers set-5
- Java Multiple Choice Questions With Answers set-6
- Java MCQ Questions and Answers set-5
- Solved MCQ of Internet and HTML set-1
- Solved MCQ of C set-1
- Solved MCQ of DBMS Set - 3
0 التعليقات: