ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Software >> Programming-Languages >> C++
 
  STL (45)  OOPS (186)  C++-General (222)
 


 

Back to Questions Page
 
Question
What is a pure virtual function?
Why is it represented as = 0...how is the internal 
implementation for the same
Rank Answer Posted By  
 Question Submitted By :: Priyas
This Interview Question Asked @   CTS
I also faced this Question!!   © ALL Interview .com
Answer
A pure virtual function makes a class abstract.0 is used in 
its representation to distinguish it from a normal virtual 
function. More at

http://www.cppquestions.com/viewtopic.php?f=26&t=14
 
0
Vikas
 
 
Answer
A virtual function with a null body is said to be pure 
virtual function.
The pure virtual function can be defined later in its 
derived class.......
 
0
Viji
 
 
Answer
I believe pure virtual function is a member function with a 
declaration as NULL;
virtual void fun()=0;
Now why zero,since the internal implementation of virtual 
function is collection of function pointer ...we intialize 
this value of function pointers as NULL.
 
0
Helloworld
 
 
 
Question
What is a mutex and a critical section.Whats difference 
between them?How do each of them work?
Rank Answer Posted By  
 Question Submitted By :: Priyas
This Interview Question Asked @   CTS
I also faced this Question!!   © ALL Interview .com
Answer
Both of them are synchronization objects.
Critical sections are used for intraprocess synchronization 
while mutexes are required for interprocess 
synchronization. The latter is much heavier in terms of 
resources consumed.

Vikas
http://www.cppquestions.com
 
0
Vikas
 
 
Question
What is object slicing and how can we prevent it?
Rank Answer Posted By  
 Question Submitted By :: Priyas
This Interview Question Asked @   Tech-Mahindra
I also faced this Question!!   © ALL Interview .com
Answer
Object slicing occurs when we assign an instance of the
subclass to a variable of type base class.

http://www.cppquestions.com/viewtopic.php?f=17&t=49
 
0
Vikas
 
 
Answer
When an instance of derived class is assigned to base class 
instance object slicing takes place.ie in this case the 
derived portion gets truncated and only the base portion 
remains.

The problem of object slicing can be prevented by the use 
of pure virtual functions.
 
0
Prits
 
 
Question
what is virtual function in c++
Rank Answer Posted By  
 Question Submitted By :: Natasekhar4u
I also faced this Question!!   © ALL Interview .com
Answer
virtual funtion in cpp is define as globle acess in the 
variable.
 
0
Guest
 
 
Answer
the concept of vitual function comes when inheritance is at 
work. If the overriden function is not made virtual in base 
class , then pointer of derived class will call the funtion 
in base class(instead it should have called the one from 
derived class.)
this is why we make the function in base as virtual.
 
0
Achal
[NIPUNA Technologies]
 
 
Answer
virtual function comes into picture while inheriting the 
base class functions to the derived class functions.
ifthe virtual isnot used then the pointer of derived class 
points to the baseclass function
 
0
Sree
[NIPUNA Technologies]
 
 
Answer
IT'S OVERRIDING A BASE CLASS DEFINITION AT RUN TIME.MEMBER 
FUNCTION IN BASE CLASS AND DERIVED CLASS IS SAME. NORMALLY 
IT INVOKE THE BASE CLASS DEFINITION IF BOTH FUNCTION NAME 
IS SAME.BUT WE NEED TO ACCESS THE DERIVED CLASS DEFINITION 
WE GO FOR VIRTUAL FUNCTION
 
0
Indu
[NIPUNA Technologies]
 
 
Question
how to find the maximum of 10 numbers ?
Rank Answer Posted By  
 Question Submitted By :: Dragoon
I also faced this Question!!   © ALL Interview .com
Answer
int a[]=new int[10];
int max=a[0];

for(int i=0; i<10; i++)
{
   if(a[i]>max)
   {
     max=a[i];
   }
}
System.out.println("Maximum of 10 :" + max);
 
0
Amrutha
 
 
Answer
int a[10],max=0;
cout<<"enter 10 numbers";

for(int i=0;i<10;i++)
{

 cin>>a[i];
 
if(a[i]>max)
 max=a[i];
}
cout<<"the maximum of entered 10 is"<<max;
 
0
Raj
 
 
Answer
#include <iostream>
using namespace std;

void main()
{
	int max = 0;
	int arr[10];
	cout<<"Enter 10 numbers"<<endl;
	for(int i = 0; i<=10; i++)
	{
		cin>>arr[i];
	}
	for(int i = 0; i<=10; i++)
	{
	if(arr[i]>max)
		max =arr[i];

	}

	cout<<"Maximun of the 10 numbers is "<<max<<endl;
	
}
 
0
Prits
 
 
Question
WHAT IS ABSTRUCT DATA TYPE ?
PLEASE EXPLAIN IT.
Rank Answer Posted By  
 Question Submitted By :: Deepak Pareek
This Interview Question Asked @   HCL
I also faced this Question!!   © ALL Interview .com
Answer
A unique datatype, that is defined by the progrmer.It may
refer to an object class in OOP or to a special data type in
traditional,non-OOP languages. 
   ADT is a specification of a set of data and the set of 
operations that can be performed on the data.This supports 
the principle of INFORMATION HIDING.
 
0
Purush
 
 
Question
WHAT IS THE DIFFERENCE BETWEEN ABSTRUCTION AND 
ENCAPSULATION?
PLEASE EXPLAIN IT.
Rank Answer Posted By  
 Question Submitted By :: Deepak Pareek
I also faced this Question!!   © ALL Interview .com
Answer
ABSTRUCTION:
 
Process of providing the neccesary properties & operations 
of an object is called as abstuction

Example take car the car user only know things reqired.
he don't no the internal functionality of the car b'coz it 
is not required for the user .

properties like car:colour,number,model etc.
operations like car:move front,backetc.

ENCAPSULATION:

Process of providing all the properties&operayion of entity 
in one place is called as encapsulation.
 
In java operations are called as methods,properties are
called as variables.

The place where you were write the variables &properties is 
called as class.
 
0
Mahesh_b.tech@2008
 
 
Answer
ABSTRACTION
An abstract class is a parent class that allows inheritance 
but can never be instantiated. Abstract classes contain one 
or more abstract methods that do not have implementation. 
Abstract classes allow specialization of inherited classes.
ENCAPSULATION:
Wrapping up of data into a single unit..
 
3
Ganesh
 
 
Answer
In C++ terms, abstraction is achieved by access modifiers: 
private and protected. Encapsulation is achieved by classes

Vikas
http://www.cppquestions.com/
 
0
Vikas
 
 
Question
How is data security provided in Object Oriented languages?
?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
using class
 
0
Channu
 
 
Answer
in object oriented languages emphasis is laid on not to 
have any global code(functions or variables.) Everything is 
encapsulated inside the body of a class. 
The objects of the class can access only the public members 
of class. So the data mambers are more secure.
 
0
Achal
 
 
Answer
In c++,
Data is encapsulated(hidden) in the form of specifiers such as:

private: accessible only to members of class.

public: accessible everywhere.

protected :accessible only to the members that are
inherited(see inheritance)
 
0
Guest
 
 
Question
What does '\r' and '\b' mean? Please explain with example.
Rank Answer Posted By  
 Question Submitted By :: Rohit Kamlakar
I also faced this Question!!   © ALL Interview .com
Answer
\r is used for carriage return and \b is used for computer 
baep
 
0
Yogita
 
 
Answer
\r is known as carriage return 
e.g  printf("ABC\rDE");
ABC.
then becoz of \r cursor comes back to the 1st char i.e here 
A after that DE is there then finally it print
DEC with cursor on C.
\b is known as back literal 
e.g. printf("ABC\bDE");
then ABC then finally ABDE will get printed.
 
0
Ankita
 
 
Question
wht is major diff b/w c and c++?
Rank Answer Posted By  
 Question Submitted By :: Sntcsanthosh
I also faced this Question!!   © ALL Interview .com
Answer
c is procedural oriented language and C++ is a object 
oriented language.
In C++ we can create object and its properties where as in C
functions are used.
 
0
Dng
 
 
Answer
in c we can use if statements only for 16times but in c++ , 
we can use if for 256 times.
in c it's difficult to solve complex no but in c++ we can 
solve easily by using classes.
c follows down to up approach to complie a program but
c++ follow up to down approach.
in c++ we can add variables any where within the program 
but in c data type are declared only on the starting of the 
function or the main program.
 
0
Narender Vadhava
[NTTF]
 
 
Answer
In C  Lan is middle level lan. but c++ High level lag becoze
C lan. 25 % code is written in Assembly lag .

C is faster compair to c++ becoze c 25 % code Written in
Assembly Lag.that reason its is faster .
 
0
Ashutosh Soni
[NTTF]
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com