CPlusPlus Interview Questions Answers

Question - 32 : - What problems might the following macro bring to the application?

Answer - 32 : - #define sq(x) x*x

Question - 33 : - What are the advantages and disadvantages of B-star trees over Binary trees?

Answer - 33 : - 1.
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.
2.
The major difference between B-tree and binary tres is that B-tree is a external data structure and binary tree is a main memory data structure. The computational complexity of binary tree is counted by the number of comparison operations at each node, while the computational complexity of B-tree is determined by the disk I/O, that is, the number of node that will be loaded from disk to main memory. The comparision of the different values in one node is not counted.

Question - 34 : - Write a short code using C++ to print out all odd number from 1 to 100 using a for loop

Answer - 36 : - 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.

Question - 37 : - Name some major differences between C++ and Java.

Answer - 37 : - 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

Answer - 39 : - 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.