Question

True /False 13. _There is only one copy of the classs member func- tions and that copy is shared among all the classs objects 14. Putting class definition in a separate file (e-g. head- er) makes it easy to reuse. 15. _A private data member of a class can usually be accessed from outside the class. 16. A member function of a class can call other private member functions of the same class. 17. _A destructor function can have parameters. 18. _A class can have objects of other classes as data members. 19. The following code is valid: int x-5 f (ptr!- mullptr) cout<<Not Null 20. The following code is valid: int x-5 int *const ptr = &x; pir 7
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi..

13. There is only one copy of the classs member functions and that copy is shared among all the class objects.

Ans: False

for each object it maintains diffrent.

14. Putting class definition in a seperate file (e.g header) makes it easy to reuse.

Ans: True.

15. A private data member of class can usually be accessed from outside the class.

Ans: False.

with use of getter and setters we can access the variables.

16. A member function of a class can call other private member functions of the same class.

Ans: False.

17. A destructor function can have parameters.

Ans: False.
we can simply call ~class name().

18. A class can have objects of other classses as data members.

Ans: False.

19. The following code is valid.

int x=5;
int *ptr = &x;
if(ptr!=null)
cout << "Not Null";

Output:
It prints not null as output console.

true (valid)

20. The following code is valid:

int x=5;
int *const ptr = &x;
*ptr = 7;

Ans: Not valid

int *const ptr = &x;

Please check the above and let me know any issues. Thank you. All the best.

Add a comment
Know the answer?
Add Answer to:
True /False 13. _There is only one copy of the class's member func- tions and that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ 1. The copy constructor is used for one the following scenarios: I. Initialize one object...

    C++ 1. The copy constructor is used for one the following scenarios: I. Initialize one object from another of the same type. II. Copy an object to pass it as argument to a function. III. Copy an object to return it from a function. Read the following program and answer questions (20 points) #include <iostream> using namespace std; class Line public: int getLength( void); Line( int len // simple constructor Line( const Line &obj) 1/ copy constructor Line (); //...

  • Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts...

    Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts What code is human-readable and follows the standards of a programming language? Secret code Source code Key code None of these Machine code Question 3 2 pts What is the symbol that marks the beginning of a one line comment? Question 1 2 pts The preprocessor executes after the compiler. True False Question 5 2 pts A statement that may be used to stop...

  • This program has an array of floating point numbers as a private data member of a...

    This program has an array of floating point numbers as a private data member of a class. The data file contains floating point temperatures which are read by a member function of the class and stored in the array. Exercise 1: Why does the member function printList have a const after its name but getList does not? Exercise 2: Fill in the code so that the program reads in the data values from the temperature file and prints them to...

  • The class dateType is designed to implement the date in a program, but the member function...

    The class dateType is designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the data members. Rewrite the definitions of the function setDate and the constructor so that the values for the month, day, and the year are checked before storing the date into the data members. Add a function member, isLeapYear, to check whether a year is a leap...

  • The following program contains the definition of a class called List, a class called Date and...

    The following program contains the definition of a class called List, a class called Date and a main program. Create a template out of the List class so that it can contain not just integers which is how it is now, but any data type, including user defined data types, such as objects of Date class. The main program is given so that you will know what to test your template with. It first creates a List of integers and...

  • Question 16 You must put your data in classes if you use C++. True False 2...

    Question 16 You must put your data in classes if you use C++. True False 2 points Question 17 Constructors are automatically invoked during class instantiation. True False 2 points Question 18 To make your data accessible to entities outside of your class, declare the members of that class as private. True False 2 points Question 19 You can make arrays of built-in types like int and double, but not of user-defined types. True False 2 points Question 20 One...

  • Please answer read the question first, don't just copy the answer from other websites, thank you...

    Please answer read the question first, don't just copy the answer from other websites, thank you very much. and this is a c++ problem. 17.Given the following class definitions class Deque; class DequeNode friend class Deque; private: int data; DequeNode *prev; DequeNode *next; class Deque private: DequeNode *head; int number; DequeNode *tail; public: Deque ) Deque() void push front (const int &); void push back (const int &) int front () int back ) int pop front ); int pop...

  • Multiple Choice Multiple Choice Section 2.1 - 2.2 Introduction to Classes Here is the start of...

    Multiple Choice Multiple Choice Section 2.1 - 2.2 Introduction to Classes Here is the start of a class declaration: class foo { public: void x(foo f); void y(const foo f); void z(foo f) const; ... Which of the three member functions can alter the PRIVATE member variables of the foo object that activates the function? A. Only x can alter the private member variables of the object that activates the function. B. Only y can alter the private member variables...

  • Need help doing program In bold is problem E2 #include<iostream> #include<string> #include<vector> using namespace std; //Car...

    Need help doing program In bold is problem E2 #include<iostream> #include<string> #include<vector> using namespace std; //Car class //Defined enum here enum Kind{business,maintenance,other,box,tank,flat,otherFreight,chair,seater,otherPassenger}; //Defined array of strings string KIND_ARRAY[]={"business","maintenance","other,box","tank,flat","otherFreight","chair","seater","otherPassenger"}; class Car { private: string reportingMark; int carNumber; Kind kind; //changed to Kind bool loaded; string destination; public: //Defined setKind function Kind setKind(string knd) { for(int i=0;i<8;i++) //repeat upto 8 kinds { if(knd.compare(KIND_ARRAY[i])==0) //if matched in Array kind=(Kind)i; //setup that kind } return kind; } //Default constructor Car() { } //Parameterized constructor...

  • Overview This checkpoint is intended to help you practice the syntax of operator overloading with member...

    Overview This checkpoint is intended to help you practice the syntax of operator overloading with member functions in C++. You will work with the same money class that you did in Checkpoint A, implementing a few more operators. Instructions Begin with a working (but simplistic) implementation of a Money class that contains integer values for dollars and cents. Here is my code: /********************* * File: check12b.cpp *********************/ #include using namespace std; #include "money.h" /**************************************************************** * Function: main * Purpose: Test...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT