Loading

Q1.

Which of the following statements about the static keyword is true?

A. Static methods can access instance variables directly

B. Static variables are shared among all objects of a class

C. Each object has its own copy of static variables

D. Static methods can use this keyword

Q2.

What happens when a static block is executed in Java?

A. It executes before the constructor, only once when the class is loaded

B. It executes every time an object is created

C. It executes after the constructor

D. It runs only when explicitly called

Q3.

 Which of the following can be declared as static in Java?

A. Local variables

B. Constructors

C. Methods and variables

D. Inner classes only

Q4.

How can you call a static method in Java?

A. Using object reference only

B. Using class name or object reference

C. Using constructor

D. Using super keyword

Q5.

Which statement about static methods is incorrect?

A. Static methods can be called without creating an object

B. Static methods cannot be overridden

C. Static methods can access only static members

D. Static methods can use this keyword