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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
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
Write the program for fibonacci in c++?
 Question Submitted By :: Vijay_it4all
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write the program for fibonacci in c++?
Answer
# 1
#include<iostream>
int main()
{
int x,y;
x=y=1;
while (x<200)
{
cout<<y<<endl;
x=x+y;
y=x-y;
}
return 0;
}
 
Is This Answer Correct ?    1 Yes 2 No
Kishor Niit Ottapalam
 
  Re: Write the program for fibonacci in c++?
Answer
# 2
#include<iostream.h>
void main()
{
int a=-1;b=1,c;
for(int i=0;i<200;i++)
{
c=a+b; 
cout<<c<<"\t";
a=b;
b=c;
}
 
Is This Answer Correct ?    1 Yes 2 No
Bharghavi
 
 
 
  Re: Write the program for fibonacci in c++?
Answer
# 3
#include<iostream>
void main()
{
int x=1,y=0;
while (x<200)
{
cout<<y<<endl;
x=x+y;
y=x-y;
}
}
 
Is This Answer Correct ?    4 Yes 3 No
Techbots
 

 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
When the design recommends static functions? Symphony1
Difference between Overloading and Overriding? HP4
What are the different types of Storage classes?  3
Why do C++ compilers need name mangling? Lucent1
When volatile can be used? Symphony2
Explain the difference between 'operator new' and the 'new' operator? Lucent1
What is the difference between method and message? HP2
How many pointers are required to reverse a link list? CTS2
What are inline functions? Verizon2
Write any small program that will compile in "C" but not in "C++" Honeywell6
1. What does the following do: void afunction(int *x) { x=new int; *x=12; } int main() { int v=10; afunction(&v); cout<<v; } a) Outputs 12 b) Outputs 10 c) Outputs the address of v Quark3
What does '\r' and '\b' mean? Please explain with example.  2
Write a program to reverse a linked list? Catalytic-Software2
string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring Quark1
class HasStatic { static int I; }; Referring to the sample code above, what is the appropriate method of defining the member variable "I", and assigning it the value 10, outside of the class declaration? a) HasStatic I = 10; b) int static I = 10; c) static I(10); d) static I = 10; e) int HasStatic::I = 10; Quark1
what is data Abstraction? and give example TCS13
Write a function which takes a character array as input and reverses it in place. Lehman-Brothers2
What is object slicing and how can we prevent it? Tech-Mahindra2
write program for palindrome  3
What is your strongest programming language (Java, ASP, C, C++, VB, HTML,C#, etc.)? Microsoft20
 
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