Static Vs Instance

11. You can call a static method using:
  • A. Class name
  • B. Object name
  • C. Both A and B
  • D. Only via interfaces

Both A and B

Both A and B

12.What is the default value of a static reference variable?
  • A. "null"
  • B. Depends on the type
  • C. 0
  • D. null

null

null

13.Which is true about instance variables?
  • A. One copy is shared by all instances
  • B. Each object has its own copy
  • C. Must be static
  • D. Must be final

Each object has its own copy

Each object has its own copy

14.What is output?
class MyClass { int id = 101; static String org = "OpenAI"; public static void main(String[] args) { MyClass a = new MyClass(); MyClass b = new MyClass(); a.org = "Google"; System.out.println(b.org); } }
  • A. OpenAI
  • B. Compilation Error
  • C. 101
  • D. Google

Google

Google

15.Which modifier cannot be applied to a static method?
  • A. public
  • B. private
  • C. abstract
  • D. final

abstract

abstract