< 1 2 3 4 5 6 7 … > >>   Sort: Date

You’re given a simple code for the class BankCustomer. Write the following function
You’re given a simple code for the class BankCustomer. Write the following functions: * Copy constructor * = operator overload * == operator overload * + operator overload (customers’ balances should be added up, as an example of joint account between husband and wife) Note:Anyone confusing assignme...
2012-05-08, 4089👍, 0💬

What is deadlock? C++
What is deadlock? C++ Deadlock is a situation when two or more processes prevent each other from running. Example: if T1 is holding x and waiting for y to be free and T2 holding y and waiting for x to be free deadlock happens.
2012-04-09, 4078👍, 0💬

Consider the following struct declarations:
Consider the following struct declarations: struct A { A(){ cout &lt;&lt; "A"; } }; struct B { B(){ cout &lt;&lt; "B"; } }; struct C { C(){ cout &lt;&lt; "C"; } }; struct D { D(){ cout &lt;&lt; "D"; } }; struct E : D { E(){ cout &lt;&lt; "E"; } }; struct F : A...
2012-05-09, 4024👍, 0💬

What problems might the following macro bring to the application?
What problems might the following macro bring to the application? #define sq(x) x*x
2012-05-08, 4010👍, 0💬

Assuming that: char* p = "abc" int a = 123; .....
3. Assuming that: char* p = "abc"; int a = 123; Fully parenthesize the following expressions and evaluate them: *p++; *--p; *--p++; a--; ++a; ++a--;
2012-04-19, 4005👍, 0💬

Explain which of the following declarations will compile and what will be constant
Explain which of the following declarations will compile and what will be constant - a pointer or the value pointed at: * const char * * char const * * char * const Note: Ask the candidate whether the first declaration is pointing to a string or a single character. Both explanations are correct, but...
2012-05-07, 3992👍, 0💬

Assuming that all the necessary standard headers ....
using namespace std; string s("abcdefghijk"); string::size_type I = s.find_first_of("a-c"); s = string(s, I, string::npos); I = s.find_first_not_of("a-e"); cout << string(s, I, string::npos); Assuming that all the necessary standard headers have been included, what is the output produced be th...
2012-05-03, 3974👍, 0💬

Referring to the sample code above, what is the ....
Sample Code class HasStatic { static int I; }; Referring to the sample code above, what is the appropriate method of defining the member variable "I", and assigning it the value 10, outside of the class declaration? 1 int static I = 10; 2 int HasStatic::I = 10; 3 HasStatic I = 10; 4 static I(10); 5 ...
2012-05-04, 3870👍, 0💬

Assuming that all the necessary standard headers have been ....
class Parent { public: Parent () { Status () ; } virtual ~Parent () { Status () ; } virtual void Status () { cout << "Parent "; } } ; class Child : public Parent { public: Child () { Status () ; } virtual ~Child () { Status () ; } virtual void Status () { cout &lt;&lt; "Child " ; } } ;...
2012-05-03, 3867👍, 0💬

Which one of the following operators can only be ....
Which one of the following operators can only be overridden when implemented as a member function of the class it is being implemented for? 1 == (double equal) 2 + (plus) 3 ! (exclamation point) 4 = (equal) 5 & (ampersand)
2012-05-04, 3863👍, 0💬

Virtual Destructor - What is the need for “Virtual Destructor”?
Virtual Destructor - What is the need for “Virtual Destructor”? Destructors are declared as virtual because if do not declare it as virtual the base class destructor will be called before the derived class destructor and that will lead to memory leak because derived class’s objects will not get fre...
2012-04-03, 3831👍, 0💬

What is RTTI? C++
What is RTTI? C++ Answer1. RTTI stands for "Run Time Type Identification". In an inheritance hierarchy, we can find out the exact type of the objet of which it is member. It can be done by using: 1) dynamic id operator 2) typecast operator Answer2. RTTI is defined as follows: Run Time Type Informati...
2012-04-02, 3807👍, 0💬

What is the difference between a copy constructor and an overloaded assignment operator?
What is the difference between a copy constructor and an overloaded assignment operator? A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.
2012-03-16, 3789👍, 0💬

Giving the following class definitions, how many subobjects of class V in class X?
Giving the following class definitions, how many subobjects of class V in class X? class V { /* ... */ }; class B1 : virtual public V { /* ... */ }; class B2 : virtual public V { /* ... */ }; class B3 : public V { /* ... */ }; class X : public B1, public B2, public B3 { /* ... */};
2012-04-27, 3759👍, 0💬

What is output equal to in Bitwise Operations - ...
What is output equal to in Bitwise Operations - ... What is output equal to in Bitwise Operations - Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively), what is output equal to in? output = (X & Y) | (X & Z) | (Y & Z);
2012-04-04, 3757👍, 0💬

Your manager has asked you to integrate an existing project
Scenario:- Your manager has asked you to integrate an existing project with an external timer. Her requirements include adding a global variable whose contents can be only read by the software but whose value will be continuously updated by the hardware clock. Referring to the above scenario, which ...
2012-04-26, 3725👍, 0💬

What is a template? C++
What is a template? C++ Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two followi...
2012-02-03, 3703👍, 0💬

What is semaphore? C++
What is semaphore? C++ Semaphore is a special variable, it has two methods: up and down. Semaphore performs atomic operations, which means ones a semaphore is called it can not be inturrupted. The internal counter (= #ups - #downs) can never be negative. If you execute the “down” method when the int...
2012-04-09, 3697👍, 0💬

I write a program in C++ that asks the user for names of students and their cooresponding midterm scores ...
I write a program in C++ that asks the user for names of students and their cooresponding midterm scores ... I write a program in C++ that asks the user for names of students and their cooresponding midterm scores, at the end, it displays each person, their average, gpa, class ave, total a's, b's, e...
2012-03-14, 3660👍, 0💬

Will the following program execute? C++
Will the following program execute? C++ Will the following program execute? void main() { void *vptr = (void *) malloc(sizeof(void)); vptr++; } Answer1 It will throw an error, as arithmetic operations cannot be performed on void pointers. Answer2 It will not build as sizeof cannot be applied to void...
2012-03-23, 3642👍, 0💬

Define precondition and post-condition to a member function. C++
Define precondition and post-condition to a member function. C++ Precondition: A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fa...
2012-01-11, 3617👍, 0💬

Design and implement a String class that satisfies the following:
Design and implement a String class that satisfies the following: * Supports embedded nulls * Provide the following methods (at least) o Constructor o Destructor o Copy constructor o Assignment operator o Addition operator (concatenation) o Return character at location o Return substring at location...
2012-04-18, 3558👍, 0💬

Differences of C and C++ Could you write a small program that will compile in “C” but not in “C++”?
Differences of C and C++ Could you write a small program that will compile in “C” but not in “C++”? In C, if you can a const variable e.g. const int i = 2; you can use this variable in other module as follows extern const int i; C compiler will not complain. But for C++ compiler u must write extern...
2012-04-03, 3558👍, 0💬

What is a default constructor? C++
What is a default constructor? C++ Default constructor WITH arguments class B { public: B (int m = 0) : n (m) {} int n; }; int main(int argc, char *argv[]) { B b; return 0; }
2012-03-15, 3521👍, 0💬

< 1 2 3 4 5 6 7 … > >>   Sort: Date