Answer the following questions true (T) or false (F)
1. You can write a class that is useful with all its constructors in the private section.
2. A constructor can be called implicitly or explicitly. (Implicitly means the compiler did it for you.) In the interest of uniformity in answers, please use class A; for your examples.
1. False
Explanation: Apart from friend of the class (something you will see later in this course) a class with all private constructors cannot create an object of the class. It seems useless to have a class for which you can have no objects..
2. True
Explanation: A constructor can be implicitly called with the declaration A x;. The default constructor is called explicitly with syntax is A x = A();
If the declaration is A x(2), the constructor is called implicilty. The equvalent explicit constructor call is A x = A(2); and so on.
You might also like to view...
Call-by-reference can achieve the security of call-by-value when:
a. The value being passed is small. b. A large argument is passed in order to improve performance. c. A pointer to the argument is used. d. The const qualifier is used.
The fact that class Graphics is abstract contributes to Java’s portability because ________.
a. drawing is performed differently on every platform that supports Java. A subclass of Graphics must be created that uses the drawing capabilities of the current platform. b. objects of non-abstract classes can only be instantiated on the Windows platform. c. drawing should not be performed on non-Linux platforms. d. Class Graphics is not abstract.
A sequential file “properly” stored on an empty disk can be retrieved with minimal seeking. But disks tend to become heavily fragmented as files are added and deleted. Thus, successive references to “adjacent” records in a disk file can result in substantial seeking throughout the disk. Discuss the notion of file reorganization as a scheme for minimizing seeks.Under what circumstances should a file be reorganized?
What will be an ideal response?
________ files use a Lossy image compression algorithm
Fill in the blank(s) with correct word