
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
![1. Which of the following will dynamically allocate a double?
a. double* ptr=double x;
b. double* ptr=double x(0);
c. double* ptr=new double;
d. none of the above
2. Copy constructors are generally required for a class when
3.
a. For all classes
b.
When the class contains members that point to dynamically allocated memory
c. When the class is passed by reference to a non-member function and the values
are changed
d. None of the above
are member functions that are called automatically when
an object of the class type is instantiated and the
object goes out of scope
is called when that
4. Given the following statement: float* ptr=new float[10]; The proper syntax to deallocate
the memory is
a. delete ptr
b. delete[] ptr;
c. delete ptr[];
d. none of the above
5. The difference between opening a file in ios::app mode, versus ios::out mode is that
a. app mode will append data to the end of the existing data in the file while out
mode will destroy the existing data in the file.
b. App mode will not create the file if it does not already exist.
c. Opening a file in out mode will fail if the file already exists.
d. None of the above
6. A friend function is a function that is
a. Not part of the class
b. Has access to the private members and member functions of the class
c. Both a and b
d.
None of the above](https://content.bartleby.com/qna-images/question/298aa5db-21d9-479e-aac5-153a1acb17c3/c68e376f-b7ef-421c-b44e-e54621a687d5/2rk743h_thumbnail.png)
Transcribed Image Text:1. Which of the following will dynamically allocate a double?
a. double* ptr=double x;
b. double* ptr=double x(0);
c. double* ptr=new double;
d. none of the above
2. Copy constructors are generally required for a class when
3.
a. For all classes
b.
When the class contains members that point to dynamically allocated memory
c. When the class is passed by reference to a non-member function and the values
are changed
d. None of the above
are member functions that are called automatically when
an object of the class type is instantiated and the
object goes out of scope
is called when that
4. Given the following statement: float* ptr=new float[10]; The proper syntax to deallocate
the memory is
a. delete ptr
b. delete[] ptr;
c. delete ptr[];
d. none of the above
5. The difference between opening a file in ios::app mode, versus ios::out mode is that
a. app mode will append data to the end of the existing data in the file while out
mode will destroy the existing data in the file.
b. App mode will not create the file if it does not already exist.
c. Opening a file in out mode will fail if the file already exists.
d. None of the above
6. A friend function is a function that is
a. Not part of the class
b. Has access to the private members and member functions of the class
c. Both a and b
d.
None of the above
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- main.cpp: In function ‘int main()’: main.cpp:32:25: error: expected type-specifier before ‘MilageTrackerNode’ 32 | lastNode = new MilageTrackerNode(miles, date); | ^~~~~~~~~~~~~~~~~ main.cpp:37:23: error: expected type-specifier before ‘MilageTrackerNode’ 37 | currNode=new MilageTrackerNode(miles, date); | ^~~~~~~~~~~~~~~~~ I am getting this erro for these two lines of codes and I am not sure whyarrow_forwardC++ question Question 2: syllable count Problem statement In English, a syllableLinks to an external site. is a unit of pronunciation having one vowel sound (a, e, i, o, u). For example the word innocent has 3 syllables as we can break it into 3 sounds like in·no·cent. As a general rule of thumb, the Oxford English Dictionary says, “with most adjectives and adverbs of more than one syllable, and with all those of more than two syllables,” “the normal mode” of forming the comparative and superlative is by using “more” and “most”. For example we say more or most innocent rather than using innocenter or innocentest. Imagine you are an engineer of a team developing English grammar checker. Your task is to write a function named count_syllables to count number of syllables in a given English word of all lower case letters.arrow_forward//Test isEqual function cout << endl << "Testing isEqual function"; cout << endl << "------------------------" << endl; if (isEqual(s2, s3)) cout << "s2=\"" << s2 << "\" and s3=\"" << s3 << "\" are equal" << endl; else cout << "s2=\"" << s2 << "\" and s3=\"" << s3 << "\" are not equal" << endl; delete[] s3; s3 = getCopy(s2); if (isEqual(s2, s3)) cout << "s2=\"" << s2 << "\" and s3=\"" << s3 << "\" are equal" << endl; else cout << "s2=\"" << s2 << "\" and s3=\"" << s3 << "\" are not equal" << endl; bool isEqual(const charPtr s1, const charPtr s2){/*returns true if the cstring s1 is equal to the cstring s2Definition: Two c-strings s1 and s2 are equal if they have the same lengthand characters of s1 and s2 at corresponding indexes are the same.*/ }arrow_forward
- 1 def all_fluffy(s: str) -> bool: 2 """Return True iff every letter in s is fluffy. Fluffy letters are those 3. that appear in the word 'fluffy'. 4 #TODO: Add at least one example to the docstring and complete the body 7 8 9 10 #TODO: Now complete the function bodyarrow_forwardDescribe the differences between the write member function and the << operator.arrow_forwardAssume there is a function called mystery. It already has the following prototype: void mystery(bool flag); Which of the following prototypes would not be considered a proper overload for mystery? void mystery(bool valid); void mystery(string msg, double x); void mystery(int num); void mysteryO:arrow_forward
- Q5: Correct the following code fragment and what will be the final results of the variable a and b class A {protected int x1,y1,z; public: A(a, b,c):x1(a+2),y1 (b-1),z(c+2) { for(i=0; i<5;i++) x1++;y1++;z++;}}; class B {protected: int x,y; public: B(a,b):x(a+1),y(b+2) { for(i=0; i<5;i++) x+=2; y+=1;}}; class D:public B, virtual public A { private: int a,b; public: D(k,m,n): a(k+n), B(k,m),b(n+2),A(k,m,n) { a=a+1;b=b+1;}); int main() {Dob(4,2,5);)arrow_forwardQ5: Correct the following code fragment and what will be the final results of the variable a and b class A {protected int x1,y1,z; public: A(a, b,c):x1(a+2),y1 (b-1),z(c+2) { for(i=0; i<5;i++) x1++;y1++;z++;}}; class B {protected: int x,y; public: B(a,b):x(a+1),y(b+2) { for(i=0; i<5;i++) x+=2; y+=1;}}; class D:public B, virtual public A { private: int a,b; public: D(k,m,n): a(k+n), B(k,m),b(n+2),A(k,m,n) { a=a+1;b=b+1;}); int main() {Dob(4,2,5);)arrow_forwardC++arrow_forward
- 9. Complete the function prototype so that the callback parameter accepts a closure. The closure accepts a String and an Int parameter but does not return anything. func send(to: String, data: String, callback: _____ ) { // function body }arrow_forwardQUESTION 10 Determine all the output from the following segment of the program as it would appear on the screen. int my_function1(); void my_function2(int = 15); float my_function3(int &); int main() { %3D int x = 25, у; float z; y = my_function1(); cout <« "y: my_function2(); z = my_function3(x); cout <« "z: " « z « endl; my_function2(x); <« y « endl; <« x « endl; %3D cout <« "x: return 0; } pint my_function1() { int x = 1; x += 15; return x; } avoid my_function2(int y) { static int x = 24;arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education