SlideShare a Scribd company logo
1 of 6
Download to read offline
www.fellowbuddy.com
Simplifying Students Life
Oops
1. By default, members of the class are____________ in nature.
a. protected
b. private
c. public
d. static
2. Private members of the class are accessible only to the members of the same class.
a. True
b. False
3. public data members and member functions of the class are accessible ONLY to the member
functions of that class.
a. True
b. False
4. class TEST
{
private:
int roll_no;
public:
int age;
char name[20];
private:
int grade;
protected:
char gender[20];
private:
private:
int m1, m2, m3;
};
In general view, is this class definition valid?
a. Yes
b. No
www.fellowbuddy.com
Simplifying Students Life
5. Members of the class can be declared with auto, extern or register storage classes.
a. True
b. False
6. C structure differs from CPP class in regards that by default all the members of the structure
are__________ in nature.
a. private
b. protected
c. public
d. None of these
7. In CPP program, Can we declare and define a user defined function inside a struct as we do in
a class ?
a. Yes
b. No
c. Can’t say
8. ____________ refers to the act of representing only essential features without including the
background details.
a. Data Hiding
b. Data Encapsulation
c. Data Abstraction
d. All of these
9. Only functions of the class can access the data of the class and they(functions) provides the
interface between data, objects and the program. This kind isolation of the data from direct
access by the program is called_______________
a. Data Abstraction
b. Data Hiding
c. Data Binding
d. Data Encapsulation
10. __________________ is the OOP feature and mechanism that binds together code and the
data it manipulates, and keep both safe from outside world.
a. Data Binding
b. Data Encapsulation
c. Data Storing
www.fellowbuddy.com
Simplifying Students Life
d. Data Abstraction
11. Object based language differs from Object oriented language as it does not support features
1. Encapsulation
2. Inheritance
3. Dynamic Binding
4. Abstraction
5. Polymorphism
a. only 3 ,4
b. only 1,3,5
c. 2,4,5
d. only 2,3
12. Object oriented programming employs_________ programming approach.
a. top-down
b. procedural
c. bottom-up
d. all of these.
13. In CPP, cin and cout are the predefined stream__________
a. Operator
b. Functions
c. Objects
d. Data types
14. Classes in CPP are________
a.derived data types
b.User defined data types
c.built-in data types
d. All of these
15. In CPP, it is mandatory and must to initialize const variables.
a. True
b. False
16. Constant variables can be created in CPP by using________
a. enum
b. const
www.fellowbuddy.com
Simplifying Students Life
c. #define
d. All of these
e. None of these
17. Which of the followings is/are not keyword/s in CPP?
1. asm
2. boolean
3. mutable
4. export
5. constant_cast
a. Only 5
b. Only 1 and 4
c. Only 1,2 and 5
d. Only 2 and 5
18. Can a class be declared/defined inside another class ?
a. Yes
b. No
19. When a class is defined inside any function or block, it is called_____________
a. Nested class
b. Block class
c. Local class
d. It is not possible
20. The CPP compiler supports automatic type conversions for the user defined data types.
a. True
b. False
21. Which of the followings are false statements about Local class?
1. A local class type name can only be used in the enclosing function
2. All the methods of Local classes must be defined inside the class only
3. A Local class can contain static data members.
4. A Local class may contain static functions.
5. Non-static variables of the enclosing function are not accessible inside local classes.
6. Local classes cannot access global types, variables and functions.
a. Only 1,3
b. Only 3, 6
www.fellowbuddy.com
Simplifying Students Life
c. Only 2 , 4 , 6
d. None of these
Answers
1. ANSWER: b. private
Explanation: If access specifier is not written/specified, in that case all members of the class
are private in nature by CPP conventions.
2. ANSWER: b. False
Explanation: It is not compulsion or mandatory that all private members of the
class are accessible only to the members of that class. We can have access to private
members of the class
through friend function which is neither in the scope of that class and nor a member
function of that class.
3. ANSWER: b. False
Explanation: This statement is false as public members of the class are accessible to the other
parts of the program as well. They are accessible to the objects of the other classes in the
same application through friend functions or friend classes.
4. ANSWER: a. Yes
Explanation: This kind of class declaration is not a standard or good practice as
multiple types we are specifying access specifiers. But still, this program smoothly
runs as we can write
access specifiers multiple times inside the class in any order or even simultaneously.
5. ANSWER: b. False
Explanation: No member of the class can be declared with auto, extern or register storage
class. If you do so, you will be issued with warning “Storage class ‘register’ is not allowed
here”.
But members of the class can be declared as static.
6. ANSWER: c. public
7. ANSWER: a. Yes
Explanation: Just like a class, we can declare and define a user defined function inside the
struct and able to access the same by the structure variable with dot relationship.
8. ANSWER: c. Data Abstraction
9. ANSWER: b. Data Hiding
10. ANSWER: b. Data Encapsulation
11. ANSWER: d. only 2,3
12. ANSWER: c. bottom-up
13. ANSWER: c. Objects
www.fellowbuddy.com
Simplifying Students Life
14. ANSWER: b.User defined data types
15. ANSWER: a. True
Explanation: The answer is True. In order to have constant variables in CPP using const
qualifier, they are need to be declared and defined on the same line i.e. declaration with
initialization is must. Try following code in Turbo CPP editor or any CPP editor/compiler.
int main()
{
const int x; //this statement will cause error
const int y=100; //this statement is valid
cout<<“ value of y==”<<y;
return 0;
}
16. ANSWER: d. All of these
17. ANSWER: d. Only 2 and 5
18. ANSWER: a. Yes
Explanation: Like nested structure in C, we can have nested classes in CPP.
19. ANSWER: c. Local class
20. ANSWER: b. False
21. ANSWER: b. Only 3, 6

More Related Content

More from FellowBuddy.com

The Internet, Intranet and Extranet
The Internet, Intranet and ExtranetThe Internet, Intranet and Extranet
The Internet, Intranet and ExtranetFellowBuddy.com
 
Database Management System
Database Management System Database Management System
Database Management System FellowBuddy.com
 
Microsoft Office PowerPoint 2007 Training
Microsoft Office PowerPoint 2007 TrainingMicrosoft Office PowerPoint 2007 Training
Microsoft Office PowerPoint 2007 TrainingFellowBuddy.com
 
Business Studies Class xii
Business Studies Class xiiBusiness Studies Class xii
Business Studies Class xiiFellowBuddy.com
 
Risk and Risk Aversion FM
Risk and Risk Aversion FMRisk and Risk Aversion FM
Risk and Risk Aversion FMFellowBuddy.com
 
Refrigeration Engineering Lecture Notes
Refrigeration Engineering Lecture NotesRefrigeration Engineering Lecture Notes
Refrigeration Engineering Lecture NotesFellowBuddy.com
 
Production and Operation Management Lecture Notes
Production and Operation Management Lecture NotesProduction and Operation Management Lecture Notes
Production and Operation Management Lecture NotesFellowBuddy.com
 
Leadership Theories {HR}
Leadership Theories {HR}Leadership Theories {HR}
Leadership Theories {HR}FellowBuddy.com
 
Interpersonal Communication Skills {HR}
Interpersonal Communication Skills {HR}Interpersonal Communication Skills {HR}
Interpersonal Communication Skills {HR}FellowBuddy.com
 
Industrial Dispute Act, 1947 {HR}
Industrial Dispute Act, 1947 {HR}Industrial Dispute Act, 1947 {HR}
Industrial Dispute Act, 1947 {HR}FellowBuddy.com
 
Factories act, 1948 {HR}
Factories act, 1948 {HR}Factories act, 1948 {HR}
Factories act, 1948 {HR}FellowBuddy.com
 
Ratio and Proportion, Indices and Logarithm Part 4
Ratio and Proportion, Indices and Logarithm Part 4Ratio and Proportion, Indices and Logarithm Part 4
Ratio and Proportion, Indices and Logarithm Part 4FellowBuddy.com
 
Ratio and Proportion, Indices and Logarithm Part 2
Ratio and Proportion, Indices and Logarithm Part 2Ratio and Proportion, Indices and Logarithm Part 2
Ratio and Proportion, Indices and Logarithm Part 2FellowBuddy.com
 
Ratio and Proportion, Indices and Logarithm Part 1
Ratio and Proportion, Indices and Logarithm Part 1Ratio and Proportion, Indices and Logarithm Part 1
Ratio and Proportion, Indices and Logarithm Part 1FellowBuddy.com
 
Limits and Continuity - Intuitive Approach part 3
Limits and Continuity - Intuitive Approach part 3Limits and Continuity - Intuitive Approach part 3
Limits and Continuity - Intuitive Approach part 3FellowBuddy.com
 
Limits and Continuity - Intuitive Approach part 2
Limits and Continuity - Intuitive Approach part 2Limits and Continuity - Intuitive Approach part 2
Limits and Continuity - Intuitive Approach part 2FellowBuddy.com
 

More from FellowBuddy.com (20)

The Internet, Intranet and Extranet
The Internet, Intranet and ExtranetThe Internet, Intranet and Extranet
The Internet, Intranet and Extranet
 
Database Management System
Database Management System Database Management System
Database Management System
 
Operating System
Operating System Operating System
Operating System
 
Microsoft Office PowerPoint 2007 Training
Microsoft Office PowerPoint 2007 TrainingMicrosoft Office PowerPoint 2007 Training
Microsoft Office PowerPoint 2007 Training
 
Social science class_x
Social science class_xSocial science class_x
Social science class_x
 
Maths class x
Maths class xMaths class x
Maths class x
 
Business Studies Class xii
Business Studies Class xiiBusiness Studies Class xii
Business Studies Class xii
 
Risk and Risk Aversion FM
Risk and Risk Aversion FMRisk and Risk Aversion FM
Risk and Risk Aversion FM
 
Refrigeration Engineering Lecture Notes
Refrigeration Engineering Lecture NotesRefrigeration Engineering Lecture Notes
Refrigeration Engineering Lecture Notes
 
Production and Operation Management Lecture Notes
Production and Operation Management Lecture NotesProduction and Operation Management Lecture Notes
Production and Operation Management Lecture Notes
 
Strategic HRM {HR}
Strategic HRM {HR}Strategic HRM {HR}
Strategic HRM {HR}
 
Leadership Theories {HR}
Leadership Theories {HR}Leadership Theories {HR}
Leadership Theories {HR}
 
Interpersonal Communication Skills {HR}
Interpersonal Communication Skills {HR}Interpersonal Communication Skills {HR}
Interpersonal Communication Skills {HR}
 
Industrial Dispute Act, 1947 {HR}
Industrial Dispute Act, 1947 {HR}Industrial Dispute Act, 1947 {HR}
Industrial Dispute Act, 1947 {HR}
 
Factories act, 1948 {HR}
Factories act, 1948 {HR}Factories act, 1948 {HR}
Factories act, 1948 {HR}
 
Ratio and Proportion, Indices and Logarithm Part 4
Ratio and Proportion, Indices and Logarithm Part 4Ratio and Proportion, Indices and Logarithm Part 4
Ratio and Proportion, Indices and Logarithm Part 4
 
Ratio and Proportion, Indices and Logarithm Part 2
Ratio and Proportion, Indices and Logarithm Part 2Ratio and Proportion, Indices and Logarithm Part 2
Ratio and Proportion, Indices and Logarithm Part 2
 
Ratio and Proportion, Indices and Logarithm Part 1
Ratio and Proportion, Indices and Logarithm Part 1Ratio and Proportion, Indices and Logarithm Part 1
Ratio and Proportion, Indices and Logarithm Part 1
 
Limits and Continuity - Intuitive Approach part 3
Limits and Continuity - Intuitive Approach part 3Limits and Continuity - Intuitive Approach part 3
Limits and Continuity - Intuitive Approach part 3
 
Limits and Continuity - Intuitive Approach part 2
Limits and Continuity - Intuitive Approach part 2Limits and Continuity - Intuitive Approach part 2
Limits and Continuity - Intuitive Approach part 2
 

Recently uploaded

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Oops www.fellowbuddy.com

  • 1. www.fellowbuddy.com Simplifying Students Life Oops 1. By default, members of the class are____________ in nature. a. protected b. private c. public d. static 2. Private members of the class are accessible only to the members of the same class. a. True b. False 3. public data members and member functions of the class are accessible ONLY to the member functions of that class. a. True b. False 4. class TEST { private: int roll_no; public: int age; char name[20]; private: int grade; protected: char gender[20]; private: private: int m1, m2, m3; }; In general view, is this class definition valid? a. Yes b. No
  • 2. www.fellowbuddy.com Simplifying Students Life 5. Members of the class can be declared with auto, extern or register storage classes. a. True b. False 6. C structure differs from CPP class in regards that by default all the members of the structure are__________ in nature. a. private b. protected c. public d. None of these 7. In CPP program, Can we declare and define a user defined function inside a struct as we do in a class ? a. Yes b. No c. Can’t say 8. ____________ refers to the act of representing only essential features without including the background details. a. Data Hiding b. Data Encapsulation c. Data Abstraction d. All of these 9. Only functions of the class can access the data of the class and they(functions) provides the interface between data, objects and the program. This kind isolation of the data from direct access by the program is called_______________ a. Data Abstraction b. Data Hiding c. Data Binding d. Data Encapsulation 10. __________________ is the OOP feature and mechanism that binds together code and the data it manipulates, and keep both safe from outside world. a. Data Binding b. Data Encapsulation c. Data Storing
  • 3. www.fellowbuddy.com Simplifying Students Life d. Data Abstraction 11. Object based language differs from Object oriented language as it does not support features 1. Encapsulation 2. Inheritance 3. Dynamic Binding 4. Abstraction 5. Polymorphism a. only 3 ,4 b. only 1,3,5 c. 2,4,5 d. only 2,3 12. Object oriented programming employs_________ programming approach. a. top-down b. procedural c. bottom-up d. all of these. 13. In CPP, cin and cout are the predefined stream__________ a. Operator b. Functions c. Objects d. Data types 14. Classes in CPP are________ a.derived data types b.User defined data types c.built-in data types d. All of these 15. In CPP, it is mandatory and must to initialize const variables. a. True b. False 16. Constant variables can be created in CPP by using________ a. enum b. const
  • 4. www.fellowbuddy.com Simplifying Students Life c. #define d. All of these e. None of these 17. Which of the followings is/are not keyword/s in CPP? 1. asm 2. boolean 3. mutable 4. export 5. constant_cast a. Only 5 b. Only 1 and 4 c. Only 1,2 and 5 d. Only 2 and 5 18. Can a class be declared/defined inside another class ? a. Yes b. No 19. When a class is defined inside any function or block, it is called_____________ a. Nested class b. Block class c. Local class d. It is not possible 20. The CPP compiler supports automatic type conversions for the user defined data types. a. True b. False 21. Which of the followings are false statements about Local class? 1. A local class type name can only be used in the enclosing function 2. All the methods of Local classes must be defined inside the class only 3. A Local class can contain static data members. 4. A Local class may contain static functions. 5. Non-static variables of the enclosing function are not accessible inside local classes. 6. Local classes cannot access global types, variables and functions. a. Only 1,3 b. Only 3, 6
  • 5. www.fellowbuddy.com Simplifying Students Life c. Only 2 , 4 , 6 d. None of these Answers 1. ANSWER: b. private Explanation: If access specifier is not written/specified, in that case all members of the class are private in nature by CPP conventions. 2. ANSWER: b. False Explanation: It is not compulsion or mandatory that all private members of the class are accessible only to the members of that class. We can have access to private members of the class through friend function which is neither in the scope of that class and nor a member function of that class. 3. ANSWER: b. False Explanation: This statement is false as public members of the class are accessible to the other parts of the program as well. They are accessible to the objects of the other classes in the same application through friend functions or friend classes. 4. ANSWER: a. Yes Explanation: This kind of class declaration is not a standard or good practice as multiple types we are specifying access specifiers. But still, this program smoothly runs as we can write access specifiers multiple times inside the class in any order or even simultaneously. 5. ANSWER: b. False Explanation: No member of the class can be declared with auto, extern or register storage class. If you do so, you will be issued with warning “Storage class ‘register’ is not allowed here”. But members of the class can be declared as static. 6. ANSWER: c. public 7. ANSWER: a. Yes Explanation: Just like a class, we can declare and define a user defined function inside the struct and able to access the same by the structure variable with dot relationship. 8. ANSWER: c. Data Abstraction 9. ANSWER: b. Data Hiding 10. ANSWER: b. Data Encapsulation 11. ANSWER: d. only 2,3 12. ANSWER: c. bottom-up 13. ANSWER: c. Objects
  • 6. www.fellowbuddy.com Simplifying Students Life 14. ANSWER: b.User defined data types 15. ANSWER: a. True Explanation: The answer is True. In order to have constant variables in CPP using const qualifier, they are need to be declared and defined on the same line i.e. declaration with initialization is must. Try following code in Turbo CPP editor or any CPP editor/compiler. int main() { const int x; //this statement will cause error const int y=100; //this statement is valid cout<<“ value of y==”<<y; return 0; } 16. ANSWER: d. All of these 17. ANSWER: d. Only 2 and 5 18. ANSWER: a. Yes Explanation: Like nested structure in C, we can have nested classes in CPP. 19. ANSWER: c. Local class 20. ANSWER: b. False 21. ANSWER: b. Only 3, 6