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, 8566👍, 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, 5542👍, 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, 5397👍, 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);
2023-12-13, 5104👍, 1💬

💬 2023-12-13 kamalesh: thank you

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, 4952👍, 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, 4746👍, 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, 4743👍, 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, 4534👍, 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, 4405👍, 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, 4241👍, 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 ...
2012-05-02, 4135👍, 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, 3962👍, 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, 3933👍, 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, 3749👍, 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, 3735👍, 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, 3719👍, 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, 3700👍, 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, 3620👍, 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, 3609👍, 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, 3531👍, 0💬

What is an orthogonal base class? C++
What is an orthogonal base class? C++ If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same deri...
2012-01-16, 3530👍, 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, 3514👍, 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, 3497👍, 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, 3497👍, 0💬

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