If Else

Classes and Objects Basics

1. What does a class can contain.
Answer: Members and Variables

2. What do you mean by class Mambers:
A) Methods
B) Properties
C) Both
Answer: C. Both

3. Can main() accsess public variables of class.
Answer: Yes

4. Can main() access private properties and methods of a class.
Answer: No. (Directly Not)

5. Member Variables can also be called as:
Answer: Properties

6. Member functions can also be called as:
Answer: Behaviour

7. What is the size of(in bytes) the following class?
class A
{
int x;
};
Answer: 4 Bytes

8. What is the size of(in bytes) the following class?
class A
{
};
Answer: 1 Byte

9. How many Methods a class should contain?
Answer: No-limit

10. What is teh default access specifier of class Members.
Answer: private

11. How to access Members of a class in main.
Answer: By creating class object

12. Can Method name have space.
Answer: No

13. Is it necessary to terminate a class with semicolon.
Answer: Yes

14. Is it possible to access a variable declared in one method by sitting in another method.
Answer: No

15. Can all Methods access variables declared in a class.
Answer: Yes

Confirm your Answer