Sail E0 Webinar

MCQs

Total Questions : 7
Question 1. Which of these can be used to fully abstract a class from its implementation?
  1.    Objects
  2.    Packages
  3.    Interfaces
  4.    None of the Mentioned.
 Discuss Question
Answer: Option C. -> Interfaces


Interfaces


Question 2. Which of these keywords is used to define interfaces in Java?
  1.    interface
  2.    Interface
  3.    intf
  4.    Intf
 Discuss Question
Answer: Option A. -> interface


interface


Question 3. Which of the following is correct way of implementing an interface salary by class manager?
  1.    class manager extends salary {}
  2.    class manager implements salary {}
  3.    class manager imports salary {}
  4.    None of the mentioned.
 Discuss Question
Answer: Option B. -> class manager implements salary {}


class manager implements salary {}


Question 4. Which of these access specifiers can be used for an interface?
  1.    Public
  2.    Protected
  3.    private
  4.    All of the mentioned
 Discuss Question
Answer: Option A. -> Public


Access specifier of interface is either public or no specifier. When no access specifier is used then default access specifier is used due to which interface is available only to other members of the package in which it is declared, when declared public it can be used by any code.


Question 5. Which of these keywords is used by a class to use an interface defined previously?
  1.    import
  2.    Import
  3.    implements
  4.    Implements
 Discuss Question
Answer: Option C. -> implements


interface is inherited by a class using implements.


Question 6. Which of the following is incorrect statement about packages?
  1.    Interfaces specifies what class must do but not how it does.
  2.    Interfaces are specified public if they are to be accessed by any code in the program.
  3.    All variables in interface are implicitly final and static.
  4.    All variables are static and methods are public if interface is defined pubic.
 Discuss Question
Answer: Option D. -> All variables are static and methods are public if interface is defined pubic.


All methods and variables are implicitly public if interface is declared public.


Question 7. Which of the following package stores all the standard java classes?
  1.    lang
  2.    java
  3.    util
  4.    java.packages
 Discuss Question
Answer: Option B. -> java


java


Latest Videos

Latest Test Papers