Static Members in Classes – MCQs July 22, 2025 by u930973931_answers 30 Score: 0 Attempted: 0/30 Subscribe 1. : What is a static data member in a class? (A) A variable shared among all objects of the class (B) A variable that cannot be modified (C) A local variable (D) A constant variable 2. : Which keyword is used to declare a static member in a class? (A) shared (B) const (C) static (D) global 3. : How many copies of a static data member exist per class? (A) One per object (B) One per method (C) Only one per class (D) Multiple per class 4. : Where is the memory for static data members allocated? (A) Inside the class (B) Outside the class (C) For each object (D) Inside main() 5. : Can static data members be private? (A) Yes (B) No (C) Only protected (D) Only public 6. : How are static data members accessed? (A) Using object only (B) Using pointer only (C) Using class name or object (D) Only inside constructor 7. : What is a static member function? (A) A function that cannot access data (B) A function that is not a member of the class (C) A function that can be called without an object (D) A function that always returns void 8. : Can static member functions access non-static members? (A) Yes (B) No (C) Only private ones (D) Only if virtual 9. : What is required to define a static data member outside the class? (A) Redefine the class (B) Use scope resolution operator (C) Declare it global (D) Use pointer to class 10. : Which of the following is true about static member functions? (A) They can use the this pointer (B) They cannot be accessed from objects (C) They cannot access non-static members (D) They must be public 11. : Can a static function be overloaded? (A) Yes (B) No (C) Only in templates (D) Only for virtual functions 12. : Can static data members be initialized inside the class? (A) Yes (B) No (C) Only if const integral types (D) Only for pointers 13. : Can static member functions be virtual? (A) Yes (B) No (C) Only pure virtual (D) Only in derived classes 14. : How can you access a static member function? (A) Only through object (B) Using class name (C) Only in constructors (D) Through pointers only 15. : Can a static data member be accessed before creating any object? (A) Yes (B) No (C) Only in main() (D) Only if public 16. : Can a class have both static and non-static members? (A) Yes (B) No (C) Only static (D) Only in structs 17. : What is the use of a static counter in a class? (A) To count objects (B) To initialize values (C) To destroy objects (D) To inherit values 18. : What is the default value of a static int variable? (A) 0 (B) 1 (C) Undefined (D) NULL 19. : Can static functions be declared as friend? (A) Yes (B) No (C) Only in base class (D) Only with private access 20. : What happens if a static member is not defined outside the class? (A) Compile-time error (B) Runtime error (C) Nothing (D) It becomes private 21. : When is a static variable in a class initialized? (A) During object creation (B) When the class is loaded (C) When first used (D) At the end of program 22. : Can a static member be constant? (A) No (B) Yes, if declared const static (C) Only if it is public (D) Only if it is private 23. : What type of members can static member functions access? (A) Only private (B) Only protected (C) Only static (D) All types 24. : What is the storage class of a static member? (A) Auto (B) Static (C) Register (D) Extern 25. : Which operator is used to define static members outside the class? (A) . (B) :: (D) # 26. : Can static members be inherited? (A) Yes (B) No (C) Only in abstract classes (D) Only private ones 27. : How is static data member shared among objects? (A) By copying it to each object (B) A single memory location is shared (C) Each object creates a copy (D) It’s passed through constructor 28. : Which of the following can modify static members? (A) Any object (B) Only the class itself (C) Only constructors (D) Only destructors 29. : Why are static members useful in classes? (A) They make the class abstract (B) They allow sharing of information (C) They prevent inheritance (D) They simplify destructors 30. : Where should you define a static data member after declaring it inside the class? (A) Inside the class body (B) In the constructor (C) Outside the class using the class name (D) In the main() function