Most Asked C++ Interview Questions

Have you got a C++ interview coming up? We have put together Most asked C++ job interview questions for you to be prepared for your big day.

[caption id="attachment_1123" align="aligncenter" width="712"]Most Asked C++ Interview Questions Most Asked C++ Interview Questions[/caption]

Most Asked C++ Interview Questions



#1 What is a function?

- Collection of modules is called a function.

- A function is a set of statements that perform a particular task whenever called...

#2 What is a prototype in c++ and c?

Prototype is a model that can explain the structure of the functions we are going to use in our C and C++ programs. Suppose we are going to use one function called add with two parameters to add means the prototype of the function is int add(int a,int b), simply prototype in C and C++ is the function declaration.

#3 How do I initialize a pointer to a function.

answer 1: int add(int x,int y) //function
{
int z;
z=x+y;
}
int (*funcptr)(int,int); //ptr declaration
funcptr=add; // ptr initialization


Answer 2:

void (*)f();

Here f if is pointer to a function having no arguments and
no return values.

#4 what is data abstraction? What is data abstraction?

#5 what is dynamic binding? What is dynamic binding?

#6 What will be created in c++ ? what will be created in c++ ?

#7 What is the difference between template and macro? What is the difference between template and macro? looping statement in c++ looping statement in c++

#8 Whether C++ is a pure Object oriented programming? Whether C++ is a pure Object oriented programming?

#9 What is meant by operator overloading with the best example? What is meant by operator overloading with the best example?

Programming Interview Questions


[catlist id=79]

#10 How do I initialize a pointer to a function. How do I initialize a pointer to a function?

#11 What is the difference between char a[] = “string What is the difference between char a[] = “string"; and char *p = “string"; ?

#12 Why can’t I initialize a local array with a string?  Why can’t I initialize a local array with a string?

#13 What can I safely assume about the initial values of variables which are not explicitly initialized?  What can I safely assume about the initial values of variables which are not exp...

#14 My compiler is complaining about an invalid redeclaration of a function, but I only define it once and call it once. What’s happening?  My compiler is complaining about an invalid redeclaration of a function, but I o...

#15 How can I declare a function that returns a pointer to a function of its own type?  how can I declare a function that returns a pointer to a function of its own type?

#16 How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?  How do I declare an array of N pointers to functions returning pointers to function...

#17 I can’t seem to define a linked list node which contains a pointer to itself.  I can’t seem to define a linked list node which contains a pointer to itself.

#18 What’s the auto keyword good for?  What’s the auto keyword good for?

#19 What does extern mean in a function declaration?  (4)What does extern mean in a function declaration?
#20 What’s the best way to declare and define global variables?  (3) What’s the best way to declare and define global variables?

#21 What should the 64-bit integer type on new, 64-bit machines be? What should the 64-bit integer type on new, 64-bit machines be?

#22 How do you decide which integer type to use?  How do you decide which integer type to use?

#23 What will be printed as the result of the operation below:#define swap(a,b) a=a+...

#24 What will be printed as the result of the operation below:

main() {     int x=5;     printf(“%d,%d,%dn”,x,x< <2,x>>2); } What will be printed as the result of the operation below:main() { int x=5; ...
What will be printed as the result of the operation below:main() {     int x=20,y=35;     x=y++ + x++;     y= ++y + ++x;     printf(“%d%dn”,x,y); }  What will be printed as the result of the operation below:main() { int x=20,...
What will be printed as the result of the operation below:main() {     int x=20,y=35;     x=y++ + x++;     y= ++y + ++x;     printf(“%d%dn”,x,y); }  What will be printed as the result of the operation below:main() { int x=20,...


#25 What will print out? What will print out?

#26 What does the following code do and why would anyone write something like that? What does the following code do and why would anyone write something like that?

#27 What’s potentially wrong with the following code? What’s potentially wrong with the following code?
Explain virtual inheritance. Draw the diagram explaining the initialization of the base class when virtual inheritance is used. Explain virtual inheritance. Draw the diagram explaining the initialization of t...

#28 Anything wrong with this code? Anything wrong with this code?

#29 What problems might the following macro bring to the application? What problems might the following macro bring to the application?

#30 You’re given a simple code for the class Bank Customer. Write the following functions: You’re given a simple code for the class Bank Customer. Write the following...
Explain which of the following declarations will compile and what will be constant - a pointer or the value pointed at: Explain which of the following declarations will compile and what will be consta...

#31 What is a container class? What are the types of container classes? What is a container class? What are the types of container classes?

#32 What is an orthogonal base class? What is an orthogonal base class?

#33 What is a node class? What is a node class?

#34 Name the operators that cannot be overloaded. Name the operators that cannot be overloaded.

#35 Name some pure object oriented languages. Smalltalk, Java, Eiffel, Sather.  Name some pure object oriented languages. Smalltalk, Java, Eiffel, Sather.

#36 What are proxy objects? What are proxy objects?

#37 What are the conditions that have to be met for a condition to be an invariant of the class?  What are the conditions that have to be met for a condition to be an invariant o...

#38 Define precondition and post-condition to a member function. Define precondition and post-condition to a member function.

#39 What do you mean by Stack unwinding? What do you mean by Stack unwinding?

#40 What is class invariant? What is class invariant?

#41 What is a Null object? What is a Null object?

#42 What is an adaptor class or Wrapper class? What is an adaptor class or Wrapper class?

#43 Differentiate between the message and method.

#44 What is a dangling pointer? What is a dangling pointer?

#45 What is an incomplete type? What is an incomplete type?

#46 List out some of the object-oriented methodologies. List out some of the object-oriented methodologies.

#47 List out some of the OODBMS available. List out some of the OODBMS available.

#48 What is an Iterator class? What is an Iterator class?

#49 What is the use of ‘using’ declaration. What is the use of ‘using’ declaration?

#50 When does a name clash occur? When does a name clash occur?

#51 Why can’t I initialize a local array with a string?

#52 How do I declare an array of N pointers to functions returning pointers to functions returning pointers
to characters?

#53 How do you decide which integer type to use?
Share:

No comments:

Post a Comment

Job Search

Trending Jobs