Some questions might be interpretable differently, so I will sum those up here. Note however, that some of these interpretations are not actually synonymes, but just my thoughts on what your teacher could have meant to say.
1. Declaring object of a concrete class in the definition of main function.
See this question: What is the difference between a concrete class and an abstract class?.
This shows it is valid to instantiate or declare a concrete class. The main function is no special exception to this.
Conclusion: this is valid.
2. Writing output statement, in constructor statement.
By constructor statement
, I assume the constructor function
of a class or struct, or something alike, is meant. Usually, I would say that an output statement
is something like writing to the console. However, as the questions use kind of weird language anyway, one could say that by output
statement the return
statement is meant.
Output, as in writing to the console for example, is perfectly legal in a constructor function.
class Foo
{
public:
Foo()
{
std::cout << "I made a Foo\n";
}
}
Output, as in returning something from a function, is not legal in a constructor.
class Foo
{
public:
Foo()
{
return 3; // not legal
}
}
Conclusion: If this is valid or not depends on how you interpret the question.
3. Declaring object of a class having at least one virtual function.
Virtual functions
in classes are explained here: C++ Virtual/Pure Virtual Explained.
The question is clear in that the one or more virtual function are not pure virtual
, so:
Conclusion: this is valid.
4. Declaring objects of a class having all virtual functions.
See my explanation of answer 3 for an explanation of virtual
and pure virtual
functions.
The straightforward interpretation of this answer is: Is it legal to declare an object of a class of which all functions are virtual? In this case the statement is valid, see answer 3.
However, you could interpret all virtual functions
as pure virtual functions
, in which case instantiating the class is not valid.
Conclusion: If this is valid or not depends on how you interpret the question.
Final conclusion
Answer 1 and 3 both describe valid C++. However, answer 2 and 4 can be interpreted in multiple ways, so the answer is not clear.
Personal thought
I have never ever heard of someone calling a return statement
an output statement
. Neither have I heard of someone calling a pure virtual function
an all virtual function
. I think your teacher is weird.