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

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Recently uploaded (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

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