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++ General
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
given the code segment below
               void main()
               {
                 cout<<"my no. is";
               }
question is how can we get the output hai aravind my no. is
99999999999 without editig the main().
 Question Submitted By :: Aravind K R
I also faced this Question!!     Rank Answer Posted By  
 
  Re: given the code segment below void main() { cout<<"my no. is"; } question is how can we get the output hai aravind my no. is 99999999999 without editig the main().
Answer
# 1
#include <iostream>

using namespace std;

class dummy
{
public:
        dummy()
        {
                cout<<"Hai Arvind ";
        }

        ~dummy()
        {
                cout<<" 99999999999";
        }
};

dummy obj;

int main()
{
        cout<<"my no. is";
        return 0;
}
 
Is This Answer Correct ?    5 Yes 1 No
Pankaj Rathor
 
  Re: given the code segment below void main() { cout<<"my no. is"; } question is how can we get the output hai aravind my no. is 99999999999 without editig the main().
Answer
# 2
Overload the << operator.

ostream& operator << (ostream& ot, const char* chr)
{
   using std::operator<<;
   return ot << "Hai Arvind " << chr << " 99999999999";
}
 
Is This Answer Correct ?    1 Yes 1 No
Sunil Chopra
 
 
 

 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
What are the techniques you use for debugging? Adtran1
Shall we use 'free' to free memory assigned by new, What are the further consequences?? Symphony4
what is the use of templates?  3
Disadvantages of c++  5
what is meaning of isa and hsa  1
What is "mutable" keyword? Infosys2
If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2.  1
What are advantages of C++ when comparing with C? HP5
What is Virtual Inheritance? Wipro2
What is the Difference between "C structure" and "C++ structure"?  6
How do I open binary files?  1
Memory is not a constraint. In a single iteration(NOTE: you can't go back), how will you find out the 10th last node/item in a linked list. Goldman-Sachs10
In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. GE4
How long does this loop run: for(int x=0; x=3; x++) a) Never b) Three times c) Forever Quark10
What are the differences between public, private, and protected access? Wipro5
What is the output of printf("%d")? HCL32
What is name mangling?  1
What is multithreading and what is its use?Whats are multithreading techniques used in C++?  1
Why would you make a destructor virtual? Lehman-Brothers3
What is size of null class? HP4
 
For more C++ General 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