Find jobs | Jobseekers
Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Career Services Resume Services Interview questions Articles Books
Content
C++ interview
C++ access control
C++ COM
C++ constructors destructors
C++ containers
C++ DCOM
C++ derived class
C++ error handling
C++ exception handling
C++ friend members
C++ inheritance
C++ inline function
C++ memory leaks
C++ namespaces
C++ new and delete
C++ operator overloading
C++ pointers
C++ references
C++ static data
C++ syntax
C++ template
C++ type checking
C++ virtual functions
C++ as an object-oriented
More concept of C++
C++ data types
C++ control constructs
C++ Collections
C++ Functions
C++ Arrays
C++ C-string
C++ Classes and structure
C++ Friend functions & classes
C++ Polymorphism
C++ Multiple inheritance
C++ Function template
C++ Class templates
C++ Standard stream class
Data structure in C++
 
ASP.NET | ADO.NET | AJAX
C#.NET | VB.NET | PHP
NET Remoting | NET Interview
  
C | C++ | Java | Oops
Data Structure | OS
   
Database concepts | Oracle
SQL Server | Biztalk | Sharepoint
Notification services
Reporting Services
Service-oriented architecture
Data warehousing | MySQL
  
Project Management 
Linux | Testing | Networking
Software engineering 
  
UML | XML | HTML | SOAP 
CSS | VBScript  | Web Services
   
CV Cover letter | Interview 
HR | Soft skills | GD 
Working from Home 
Tutorial
ASP.NET | VB.NET | C#.NET     
Remoting.NET | Web service
Remoting overview | ADO.NET
UML | Sql server 

C++ 

C++ interview questions and answer

Next>>

By Nishant Kumar

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6

Send request to get more ASP.NET, C++ questions, sample CV and personal interview tips in PDF format

ASP.NET Interview Questions
VB.Net Interview Questions 
C#.Net Interview Questions
SQL Server Interview Questions
UML Interview Questions

List down elements of an object oriented language.

Answer - A class is a user defined data type. It serves as a template of the objects.....

Explain constructors and destructors.

Answer - Constructors are the member functions of the class that executes automatically whenever an object.......

Define access privileges in C++.

Answer - You have access privileges in C++ such as public, protected and private that helps.....

Explain the difference between structures and classes

Answer - Syntactically and functionally, both structures and classes are....

Explain container class and its types in C++.

Answer - A container stores many entities and provide sequential or direct access to them. List, vector and strings are......

Define storage classes in C++

Answer - Storage class defined for a variable determines the accessibility and longevity of the variable. The accessibility.......

Define an Iterator class

Answer - A container class hold group of objects and iterator class is used to traverse through the objects maintained..........

What are pure virtual functions?

Answer - The base class with pure virtual function can't be instantiated since there is no definition...........

Define structured programming.

Answer - Structured programming techniques use functions or subroutines to organize the programming code. The programming purpose is broken into smaller pieces and organized together using function. This technique provides cleaner code and simplifies maintaining the program. Each function has its own identity and isolated from other, thus change in one function doesn’t affect other.


Question - Explain Object oriented programming.

Answer - Object oriented programming uses objects to design applications. This technique is designed to isolate data. The data and the functions that operate on the data are combined into single unit. This unit is called an object. Each object can have properties and member functions. You can call member function to access data of an object. It is based on several techniques like encapsulation, modularity, polymorphism, and inheritance.

What is object oriented programming (OOP)?
What are the various elements of OOP?
Explain an object, class and Method.
Define Encapsulation and Information Hiding in OOP.
Explain Inheritance and Polymorphism in OOP.
What are the advantages of OOP?

Question - What is function prototype in C++?

Answer - A function prototype is a declaration of a function that omits the function body. It specifies the function's name, argument types and return type. E.g. int add(int,int)

Question - What are the ways to comment statement in C++?

Answer - C++ supports two types of comments.
/* */ is used for commenting a block of code.
// is used for single line comments.

Question - Define Structure in C++.

Answer - The C++ programming technique allows defining user defined datatypes through structure. The syntax to declare structure is as follows:

struct student
{
      char name[100]
      char address[250]
};

Question - Explain typecasting.

Answer - Typecasting enables data type conversion. C++ supports Implicit conversions and Explicit conversion. Implicit conversions automatically performed when a value is copied to a compatible type. If there is an operation between an int and a float, the int is promoted to float before performing operation.

You can cast types explicitly as follows.
int i, j, k;
k = i * long(j);

Question - Define void pointer using C++.

Answer - In C++, void represents the absence of type, so void pointers are pointers that point to a value that has no type. The void pointers can point to any data type.
We can declare void pointer as follows.
Void *p;

Question - When do you use :: Operator in C++?

Answer - :: is the scope resolution operator. When local variable and global variable are having same name, local variable gets the priority. C++ allows flexibility of accessing both the variables through a scope resolution operator.

Question - Define reference variable in C++.

Answer - A reference variable is just like pointer with few differences. It is declared using & operator. A reference variable must always be initialized. The reference variable once defined to refer to a variable can’t be changed to point to other variable. You can't create an array of references the way it is possible with pointer.

Question - What is const qualifier?

Answer - const qualifier is used to specify the variable that can’t be change throughout the program. Variable with const qualifier is often named in uppercase.

Question - When do you use bool data type?

Answer - The bool data type can take only two values true or false.

Question - What is function overloading in C++?

Answer - You can have multiple functions with same name using function overloading facility of C++. You can use same name for multiple functions when all these functions are doing same thing.

Question - What is operator overloading in C++?

Answer - With this facility in C++, you can give additional meaning to operators.

Question - Define Inline Function.

Answer - When the function is defined Inline, the C++ compiler puts the function body inside the calling function. You can define function as Inline when the function body is small and need to be called many times, thus reduces the overhead in calling a function like passing values, passing control, returning values, returning control.

Question - Define class using C++.

Answer - A class holds the data and functions that operate on the data. It serves as the template of an object.

Question - When do you use this pointer?

Answer - 'this pointer' is used as a pointer to the class object instance by the member function. The address of the class instance is passed as an implicit parameter to the member functions.

Question - What is new and delete operator?

Answer - In C++, when you want dynamic memory, you can use operator new. It returns a pointer to the beginning of the new block of memory allocated. It returns a pointer to the beginning of the new block of memory allocated.

When memory allocated by new operator is no longer required, it is freed using operator delete.

Question - Define local class in C++.

Answer - Local class is define within the scope of a function and nested within a function. 
E.g.
int func1()
{
    class localclass1
    {.....};
}

Question - Define namespace in C++.

Answer - Namespaces groups together entities like classes, objects and functions under a name. Namespaces provide a way to avoid name collisions of variables, types, classes or functions. Namespaces reduces the use of nested class thus reduces the inconvenience of handling nested class.

Question - What is the default access level?

Answer - The access privileges in C++ are private, public and protected. The default access level assigned to members of a class is private. Private members of a class are accessible only within the class and by friends of the class. Protected members are accessible by the class itself and its sub- classes. Public members of a class can be accessed by anyone.

Question - Explain friend class in C++.

Answer - When a class declares another class as its friend, it is giving complete access to all its data and methods including private and protected data and methods to the friend class member methods. Friendship is one way only, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.

Question - What is virtual function?

Answer - Virtual function is the member function of a class that can be overriden in its derived class. It is declared with virtual keyword. Virtual function call is resolved at run-time (dynamic binding) whereas the non-virtual member functions are resolved at compile time (static binding).

Question - Define default constructor.

Answer - Default constructor is the constructor with no arguments or all the arguments has default values.

Question - Define abstraction.

Answer - The process of hiding unnecessary data and exposing essential features is called abstraction. Abstraction is separating the logical properties from implementation details.

Question - What is overriding?

Answer - Defining a function in the derived class with same name as in the parent class is called overriding. In C++, the base class member can be overridden by the derived class function with the same signature as the base class function. Method overriding is used to provide different implementations of a function so that a more specific behavior can be realized.

Question - What is copy constructor?

Answer - A copy constructor is a special type of constructor that is used to create an object as a copy of an existing object. It takes an argument which is a reference to the object to be copied.


Posted on July 21, 2008 at 18:10 PM

Question - Define private, protected and public access control.

Answer
Private
Private is the default access specifier for every declared data item in a class. Private data belongs to the same class in which it is created and can only be used by the other members of the same class.

Protected
When a data item is declared as protected it is only accessible by the derived class member.

Public
Public allows to use the declared data item used by anyone from anywhere in the program. Data items declared in public are open to all and can be accessed by anyone willing to use their values and functions they provide.



Posted on August 05, 2008 at 22:10 PM by Amit Satpute
Question - What are the characteristics of Object Oriented programming language?

Answer
Some key features of the Object Oriented programming are:

  • Emphasis on data rather than procedure
  • Programs are divided into entities known as objects
  • Data Structures are designed such that they characterize objects
  • Functions that operate on data of an object are tied together in data structures
  • Data is hidden and cannot be accessed by external functions
  • Objects communicate with each other through functions
  • New data and functions can be easily added whenever necessary
  • Follows bottom up design in program design
Question - What are the basic Concepts used in the Object-Oriented Programming language?

Answer

Object
Class
Data Abstraction and Encapsulation
Polymorphism
Inheritance
Message passing
Dynamic binding

Question - What is Turbo C++?

Answer
Turbo C++ provides an environment called IDE (Integrated Development Environment). The editor is used to create the source file, compile it, link it and then execute it.

Question - How to control the number of chars read in a string by using scanf()?

Answer
By using the a format specifier

char buf[25];
scanf("%20s", buf);

Doing this limits the length of the characters that will be read by scanf() to 20 characters maximum although the buffer can hold 25 characters. 

Question - How to detect an end of a file?

Answer
You can either use the ifstream object ‘fin’ which returns 0 on an end of file or you can use eof() which is a member function of the ios class. It returns a non zero value on reaching the end of file.


Next>>



 
Today's Hot Jobs
C++  SQL Server
.NET  Java  Oracle
Finance  Marketing
Seekers  Employers
Copyright © 2008 CareerRide.com. All rights reserved.