Logo 
Search:

C++ Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C++ ProgrammingRSS Feeds

What is the output of the code mentioned below? - select option

  Shared By: Billy Evans    Date: Mar 05    Category: C++ Programming    Views: 588

Answer:

Consider the following code segment:
#include<iostream>
template<class temp>
int powerofTwo(temp &x)
{
return(!(x-1)&x);
}
void main()
{
int b=powerofTwo(100);
cout<<b;
}

What is the output of the above code?

Options

a) 0
b) 1
c) 100
d) None of the above

Answer : a) 0

Share: 
 



Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: