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
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
what is out put of the following code? 
#include
class Base
{
Base()
{
cout<<"constructor base";
}
~Base()
{
cout<<"destructor base";
}
}
class Derived:public Base
{
Derived()
{
cout<<"constructor derived";
}
~Derived()
{
cout<<"destructor derived";
}
}
void main()
{
Base *var=new Derived();
delete var;
}

 Question Submitted By :: Nazim
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }
Answer
# 1
there is no include file iostream for cout
immproper ending for classes ';'
 
Is This Answer Correct ?    0 Yes 0 No
Anvesh
 
  Re: what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }
Answer
# 2
error.
because, there is no header file.
and no ";" is given after the end of classes.
 
Is This Answer Correct ?    0 Yes 0 No
Pooja Sonawane
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
How can I return multiple values from a function?  3
52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?  3
write a program to find the sum of the array elements in c language?  3
what is object oriental programing?  1
what is compiler  5
What is macro? IBM3
what is volatile in c language? TCS1
What are advantages and disadvantages of recursive calling ? HP6
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); } Motorola1
how to find the kth smallest element in the given list of array elemnts. Silicon3
How can I find out how much memory is available? Persistent1
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc  2
f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c? Geometric-Software5
Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa.  1
To what value are pointers initialized? 1) NULL 2) Newly allocated memory 3) No action is taken by the compiler to initialize pointers.  2
What is structure padding ? HP1
What is the main differences between C and Embedded C?  1
f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } what is the value of 'a' printed  4
Which of the following is not a valid declaration for main ()? 1) int main() 2) int main(int argc, char *argv[]) 3) They both work  2
write a C program to print the program itself ?! TCS7
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
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