Very simple C++ questions. Please answer all of them. Fact You should consider p
ID: 2247539 • Letter: V
Question
Very simple C++ questions. Please answer all of them.
Fact You should consider procedural (imperative) programs written in the C programming language as "collections of functions". T or F? You should consider object-oriented programs written in the C++ programming language as "collections of classes". T or F? The function main() is a member function of some system-defined class. A class definition contains syntax which defines the class da _____ members and member fu _____ (methods). T or F? A class is the definition of a user-defined data type. Please finish the brief sketch I've started for you of an archetype class definition. From my dictionary "archetype: a perfect example: a prototype. class CLASS { }: (Continuing 5) T or F? The semicolon: after the close curly brace } is absolutely necessary. T or F? Every class member function must be defined with a return type like int or void or bool. C++ uses 3 different access specifiers: What are they?Explanation / Answer
Q:1--. True
Q:2--> T or F? The c++ function main() is a member function of some system - defined class.
Ans:--> False. main() is not the library function. However, a standard also imposes some requirements of its signature.
(3) A class definition contains syntax which defines the class data member and member functions(methods).
--> Data members define attributes of class and member functions define its behavior.
(4) T or F? A class is the definition of user defined data type.
Ans:--> True. By using class we can declare a user defined data type, which is known as an object.
Syntax to declare an object :--> <class_name> <Object_name>
(5)
class pieces
{
//we declare data members as private so it willbe accessible to this class only.
private:
data_members;
//We declare member functions as public. So we can access these functions from outside of this class
public:
<return_type> memberfunctions()
{
}
};
Q;6--> T or F? The semicolon; after the close curly brce} is absolutely necessary.
Ans:-->True, The semicolon; after the close curly brce} is absolutely necessary and required by the language.
Q;7--> T or F, Every class member function must be defined with return types like int, void or bool.
Ans:-> True, In function signature, you must tell the compiler to what value function will return.
Q:8--> C++ uses 3 different access specifiers:
(i) public (ii) private (iii) protected
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.