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

  Creating an array of names

Just write the codes and label my variables. Example: (with Python not C++). Creating an array of names

  Differences and fundamental operations of a stack

Describe the difference, with examples, between static and dynamic data structures. Draw a visual representation of a linked-list data structure showing how object references are stored and node objects are linked to each other.

  Calculate the celsius equivalent of a fahrenheit temperature

Prepare a program to calculate the Celsius equivalent of a Fahrenheit temperature

  Create a simple text editor that has one large rich text box

Complete the following programming exercise (SIMPLE TEXT EDITOR WITH ONE LARGE RICH TEXT BOX). You will use the OpenFileDialog, StreamReader and StreamWriter objects; the Close, Peek, ReadLine, ShowDialog and WriteLine methods.

  String converter

String Converter: Implement a program that asks the user to input up to 20 strings (stopping when the user inputs 0). Store these strings in a 2-dimensional array. Replace all the characters that are upper-cased to their lower-case equivalent.

  Odd clusters using c programming

The objective of this project is to write an interactive Odd Clusters game, using the programming knowledge you have gained this semester. Your task is to write a programthat allows one player to play a game of Odd Clusters against the computer o..

  Associate the variable contains

Given the string, s , and the list, lst , associate the variable contains with True if every string in lst appears in s(and False otherwise). Thus, given the string Hello world and the list ["H", "wor", "o w"] , contains would be associated with True..

  Summarizing your predicted and actual output

Write a statement summarizing your predicted and actual output, and identify and explain any differences. For your conclusions, write at least one nontrivial paragraph that explains, in detail, either a significant problem you had and how you solv..

  Determining the integer reference parameters

Write a function named time() that has an integer parameter named seconds and three integer reference parameters named hours, mins, and secs. The function is to convert the passed number of seconds into an equivalent number of hours, minutes, and ..

  Represent the real numbers

Assume you are given a set of N

  Calculate the gross pay of a set of employees

Write a C program that will calculate the gross pay of a set of employees - For each employee the program should prompt the user to enter the clock number, wage rate, and number of hours

  Write c program to read one ip address

Write a C or C++ program which Read one IP address at a time from Dec_IPAddresses.txt and convert it into Hex. Store converted values stored in another file (e.g. HEX_IPAddresses.txt).

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