<< < 55 56 57 58 59 60 61 62 63 64 65 > >>   Sort: Rank

Anything wrong with this code?
Anything wrong with this code? T *p = new T[10]; delete p; Note: Incorrect replies: “No, everything is correct”, “Only the first element of the array will be deleted”, “The entire array will be deleted, but only the first element destructor will be called”.
2012-05-09, 3791👍, 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, 3811👍, 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, 3787👍, 0💬

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, 3853👍, 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, 3779👍, 0💬

Referring to the sample code above, which one of the following statements is correct?
class A { public: A() { if(x > 1) throw "x overflow"; else x++; } private: static int x; }; int A::x; Referring to the sample code above, which one of the following statements is correct? 1 The class can be instantiated without throwing an exception two times. 2 It cannot be determined how many time...
2012-05-07, 5453👍, 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, 3638👍, 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, 3530👍, 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, 3604👍, 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, 3498👍, 0💬

What will the above code output if strVec is ...
std::cout &lt;&lt; count_if( strVec.begin(), strVec.end(), bind2nd(greater (), "Baz") ); What will the above code output if strVec is a std::vector&lt;std::string >and contains the strings "Foo", "Bar," "Baz", and "Bee"? 1 Unknown, those functions are non-standard. 2 2 3 "Bee" 4 "Baz" 5 ...
2012-05-02, 4682👍, 0💬

Referring to the sample code above, what value does I contain?
char s[] = {'a','b','c',0,'d','e','f',0}; int I = sizeof(s); Referring to the sample code above, what value does I contain? 1 3 2 6 3 7 4 8 5 9
2012-05-02, 4020👍, 0💬

Referring to the sample code above, how do you declare a numbers object called "A" and assign its "I" member the value "2"?
class numbers { int I; public: void set(int v) {I = v;} int read() {return I;} } ; Referring to the sample code above, how do you declare a numbers object called "A" and assign its "I" member the value "2"? 1) A : numbers; A.set(2); 2) numbers set(2); numbers A; 3) numbers A; set(2); 4) A.set(2), B....
2012-05-01, 3949👍, 0💬

Which set of preprocessor directives is used to prevent multiple inclusions of header files?
Which set of preprocessor directives is used to prevent multiple inclusions of header files? 1 #ifndef, #define and #endif 2 #ifdefined and #enddefine 3 #define and #endif only 4 #$if and #endif 5 #if and #define
2012-04-30, 5788👍, 0💬

Referring to the sample code above, which one of the numbered lines of code is legal C++?
class Foo { int i; public: Foo(int x) : i(x) { } }; 1: Foo *f = new Foo; 2: Foo &f = new Foo(1); 3: int i = Foo::i; 4: Foo *af = new Foo[10]; 5: const Foo &af = Foo(1); Referring to the sample code above, which one of the numbered lines of code is legal C++? 1) Line 1 2) Line 2 3) Line 3 4) ...
2012-04-27, 4933👍, 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, 3525👍, 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, 3538👍, 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, 2941👍, 0💬

What is the above sample code an example of?
class Foo; What is the above sample code an example of? 1) A class constructor 2) A class object instantiation 3) A class definition 4) A class declaration 5) A syntax error
2012-04-25, 2877👍, 0💬

What is the value of "count" immediately before the return statement above is executed?
int count=0; class obj { public: obj(){ count++; } ~obj() { count--; } }; main() { obj A,B,C,D ; return 0 ; } What is the value of "count" immediately before the return statement above is executed? 1) 0 2) 1 3) 2 4) 3 5) 4
2012-04-25, 2958👍, 0💬

If this is a complete translation unit, what can be said about the variable "MaxEntries"?
const int MaxEntries = 10; extern int entries[MaxEntries]; If this is a complete translation unit, what can be said about the variable "MaxEntries"? 1) It can only be used within the translation unit shown in the sample. 2) It cannot be used as a case value in a switch statement. 3) It becomes acces...
2012-04-24, 3089👍, 0💬

Which type conditional expression is used when a developer wants to execute a statement only once when a given condition is
Which type conditional expression is used when a developer wants to execute a statement only once when a given condition is met? 1) switch-case 2) for 3) if 4) do-while 5) while
2012-04-24, 3312👍, 0💬

Referring to the sample code above, what is the displayed , output if the input string given were: "5 10 Sample Word 15 20"?
int I, j; string s; cin &gt;&gt; I &gt;&gt; j &gt;&gt; s &gt;&gt; s &gt;&gt; I; cout &lt;&lt; I &lt;&lt; " " &lt;&lt; j &lt;&lt; " "&lt;&lt; s &lt;&lt; " "&lt;&lt; I; Referring to the sample code above, w...
2012-04-23, 3200👍, 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, 2879👍, 0💬

<< < 55 56 57 58 59 60 61 62 63 64 65 > >>   Sort: Rank