C++ Interview Questions
Questions Answers Views Company eMail

What is a "RTTI"?

HCL,

6 9901

Is there something that we can do in C and not in C++?

Patni,

14 17700

What is the difference between "calloc" and "malloc"?

ADP,

9 16986

What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?

3 8278

What is the Difference between "printf" and "sprintf"?

iSoft, PentaWare, TCS,

7 44644

What is "map" in STL?

2 8118

When to use Multiple Inheritance?

6 7538

Explain working of printf?

8 20351

Explain about profiling?

1 4078

How many lines of code you have written for a single program?

BoA,

4 11307

How to write Multithreaded applications using C++?

Honeywell, TCS, Wipro,

2 9976

Write any small program that will compile in "C" but not in "C++"?

4 9707

What is Memory Alignment?

TCS,

2 7915

Why preincrement operator is faster than postincrement?

5 15323

What are the techniques you use for debugging?

Adtran,

1 6900


Un-Answered Questions { C++ }

Explain overriding.

605


Where Malloc(), Calloc(), and realloc() does get memory?

610


Explain the different access specifiers for the class member in c++.

548


Declare a class vehicle and make it an abstract data type.

539


What is a storage class?

643






Is atoi safe?

598


What are shallow and deep copy?

599


Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()

1007


Does c++ vector allocate memory?

530


How to declare a function pointer?

577


What is lazy initialization in c++?

656


Discuss the role of C++ shorthands.

547


How would you use qsort() function to sort an array of structures?

723


Why is c++ still popular?

587


Objective The objective of this problem is to test the understanding of Object-Oriented Programming (OOP) concepts, in particular, on encapsulation. Problem Description Create a program for managing customer’s bank accounts. A bank customer can do the following operations: 1. Create a new bank account with an initial balance. 2. Deposit money into his/her account. 3. Withdraw money from his/her account. For this operation, you need to output “Transaction successful” if the intended amount of money can be withdrawn, otherwise output “Transaction unsuccessful” and no money will be withdrawn from his/her account. Input The input contains several operations and is terminated by “0”. The operations will be “Create name amount”, “Deposit name amount”, or “Withdraw name amount”, where name is the customer’s name and amount is an integer indicating the amount of money. There will be at most 100 bank accounts and they are all created on the first month when the bank is opening. You may assume that all account holders have unique names and the names consist of only a single word. Output The output contains the transaction result of withdrawal operations and the final balance of all customers after some withdrawal and deposit operations (same order as the input). Sample Input Create Billy 2500 Create Charlie 1000 Create John 100 Withdraw Charlie 500 Deposit John 899 Withdraw Charlie 1000 0

1704