<< < 2 3 4 5 6 7 8 >   Sort: Date

Is C an object-oriented language?
Is C an object-oriented language? C is not an object-oriented language, but limited object-oriented programming can be done in C.
2012-04-10, 2598👍, 0💬

When should you use multiple inheritance?
When should you use multiple inheritance? There are three acceptable answers: "Never," "Rarely," and "When the problem domain cannot be accurately modeled any other way."
2012-03-19, 2596👍, 0💬

What is a COPY CONSTRUCTOR and when is it called?
What is a COPY CONSTRUCTOR and when is it called? A copy constructor is a method that accepts an object of the same class and copies it’s data members to the object on the left part of assignement: class Point2D{ int x; int y; public int color; protected bool pinned; public Point2D() : x(0) , y(0) {...
2012-02-14, 2596👍, 0💬

Write a program that ask for user input from 5 to 9 then calculate the average
Write a program that ask for user input from 5 to 9 then calculate the average #include "iostream.h" int main() { int MAX = 4; int total = 0; int average; int numb; for (int i=0; i&lt;MAX; i++) { cout &lt;&lt; "Please enter your input between 5 and 9: "; cin &gt;&gt; numb; while ...
2012-01-27, 2592👍, 0💬

You’re given a simple code for the class BankCustomer. Write the following functions ...
You’re given a simple code for the class BankCustomer. Write the following functions ... 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 u...
2012-03-01, 2590👍, 0💬

Referring to the sample code above, on which one of the following lines does an initializer list occur?
1: class Foo { 2: int size; string name; double value; 3: 4: public: 5: Foo() : size(0), name("unknown"), value(0.0) { 6: } 7: Foo(int s) { 8: size = s; name = "unknown"; value = 0.0; 9: } 10: Foo(int s = 0, string n = "unknown", double v=0) { 11: size = s; name = n; value = v; 12: } 13: }; Referrin...
2012-04-26, 2589👍, 0💬

What is polymorphism? Explain with an example?
What is polymorphism? Explain with an example? "Poly" means "many" and "morph" means "form". Polymorphism is the ability of an object (or reference) to assume (be replaced by) or become many different forms of object. Example: function overloading, function overriding, virtual functions. Another exa...
2012-02-24, 2585👍, 0💬

What problem does the namespace feature solve?
What problem does the namespace feature solve? Multiple providers of libraries might use common global identifiers causing a name collision when an application tries to link with two or more such libraries. The namespace feature surrounds a library’s external declarations with a unique namespace tha...
2012-03-22, 2583👍, 0💬

Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array? Mergesort always makes recursive calls to sort subarrays that are about half size of the original array, resulting in O(n log n) time.
2012-02-21, 2583👍, 0💬

Name some pure object oriented languages. C++
Name some pure object oriented languages. C++ Smalltalk, Java, Eiffel, Sather.
2012-01-13, 2582👍, 0💬

In the derived class, which data member of the base class are visible?
In the derived class, which data member of the base class are visible? In the public and protected sections.
2012-01-23, 2575👍, 0💬

Name some major differences between C++ and Java.
Name some major differences between C++ and Java. C++ has pointers; Java does not. Java is platform-independent; C++ is not. Java has garbage collection; C++ does not. Java does have pointers. In fact all variables in Java are pointers. The difference is that Java does not allow you to manipulate th...
2012-04-10, 2574👍, 0💬

How do you write a function that can reverse a linked-list?
How do you write a function that can reverse a linked-list? Answer1: void reverselist(void) { if(head==0) return; if(head-&lt;next==0) return; if(head-&lt;next==tail) { head-&lt;next = 0; tail-&lt;next = head; } else { node* pre = head; node* cur = head-&lt;next; node* curnext = ...
2012-01-17, 2574👍, 0💬

What is a scope resolution operator?
What is a scope resolution operator? A scope resolution operator (::), can be used to define the member functions of a class outside the class.
2012-02-23, 2568👍, 0💬

Referring to the sample code above, what is the type of T2 in the object ::f?
template&lt;class T = int&gt; class Foo { public: template&lt;class T2 = T&gt; class InnerFoo { T2 t2; }; static InnerFoo&lt;long&gt; *f; }; Foo&lt;double&gt; f; Referring to the sample code above, what is the type of T2 in the object ::f? 1) double 2) t2 3) char 4) i...
2012-04-20, 2565👍, 0💬

Define a constructor - What it is and how it might be called (2 methods).
Define a constructor - What it is and how it might be called (2 methods). Answer1 constructor is a member function of the class, with the name of the function being the same as the class name. It also specifies how the object should be initialized. Ways of calling constructor: 1) Implicitly: automat...
2012-02-03, 2565👍, 0💬

What do you mean by pure virtual functions?
What do you mean by pure virtual functions? A pure virtual member function is a member function that the base class forces derived classes to provide. Normally these member functions have no implementation. Pure virtual functions are equated to zero. class Shape { public: virtual void draw() = 0; };
2012-02-24, 2559👍, 0💬

Why are arrays usually processed with for loop?
Why are arrays usually processed with for loop? The real power of arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to make this work is a iterated statement in which the variable i serves as a c...
2012-02-29, 2555👍, 0💬

What’s the output of the following program? Why?
What’s the output of the following program? Why? #include &lt;stdio.h&gt; main() { typedef union { int a; char b[10]; float c; } Union; Union x,y = {100}; x.a = 50; strcpy(x.b,\"hello\"); x.c = 21.50; printf(\"Union x : %d %s %f \n\",x.a,x.b,x.c ); printf(\"Union y :%d %s%f \n\",y.a,y.b,y.c)...
2012-02-27, 2554👍, 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-03-02, 2548👍, 0💬

What is function overloading and operator overloading?
What is function overloading and operator overloading? Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When...
2012-01-25, 2547👍, 0💬

What is an HTML tag? C++
What is an HTML tag? C++ Answer: An HTML tag is a syntactical construct in the HTML language that abbreviates specific instructions to be executed when the HTML script is loaded into a Web browser. It is like a method in Java, a function in C++, a procedure in Pascal, or a subroutine in FORTRAN.
2012-02-29, 2539👍, 0💬

What does extern mean in a function declaration?
What does extern mean in a function declaration? It tells the compiler that a variable or a function exists, even if the compiler hasn’t yet seen it in the file currently being compiled. This variable or function may be defined in another file or further down in the current file.
2012-03-09, 2534👍, 0💬

What’s the best way to declare and define global variables?
What’s the best way to declare and define global variables? The best way to declare global variables is to declare them after including all the files so that it can be used in all the functions.
2012-03-06, 2534👍, 0💬

<< < 2 3 4 5 6 7 8 >   Sort: Date