1 2 3 4 5 6 > >>   Sort: Date

Which one of the following statements is TRUE in regard to overloading the ++ operator?
Which one of the following statements is TRUE in regard to overloading the ++ operator? 1 You cannot define a post-increment operator. 2 You cannot define a pre-increment operator 3 You cannot define both a pre-increment and post increment operator for a class. 4 You must use a dummy parameter to de...
2018-01-10, 7087👍, 1💬

fork()
main() { int i = 2; int ret_val; while(i > 0) { ret_val = fork(); if (ret_val==0) { printf(“In child %d. \n”, i); } else{ printf(“In parent %d. \n”, i);} i=i-1; } } } The logic of this code looks clear. But what is the question?
2009-04-19, 4801👍, 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, 4520👍, 0💬

STL Containers - What are the types of STL containers?
STL Containers - What are the types of STL containers? There are 3 types of STL containers: 1. Adaptive containers like queue, stack 2. Associative containers like set, map 3. Sequence containers like vector, deque
2012-04-02, 4392👍, 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, 3994👍, 0💬

Anything wrong with this code? T *p = 0; delete p;
Anything wrong with this code? T *p = 0; delete p; Yes, the program will crash in an attempt to delete a null pointer.
2012-03-05, 3502👍, 0💬

What does the following code do and why would anyone write something like that?
What does the following code do and why would anyone write something like that? void send (int *to, int * from, int count) { int n = (count + 7) / 8; switch ( count % 8) { case 0: do { *to++ = *from++; case 7: *to++ = *from++; case 6: *to++ = *from++; case 5: *to++ = *from++; case 4: *to++ = *from++...
2012-05-11, 3457👍, 0💬

What will the above code output if strVec is ...
std::cout << count_if( strVec.begin(), strVec.end(), bind2nd(greater(), "Baz") ); What will the above code output if strVec is a std::vector<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 4
2012-05-02, 3441👍, 0💬

Explain the scope resolution operator.
Explain the scope resolution operator. It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
2012-03-13, 3364👍, 0💬

What is a Makefile? C++
What is a Makefile? C++ Makefile is a utility in Unix to help compile large programs. It helps by only compiling the portion of the program that has been changed. A Makefile is the file and make uses to determine what rules to apply. make is useful for far more than compiling programs.
2012-04-06, 3362👍, 0💬

What are the advantages and disadvantages of B-star trees over Binary trees?
What are the advantages and disadvantages of B-star trees over Binary trees? Answer1 B-star trees have better data structure and are faster in search than Binary trees, but it’s harder to write codes for B-start trees. Answer2 The major difference between B-tree and binary tres is that B-tree is a e...
2012-04-13, 3304👍, 0💬

Explain virtual inheritance.
Explain virtual inheritance. Draw the diagram explaining the initialization of the base class when virtual inheritance is used. Note: Typical mistake for applicant is to draw an inheritance diagram, where a single base class is inherited with virtual methods. Explain to the candidate that this is no...
2012-05-10, 3288👍, 0💬

In the H file you see the following declaration
In the H file you see the following declaration: class Foo { void Bar( void ) const ; }; Tell me all you know about the Bar() function.
2012-05-14, 3267👍, 0💬

General technical question
What is the difference between Java and C++? What is the advantage of each of them? Java does not support typedefs, defines, or a preprocessor. Without a preprocessor, there are no provisions for including header files. Since Java does not have a preprocessor there is no concept of #define macros or...
2011-06-28, 3235👍, 0💬

What’s potentially wrong with the following code?
What’s potentially wrong with the following code? long value; //some stuff value &= 0xFFFF; Note: Hint to the candidate about the base platform they’re developing for. If the person still doesn’t find anything wrong with the code, they are not experienced with C++.
2012-05-11, 3144👍, 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 int main() { int MAX=4; int total =0; int average=0; int numb; cout<<"Please enter your input from 5 to 9"; cin>>numb; if((numb <5)&&(n umb>9))cout<<...
2012-03-28, 3128👍, 0💬

How many ways are there to initialize an int with a constant?
How many ways are there to initialize an int with a constant? Two. There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation. int foo = 123; int bar (123);
2012-03-14, 3081👍, 0💬

Should BasketOfApples derive from BasketOfFruit? Why or why not?
Given the following classes class Fruit { // … } class Apple : public Fruit { // … } class Peach : public Fruit { // … } // Container of fruit class BasketOfFruit { BasketOfFruit() ; void insert( Fruit & f ) ; // … } // Container of apples class BasketOfApples /* ??? */ { // … } Should BasketO...
2012-05-14, 3051👍, 0💬

Anything wrong with this code?
Anything wrong with this code? T *p = 0; delete p; Note: Typical wrong answer: Yes, the program will crash in an attempt to delete a null pointer. The candidate does not understand pointers. A very smart candidate will ask whether delete is overloaded for the class T.
2012-05-10, 3024👍, 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, 3021👍, 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, 3008👍, 0💬

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

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, 2977👍, 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, 2973👍, 0💬

1 2 3 4 5 6 > >>   Sort: Date