Computer Science, asked by rajeshpatwa086, 5 months ago

1 Which among the following helps to create a temporary instance?
2. How many types of constructors are available for use in general with
3. In which access should a constructor be defined, so that objecte
SUN
EXERCISES
PART 1: MULTIPLE CHOICE QUESTIONS.
A Implicit call to a default constructor
B. Explicit call to a copy constructor
C. Implicit call to a parameterized constructor
D. Explicit call to a constructor
parameters)?
A 2
C. 4
B 3
D. 5
be created in any function?
A Public
B. Protected
D. Any access specifier will work
C. Private
4. What is true about constructor?
A. It can contain return type
B. It can take any number of parameters
C. It can have any non access modifiers
D. Constructor cannot throw exception
5. What would be the behaviour if one parameterized constructor
A Compilation error B. Compilation succeeda
C. Runtime error
D. Compilation succeeds but at the time of creating object uning de
it throws compilation error
6. What would be behaviour if constructor has a return type?
A Compilation error B Runtime error
C. Compilation and runs successfully
D. Only String return type is allowed
7. Which of these method of Object class can clone an object>
A Objectcopy
в copy
C. Object clone
D clone​

Answers

Answered by janeetanaseem58
0

Answer:

Q 1:

Explicit call to a constructor can let you create a temporary instance.

Explanation:

This is because the temporary instances doesn't have any name.

Q 2:

There are 3 types of constructors in general, namely, default constructors, parameterized constructors and copy constructors.

Q 3:

Constructor function should be available to all the parts of program where the object is to be created. Hence it is advised to define it in public access, so that any other function is able to create objects.

Similar questions