-
When an object of a derived class is assigned to another object of the same derived class, is the data associated with the base class copied? To find out, use the following two classes and write a program that demonstrates what happens.
class base {
int a;
public:
void load_a(int n) { a= n; }
int ge() { return a;}
};
class derived : public base {
int b;
public:
void load_b(int n) {b=n;}
int get_b() {return b;}
};
Date posted:
May 29, 2018
-
Using the stack class, write a function called loadstack() that returns a stack that is already loaded with letters of the alphabet (a-z.). Assign this stack to another object in the calling routine and prove that it contains the alphabet. Be sure to change the stack size so it is large enough to hold the alphabet.
Date posted:
May 29, 2018
-
Explain five good programming practices.
Date posted:
May 29, 2018
-
This is a question based on Introduction to Computer Systems unit in Computer science course
Date posted:
May 26, 2018
-
List three categories of operating systems.
Date posted:
May 26, 2018
-
As a programmer, what is the significance of the Integrated Development Environment(IDE) in programming?
Date posted:
May 26, 2018
-
As a programmer, briefly explain why comments are used when writing a program.
Date posted:
May 26, 2018
-
Define the following terms as used in computer programming: (a.) A compiler (b.) A debugger (c.) An algorithm
Date posted:
May 26, 2018
-
What is computer programming?
Date posted:
May 26, 2018
-
Using an example, differentiate a code from a program.
Date posted:
May 26, 2018
-
Explain three techniques of detecting deadlocks in a computer system.
Date posted:
May 16, 2018
-
Explain common types of computer networks.
Date posted:
May 16, 2018
-
What is social Engineering?
Date posted:
May 16, 2018
-
Explain characteristics of information security within an organization?
Date posted:
May 16, 2018
-
Giving examples explain threats to data security.
Date posted:
May 16, 2018
-
What is a cyber crime?
Date posted:
May 16, 2018
-
Describe the difference between an internal and an external hyperlink
Date posted:
May 14, 2018
-
What’s the difference between encoding, encryption, and hashing?
Date posted:
May 13, 2018
-
Expand on Claude Shannon’s theorem. Differentiate the term confusion and diffusion as envisaged by Shannon to strengthen crypto-algorithm.
Date posted:
May 13, 2018
-
In DES, the encryption and decryption algorithms are the same. Is that also the case in AES?
Date posted:
May 13, 2018
-
What do we mean by public-key cryptography?
Date posted:
May 13, 2018
-
What is a certificate and why are certificates needed in public key cryptography?
Date posted:
May 13, 2018
-
To illustrate exactly when an object is constructed and destructed when returned from a function, create a C++ class called who. Have who's constructor take one character argument that will be used to identify an object.Have the constructor display a message similar to this when constructing an object:
Constructing who #X
where x is the identifying character associated with each object when an object is destroyed, have a message similar to this displayed:
Destroying who #x
where, again, x is the identifying character. Finally, create a function called make_who() that returns a who object. Give each object a unique name.Note the output displayed by the program.
Date posted:
May 12, 2018
-
other than the incorrect freeing of dynamically allocated memory, think of a situation in which it would be improper to return an object from a function.
Date posted:
May 12, 2018
-
As you know, when an object is passed to a function, a copy of that object is made.Further, when that function returns, the copy's destructor function is called.Keeping this in mind, what is wrong with the following program?
// This program contains an error.
#include
#include
using namespace std;
class dyna {
int *p;
public:
dyna(int i);
~dyna() { free(p); cout << "freeing \n"; }
int get() { return *p; }
};
dyna::dy*) malloc(sizeof(int));
if(!p) {
cout << "Allocation failure\";
exit(1);
}
*p = i;
}
// Return negative value of *ob.p
int neg(dyna ob)
{
retur.get();
}
int main()
{
dyna 0(-10);
cout << o.get() << "\n";
cout << neg(o) << "\n";
dyna o2(20);
cout << o2.get () << "\n";
cout << neg (o2)\n";
cout << o.get () << "\n";
cout << neg (o) << "\n";
return 0;
}
Date posted:
May 12, 2018
-
If a queue dynamically allocates memory to hold the queue, explain the reason for that occurence and state whether in such a situation it is possible to block one queue from being assigned to another.
Date posted:
May 12, 2018
-
Create a class called dice that contains one private integer variable.Create a function called roll() that uses the standard randomn number generator, rand(), to generate a number between 1 and 6. Then have roll() display that value.
Date posted:
May 12, 2018
-
Create a class called prompt in C++ language.Pass its constructor function a prompting string of your choice.Have the constructor display the string and then input an integer.Store this value in a private variable called count.When an object of type prompt is destroyed, ring the bell on the terminal as many times as the user entered.
Date posted:
May 12, 2018
-
Create a C++ class called line that draws a line on the screen.Store the line length in a private integer variable called len.Have line's constructor take one parameter: the line length.Have the constructor store the length and actually draw the line .If the system does not support graphics, display the line by using *. Give the line a destructor that erases the line.
Date posted:
May 12, 2018
-
Explain what an anonymous union is and how it differs from a normal union.
Date posted:
May 12, 2018