Which of the following is a valid class declaration?
- (a) class A {int x} : Invalid syntax as class members must be defined properly. \[\] - (b) class B { }: Valid syntax. This declares an empty class in C++. \[\] - (c) public class A}: Invalid syntax. The `public` keyword does not belong outside a scope. \[\] - (d) object A {int x;); : Invalid syntax. `object` is not a valid keyword in C++. \[\] \[\] Correct Answer The valid class declaration is: class B \ \[\] Correct Answer: (b)
Reinforce your conceptual grasp with related questions from CUET-MCA 2021:
Take timed full-length mock tests with authentic question distributions, negative marking (+12/-3 in Math), and instant All India Rank calculation.
Start Free Mock Test Series →