CPlusPlus Interview Questions and Answers
Question - 121 : - Give 4 examples which belongs application layer in TCP/IP architecture?
Answer - 121 : - FTP, TELNET, HTTP and TFTP
Question - 122 : - What’s the meaning of ARP in TCP/IP?
Answer - 122 : - The "ARP" stands for Address Resolution Protocol. The ARP standard defines two basic message types: a request and a response. a request message contains an IP address and requests the corresponding hardware address; a replay contains both the IP address, sent in the request, and the hardware address.
Question - 123 : - What is a Makefile?
Answer - 123 : - 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.
Question - 124 : - What is deadlock?
Answer - 124 : - 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.
Question - 125 : - What is semaphore?
Answer - 125 : - Semaphore is a special variable, it has two methods: up and down. Semaphore performs atomic operations, which means ones a semaphore is called it can not be inturrupted.
The internal counter (= #ups - #downs) can never be negative. If you execute the “down” method when the internal counter is zero, it will block until some other thread calls the “up” method. Semaphores are use for thread synchronization.
Question - 126 : - Is C an object-oriented language?
Answer - 126 : - C is not an object-oriented language, but limited object-oriented programming can be done in C.
Question - 127 : - Name some major differences between C++ and Java.
Answer - 127 : - 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 the addresses of the pointer
Question - 128 : - Write a fucntion that will reverse a string.
Answer - 128 : - char *strrev(char *s)
{
int i = 0, len = strlen(s);
char *str;
if ((str = (char *)malloc(len+1)) == NULL)
/*cannot allocate memory */
err_num = 2;
return (str);
}
while(len)
str[i++]=s[–len];
str[i] = NULL;
return (str);
}
Question - 129 : - What is the software Life-Cycle?
Answer - 129 : - The software Life-Cycle are
1) Analysis and specification of the task
2) Design of the algorithms and data structures
3) Implementation (coding)
4) Testing
5) Maintenance and evolution of the system
6) Obsolescence
Question - 130 : - What is the difference between a Java application and a Java applet?
Answer - 130 : - The difference between a Java application and a Java applet is that a Java application is a program that can be executed using the Java interpeter, and a JAVA applet can be transfered to different networks and executed by using a web browser (transferable to the WWW).