• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

CPlusPlus Interview Questions Answers

Question - 121 : - What does extern mean in a function declaration?

Answer - 121 : - Using extern in a function declaration we can make a function such that it can used outside the file in which it is defined. An extern variable, function definition, or declaration also makes the described variable or function usable by the succeeding part of the current source file. This declaration does not replace the definition. The declaration is used to describe the variable that is externally defined. If a declaration for an identifier already exists at file scope, any extern declaration of the same identifier found within a block refers to that same object. If no other declaration for the identifier exists at file scope, the identifier has external linkage.

Question - 122 : - What is the difference between char a[] = “string”; and char *p = “string”;?

Answer - 122 : - In the first case 6 bytes are allocated to the variable a which is fixed, where as in the second case if *p is assigned to some other value the allocate memory can change.

Question - 123 : - What is an explicit constructor?

Answer - 123 : - A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.

Question - 124 : - What do you mean by Stack unwinding?

Answer - 124 : - It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.

Question - 125 : - What is a mutable member?

Answer - 125 : - One that can be modified by the class even when the object of the class or the member function doing the modification is const.

Question - 126 : - What is a container class? What are the types of container classes?

Answer - 126 : - A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.

Question - 127 : - Count Number of characters using Pointers?

Answer - 127 : - #include<iostream.h> void main() { int Char_Count(char *get_string); char *strcount "THIS IS A STRING"; int int_word_count Char_Count(strcount); cout<<"word count is "<<int_word_count; } int Char_Count(char *get_string) { int count 0; if (get_string ! NULL) { for (;*(get_string+count) ! ' ';++count); } return count; }  

Question - 128 : - How can you tell what shell you are running on UNIX system?

Answer - 128 : - You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.

Question - 129 : - Differences of C and C++

Answer - 129 : - Could you write a small program that will compile in C but not in C++ ? In C, if you can a const variable e.g. const int i = 2; you can use this variable in other module as follows extern const int i; C compiler will not complain. But for C++ compiler u must write extern const int i = 2; else error would be generated. Bitwise Operations - Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively), what is output equal to in? output = (X & Y) | (X & Z) | (Y & Z);   C++ Object-Oriented Interview Questions And Answers

Question - 130 : - What is an object?

Answer - 130 : - Object is a software bundle of variables and related methods. Objects have state and behavior.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners