Title | |
---|---|
Which of these keywords is used to define packages in JavaWhich of these keywords is used to define packages in Java?
The answer is:
C. package
|
|
Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same packageWhich of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?
The answer is:
D. All of the mentioned
|
|
Which of these access specifiers can be used for a class so that its members can be accessed by a different class in the different packageWhich of these access specifiers can be used for a class so that its members can be accessed by a different class in the different package?
The answer is:
A. Public
|
|
Which of the following is the correct way of importing an entire package ‘pkg’Which of the following is the correct way of importing an entire package ‘pkg’?
The answer is:
C. import pkg.*
|
|
Which of the following is an incorrect statement about packagesWhich of the following is an incorrect statement about packages?
The answer is:
D. A package can be renamed without renaming the directory in which the classes are stored
|
|
Which of the following package stores all the standard java classesWhich of the following package stores all the standard java classes?
The answer is:
B. java
|
|
What is the output of this programWhat is the output of this program? Note : packages.class file is in directory pkg;
The answer is:
C. 2
|
|
What is the output of this programWhat is the output of this program?
The answer is:
C. Hxllo
|
|
What is the output of this programWhat is the output of this program? Note : Output.class file is not in directory pkg.
The answer is:
D. Runtime error
|
|
Which of these keywords is used to define interfaces in JavaWhich of these keywords is used to define interfaces in Java?
The answer is:
A. interface
|
|
Which of these access specifiers can be used for an interfaceWhich of these access specifiers can be used for an interface?
The answer is:
A. Public
|
|
Which of these keywords is used by a class to use an interface defined previouslyWhich of these keywords is used by a class to use an interface defined previously?
The answer is:
C. implements
|
|
Which of the following is the correct way of implementing an interface salary by class managerWhich of the following is the correct way of implementing an interface salary by class manager?
The answer is:
B. class manager implements salary {}
|
|
What is the output of this programWhat is the output of this program
The answer is:
C. 4
|
|
What is the output of this programWhat is the output of this program
The answer is:
C. 4 1
|
|
What is the output of this programWhat is the output of this program?
The answer is:
C. 0 0 4
|
|
Which of the following access specifiers can be used for an interfaceWhich of the following access specifiers can be used for an interface?
The answer is:
A. Protected
|
|
Which of the following is the correct way of implementing an interface A by class BWhich of the following is the correct way of implementing an interface A by class B?
The answer is:
B. class B implements A{}
|
|
All methods must be implemented of an interface |
|
What type of variable can be defined in an interfaceWhat type of variable can be defined in an interface?
The answer is:
D. static final
|
MCQs
Views
Best Answers
Points