• +91 9723535972
  • info@interviewmaterial.com

CPlusPlus Interview Questions and Answers

CPlusPlus Interview Questions and Answers

Question - 131 : - Name 7 layers of the OSI Reference Model?

Answer - 131 : - -Application layer -Presentation layer -Session layer -Transport layer -Network layer -Data Link layer -Physical layer

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

Answer - 132 : - 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 - 133 : - Write the psuedo code for the Depth first Search.

Answer - 133 : - dfs(G, v) //OUTLINE Mark v as "discovered" For each vertex w such that edge vw is in G: If w is undiscovered: dfs(G, w); that is, explore vw, visit w, explore from there as much as possible, and backtrack from w to v. Otherwise: "Check" vw without visiting w. Mark v as "finished".

Question - 134 : - What is the difference between Stack and Queue?

Answer - 134 : - Stack is a Last In First Out (LIFO) data structure. Queue is a First In First Out (FIFO) data structure

Question - 135 : - Describe one simple rehashing policy.

Answer - 135 : - The simplest rehashing policy is linear probing. Suppose a key K hashes to location i. Suppose other key occupies H[i]. The following function is used to generate alternative locations: rehash(j) = (j + 1) mod h where j is the location most recently probed. Initially j = i, the hash code for K. Notice that this version of rehash does not depend on K.  

Question - 136 : - Describe Stacks and name a couple of places where stacks are useful.

Answer - 136 : - A Stack is a linear structure in which insertions and deletions are always made at one end, called the top. This updating policy is called last in, first out (LIFO). It is useful when we need to check some syntex errors, such as missing parentheses.

Question - 137 : - Suppose a 3-bit sequence number is used in the selective-reject ARQ, what is the maximum number of frames that could be transmitted at a time?

Answer - 137 : - If a 3-bit sequence number is used, then it could distinguish 8 different frames. Since the number of frames that could be transmitted at a time is no greater half the numner of frames that could be distinguished by the sequence number, so at most 4 frames can be transmitted at a time.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners