Which of the following data types comes under 'Integer' data type?
short
long
int
all of the mentioned
View Answer
Correct Answer: D — all of the mentioned
Explanation:
No explanation is available for this question yet.
Browse topic-based Object Oriented System Design practice sets.
73 practice sets · Page 4 of 4
Which of the following data types comes under 'Integer' data type?
short
long
int
all of the mentioned
Correct Answer: D — all of the mentioned
Explanation:
No explanation is available for this question yet.
How many Primitive data types are there in Java?
4
2
8
7
Correct Answer: C — 8
Explanation:
Java defines eight simple types of data which are put in four groups. They are integers, floating-point numbers, boolean, characters.
Which of the following data types are available in Java?
Primitive Datatypes
Reference Datatypes
Both
None of the mentioned
Correct Answer: B — Reference Datatypes
Explanation:
Primitive Datatypes are defined by Java. Reference Datatypes are user defined, created using defined constructors of class.
Destructor is defined as _______
Const matrix X(m, n);
matrix:: ~matrix(){ }
matrix:: matrix(void)
matrix()
Correct Answer: B — matrix:: ~matrix(){ }
Explanation:
A destructor is used to destroy the objects that have been created by a constructor. Like a constructor, the destructor is a member function whose name is same as the class name but is preceded by a tilde.
When an object is created and initialized at the same time, a _________ constructor gets called.
Inline Constructor
Copy Constructor
Default Constructor
Parameterized Constructor
Correct Answer: B — Copy Constructor
Explanation:
A copy constructor takes reference to an object of the same class as itself as an argument.
The constructors that can take arguments are called ___________
Default Constructor
Copy Constructor
Parameterized Constructor
Dynamic Constructor
Correct Answer: C — Parameterized Constructor
Explanation:
In order to initialize the various data elements of different objects with different values when they are created parameterized constructors are used.
Which of the following statements about a constructor is not true?
We cannot refer to their addresses.
They cannot be inherited, though a derived class can call the base class constructor.
An object with a constructor can be used as a member of a union.
Constructors cannot be virtual.
Correct Answer: C — An object with a constructor can be used as a member of a union.
Explanation:
An object with a constructor cannot be used as a member of a union. A union is a limited form of the class type. It can contain access specifiers (public, protected, private), member data, and member functions, including constructors and destructors. It cannot contain virtual member functions or static data members. Default access of members in a union is public. A union cannot be used as a base class and cannot be derived from a base class. (same with the constructor too, constructor cannot be inherited, though a derived class can call the basic class constructor).
A ________ is a special member function whose task is to initialize the objects of its class.
Constructor
Destructor
Selector
Iterator
Correct Answer: A — Constructor
Explanation:
Constructors are special because its name is same as the class name. The constructor is invoked whenever an object of its associated class is created. It is called constructor because it constructs the value of data members of the class.
A ________ is a description of a set of objects that share the same attributes, operations, relationships, and semantics.
Structure
Class
Constructor
Function
Correct Answer: B — Class
Explanation:
Classes are the most important building blocks of any object- oriented systems. Classes are used to capture the vocabulary of the system you are developing. Modeling a system involves identifying the things that are important to your particular view. Hence all the above mentioned properties would distinguish each class from one another.
Which of the following object types are generally autonomous, meaning that they can exhibit some behavior without being operated upon by another object
Passive
Active
Both a and b
None of the mentioned
Correct Answer: B — Active
Explanation:
No explanation is available for this question yet.
The following is an example of Struct PersonnelRecord { char name[100]; int socialSecurityNumber; char department[10]; float salary; };
Objects
Class
Both a and b
None of the mentioned
Correct Answer: B — Class
Explanation:
The above declaration denotes a class, not an object, because it does not represent a specific instance. To declare objects of this class we usually write in the following way:
PersonnelRecord deb, dave, jim, tom;
Class declaration is almost similar to struct declaration except that in reality it uses a keyword 'class' in place of 'struct.'
Which of the property of a object encompasses all of the (usually static) properties of the object plus the current (usually dynamic) values of each of these.
Semantics
Behavior
State
Identity
Correct Answer: C — State
Explanation:
No explanation is available for this question yet.
Which of the following property is associated with objects?
State
Behavior
Identity
All of the mentioned
Correct Answer: D — All of the mentioned
Explanation:
An object has state, exhibits some well defined behavior, and has a unique identity.