Question 78

Computer Awareness Object Oriented Programming Easy

Which of the following is a valid class declaration?

(A) class A {int x};
(B) class B { }
(C) public class A}
(D) object A {int x;);
✓ Correct Answer: Option B Verified Solution

📘 Step-by-Step Solution & Detailed Explanation:

- (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)

Practice Similar Object Oriented Programming Questions

Reinforce your conceptual grasp with related questions from CUET-MCA 2021:

Q52 Informal high-level description of an alrogithm in English is called
Solve →
Q59 Which among the following best describes polymorphism?
Solve →
Q60 Which among the following is the language which supports classes but not...
Solve →
Q61 \( \) \( \) is a template for entities that have common behaviour
Solve →
Q67 Which of the following is not a member of class?
Solve →
Full-Length Test Series

Prepare for CUET-MCA Under Real Exam Conditions

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 →