Logo 
Search:

C++ Programming FAQ

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

What will be the output on executing the mentioned code 5?

  Shared By: Shruti Sharma    Date: Dec 15    Category: C++ Programming    Views: 709

Answer:

Consider the following code snippet:

int p;
string s("Pass");
bool k;
if(s=="pass")
{
k=true;
}
p=true+50+false;
cout<<p;

What will be the output on executing the above code?

Options

a) Error as the Boolean values cannot be added
b) 51
c) 52
d) No output

Answer : b) 51

Share: 
 

Didn't find what you were looking for? Find more on What will be the output on executing the mentioned code 5? Or get search suggestion and latest updates.


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


Tagged: