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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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