Question 95Asked in BPSC TRE 2.0 (2023) Computer Class 9-10

Which of the following statements is true about the new and malloc?

Which of the following statements is true about the new and malloc? I. The 'new' is a type of operator while 'malloc' is a kind of function. II. The 'new' invokes a constructor, whereas 'malloc' does not invoke the constructor. III. The 'malloc' returns void pointer and also needed to typecast whereas 'new' returns required pointer.
  1. AOnly I
  2. BBoth I and II
  3. CBoth II and III
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (D) More than one of the above

Explanation

All three statements are true (new is an operator that calls constructors; malloc is a function returning void*), so more than one option, i.e. (D), is correct.

From BPSC TRE 2.0 (2023) Computer Class 9-10 — Previous Year Paper

This is question 95 of BPSC TRE 2.0 (2023) Computer Class 9-10 — Previous Year Paper. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.