If we define a member function in a class without specifying its return value, we get a warning which reads as ” (name of function) member function definition looks like a ctor, but name does not match enclosing class”. This is a pretty confusing warning. Actually the meaning of the warning is pretty straight. ctor [...]
Recursion is less efficient than a loop. Therefore use a loop instead of recursion whenever you can. Recursion usually helps create cleaner code. Therefore use recursion when clarity is needed more than efficiency. Consider the following example, which calculates the nth term in the Fibbonacci series. The recursive function calls itself 21,890 times to calculate [...]
#include <iostream.h>
class base
{
public :
f( )
{
f1( ) ;
}
void f1( )
{
cout << “base” ;
}
} ;
class der : public base
{
public :
void f1( )
{
cout << “derived” ;
}
} ;
void main( )
{
der d ;
d.f( ) ;
}
Output of this program will be “base”. This is because the statement
der.f( )
will call base class’s f( ) function. In f( ) we have called f1( [...]
If a dialog box is displayed and Esc key is pressed, OnCancel( ) handler gets called and the dialog gets dismissed. At times we want to take some other step when Esc key is pressed. For example, if user has selected an item from a combo box we may want that his selection should get [...]
If we right click on a file or a directory a pop up menu is displayed from which we can select the ‘Properties’ menu item to display the properties of the selected file/directory. How can we achieve the same in a user-designed dialog?
We will write a small program in which if user clicks a button [...]
Ans: While working in a VC++ source editor if you observe carefully, you would see that if you make any changes in a file an indicator in the form of an asterisk ( ‘*’ ) is shown in the title bar indicating that the file is modified. If you save the file the indicator disappears. [...]
Ans: Consider the following code:
void main( )
{
char str1[10], str2[10] ;
cin.getline ( str1, 9 ) ;
cin.getline ( str2, 9 ) ;
cout << str1 << endl << str2 ;
}
If you run this program you will find that you are able to scan only one string from keyboard and when you hit Enter key to scan the [...]
The friend functions are inherently public and so, are accessible from anywhere in the file. The compiler ignores the access specifier in case of the friend function. However, it is most logical to declare them as public.
The following program shows how to initialize an array of objects.
#include <iostream.h>
class emp
{
private :
int i ;
public:
emp( int ii = 5 )
{
i = ii ;
}
void print( )
{
cout << i << endl ;
}
} ;
main( )
{
emp e1 ( 10 ) ;
emp e2[4] = { e1, emp ( 15 ), 17 } ;
}
In the above program e2[0] will get [...]
In the last articles we saw how to synchronize two threads using critical section and mutex. They allow both the threads to execute at the same time. But only one thread can access the blocking object at a time. However, sometimes we may wish to write two threads where one thread should not get executed [...]
Download source code for this project here Thread Synchronization Using Mutex
The word mutex comes from mutually and exclusive. Mutexe is used to gain exclusive access to a resource mutually shared by two or more threads. Unlike critical sections, mutexes can be used to synchronize threads running in the same process or in different processes. There [...]
Download source code for this project from here Using Critical Section
Software development is a team effort. Unless team members cooperate with one another, synchronize their work with the rest of the team, the team can’t go far. Similarly if in a program there are several threads running, unless their activities are synchronized with one another [...]
VERY IMPORTANT TIPS
C- QUESTIONS
TECHNICAL QUESTIONS FOR INTERVIEW
TECHNICAL QUESTIONS FACED BY MS SCHOLARS IN THE IN…
TECHNICAL INTERVIEW QUESTIONS FOR COMPUTER SCIENCE…
Basic computer Science Interview Questions
Electronics Interview Questions
General HR INTERVIEW QUESTIONS Set A
Verbal ability: Questions And Answers
Reasoning: Questions and Answers
Numeric Ability : Questions and Answers
CRITICAL [...]
for its IP address and the location of its operating system boot files BOOTP sends a UDP message with a subnetwork broadcast address and waits for a reply from a server that gives it the IP address. The same message might contain the name of the machine that has the boot files [...]
DNS uses UDP for communication between servers. It is a better choice than TCP because of the improved speed a connectionless protocol offers. Of course,
transmission reliability suffers with UDP.
A resource record is an entry in a name server’s database. There are several types of resource records used, including name-to-address resolution information. Resource
records are maintained as ASCII files.
External Data Representation is a method of encoding data within an RPC message, used to ensure that the data is not system-dependent.
The Mount protocol returns a file handle and the name of the file system in which a requested file resides. The message is sent to the client from the server after reception of a client’s request.