I will quote the exact text present in the site from where I took the above code :

The object bar is constructed in two stages: first, the Foo constructor is invoked and then the Bar constructor is invoked. The output of the above program will be to indicate that Foo's constructor is called first, followed by Bar's constructor.

Now, my question is:

Will the constructor Foo() be called when an object of class Bar is declared?

Every derived-class object contains a base-class object as part of it. By implication, constructing a derived-class object involves constructing the base-class object as well.

Therefore, when you construct an object of type Bar, part of that construction process is to construct an object of type Foo.

The Foo constructor is not inherited in the normal sense, because if it were inherited, you would be able to override it--and you can't. One of Foo's constructors is always executed as part of constructing a Bar. All you can do is choose which constructor to execute, and which arguments to pass to it, by using a constructor initializer:

that will execute Bar's default constructor. That constructor has a constructor-initializer of Foo(42), which means that it will pass an argument of 42 to Foo's constructor when it executes. The fact that that argument exists, and the fact that it has type int, will select the Foo constructor that takes an int argument.

Now considering the source code in your post, what will happen if I execute something like:

Bar b(12)

Which constructor will be called in this case? Will this give an error because the class Bar has no constructor of the form Bar(int) or will it instead execute the constructor Foo(int) without any error?

Also, will it be fine if I edit line#10 of your source and make it something like:

Now considering the source code in your post, what will happen if I execute something like:

Bar b(12)

Which constructor will be called in this case? Will this give an error because the class Bar has no constructor of the form Bar(int) or will it instead execute the constructor Foo(int) without any error?

It will give an error because Bar has no constructor of the form Bar(int).

Also, will it be fine if I edit line#10 of your source and make it something like:

Bar(): Foo(int) { }

in order to generalize the Foo part?

No. A constructor initializer expects an expression, and int is not an expression.