Discussion
Function declaration gives the name of the function. Which of the following statements are relevant for function :
(i) The semantics of argument passing are identical to semantics of initialisation.
(ii) The argument types are checked and implicit argument type conversion takes place when necessary.
(iii) The argument types are unchecked and explicit argument type conversion takes place when necessary.
(iv) A function declaration may contain argument names
Answer: B
The answer is (i), (ii) and (iv).
These follow Stroustrup's description of C++ functions. Argument passing has the same semantics as initialisation (i); the types of arguments are checked against the declaration and implicit conversions are applied where needed (ii); and a declaration may include argument names, though the compiler ignores them (iv).
Statement (iii) is the opposite of (ii): arguments are not unchecked, and conversions are implicit, not explicit. So any option including (iii) is wrong, and (i) and (ii) or (ii) and (iv) alone leave out a true statement.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development