Class

Question 1
Which of the following is/are true about packages in Java?
1) Every class is part of some package
2) All classes in a file are part of the same package
3)If no package is specified, the classes in the file go into a special unnamed package.
4) If no package is specified, a new package is created with folder name of class and the class is put in this package
A
Only 1,2 and 3
B
Only 1,2 and 4
C
Only 4
D
Only 1 and 3
       OOPS       Class       Nielit Scientist-B IT 22-07-2017
Question 1 Explanation: 
Option -4 false because new package is created by using syntax package package_name which is user defined .There is no relation with class name.
Question 2
Which of the following is false about abstract classes in java?
A
If we derive an abstract class and do not implement all the abstract methods, then the derived class should also be marked as abstract using 'abstract' keyword
B
Abstract classes can have constructors.
C
A class can be made abstract without any abstract method
D
A class can inherit from multiple abstract classes
       OOPS       Class       Nielit Scientist-B IT 22-07-2017
Question 2 Explanation: 
● An abstract class can have an abstract method without body and it can have methods with implementation also. ● Multiple inheritance is not possible with abstract classes.
There are 2 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access