Statements uses object-oriented programming

Assignment Help C/C++ Programming
Reference no: EM131103067

Question 1: Which of the following C++ statements uses object-oriented programming?

a) for(int i = 0; i < 10; i++);

b) x = 5;

c) int *numbers = new int[10];

d) Mario.draw();

e) None of the above

Question 2: Consider the following class interface. Which of the functions is the default constructor?

1 2 3 4 5 6 7

classLibrary

{public:

Library();

Library(intnumBooks);

Library(constLibrary&other);};

a) Library();

b) Library(int numBooks);

c) Library(const Library &other);

d) All of the above

e) None of the above

Question 3: In the class interface from the previous question, which of the functions is the copy constructor?

a) Library();
b) Library(int numBooks);
c) Library(const Library &other);
d) All of the above
e) None of the above

Question 4: Which of the following C++ statements declares a Student object and initializes it with the value "Luke"?

a) Student Luke;
b) Student = "Luke";
c) Student s("Luke");
d) All of the above
e) None of the above

Question 5: Consider the following snippet of C++ code. Which of the following C++ statements uses dynamically allocated memory?

1 2 3

intx=5;

int*y=newint;

*y=5;


a) int *z = &x;

b) int &r = x;

c) int p = *y;

d) All of the above

e) None of the above

Question 6: Consider the following snippet of C++ code. Which statement causes a memory leak?

1 2 3 4 5 6

chara='!';

char*b=newchar;

char&c =*b;

char*d=&a;

char*e=newchar[12];

deleteb;

a) char a = '!';

b) char *b = new char;

c) char &c = *b;

d) char *d = &a;

e) char *e = new char[12];

f) delete b;

Question 7: In the previous question's snippet, which of the following C++ statements would fix the memory leak if added at the end?

a) a = NULL;
b) delete a;
c) delete d;
d) d = NULL;
e) delete[] e;

Question 8: Which of the following C++ statements correctly prints out the value of the first element in the array below? C++

1 2

int*array=newint[5];

array[0]=5;

a) cout << array[0] << endl;
b) cout << *array << endl;
c) cout << *(array + 0) << endl;
d) All of the above
e) None of the above

Reference no: EM131103067

Questions Cloud

Analyze the behavior of spam-oriented botnets : BotLab is a platform at the University of Washington that continually monitors and analyzes the behavior of spam-oriented botnets. There are many other locations on the Internet that keep real-time activities of botnets across the globe.
Should the firm lease or borrow and buy the equipment : Assuming that the lease can be arranged, should the firm lease or borrow and buy the equipment? Explain. Consider the $200,000 estimated residual value. Is it appropriate to discount it at the same rate as the other cash flows? What about the other c..
Factors both internal and external to the organization : Defined by the business dictionary, recruitment is, "The process of finding and hiring the best-qualified candidate (from within or outside of an organization) for a job opening, in a timely and cost-effective manner (Unknown, 2014)."
Discuss modes of winding up of a company : Assuming that you have gone to an interview in Rhampsody Co.Ltd for position of an legal representative and the first question are asked is to discuss modes of winding up of a company. What could be your answers?
Statements uses object-oriented programming : In the class interface from the previous question, which of the functions is the copy constructor - Which of the following C++ statements uses object-oriented programming?
Explain the level of sophistication that the board : According to the FASB conceptual framework, the objectives of financial reporting for business enterprises are based on the needs of the users of financial statements.
Explain what the control helps mitigate in a scada system : Select one control, identify whether the control falls under Management, Operational or Technical Controls and explain what this control helps mitigate in a SCADA system?
Apply for hospital presumptive eligibility : See attached sample template for a response to the below post. The sample is a totally different subject, it's just provided as a sample for the type of feedback needed fot the below homework assighnment.
What is meant by the term : What is meant by the term "qualitative characteristics of accounting information"?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Execute the next line which is enter your last name

C++ in VS and I'm trying to run the following program. As soon as I put in my name after the 2nd cout statement, the program ends.

  Compute and return the celsius temperature

Write a program that takes as input a depth (in kilometers) inside the earth and displays the temperature at this depth in degrees Celsius and in degrees Fahrenheit. The relevant formula is

  Prepare a program to add the specific numbers

Write a program that will read in 5 numbers and add 10 to the first number, 20 to the second number, and 30 to the third number, 40 to the fourth and 50 to the 50th.

  Show that regularity is preserved under the shift operation

Show that the regularity is preserved under the shift operation - I have the answer already but i do not understand

  Whitewater high school has contracted

Whitewater High School has contracted you to write a program that will read a file of student names and test scores in the formation FIRST NAME LAST NAME: SCORE1 SCORE2 SCORE3, where each of the scores is an integer

  Function that returns the height of a binary tree

Write a function called getHeight() that returns the height of a given binary tree - CptS 122 Write a function called countSmallerThan() that returns the number of nodes whose values are smaller than the supplied input paramter

  What happens when c is a function of just one variable

What happens when C is a function of just one variable? Can you provide a geometric interpretation of what gradient descent is doing in the one-dimensional case?

  Calculate and display the number of units of electricity

The manager of PG&E wants a program that calculates a customer's electric bill. He will enter the current and previous meter readings.

  Evaluate the roots of the 2nd order equation

Write a 'C' program to evaluate the roots of the 2nd order equation - Ensure that your program includes the solutions for the subsequent SPECIAL cases

  Write function that calculates the pay amount

Write a second function that calculates the pay amount. If the salesperson owes money, the return amount from the function is a negative number.

  Review structured programming concepts

Review structured programming concepts - Describe the main concepts of the object-oriented programming paradigm.

  Rewrite a c++ program

I have Assign in C++ , I create evrething but my project not work also Iput it all documents.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd