A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

31. Where is the memory allocated for the objects?
a. HDD
b. Cache
c. RAM
d. ROM
View Answer Report Discuss Too Difficult!
Answer: (c).RAM

32. When is the memory allocated for an object?
a. At declaration of object
b. At compile time
c. When object constructor is called
d. When object is initialized to another object
View Answer Report Discuss Too Difficult!
Answer: (c).When object constructor is called

33. Using new is type safe as _______________________
a. It require to be specified with type of data
b. It doesn’t require to be specified with type of data
c. It requires the name of data
d. It allocated memory for the data
View Answer Report Discuss Too Difficult!
Answer: (b).It doesn’t require to be specified with type of data

34. Which of the following function can be used for dynamic memory allocation of objects?
a. malloc()
b. calloc()
c. create()
d. malloc() and calloc()
View Answer Report Discuss Too Difficult!
Answer: (d).malloc() and calloc()

35. How much memory will be allocated for an object of class given below?
class Test
{
 int mark1;
 int mark2;
 float avg;
 char name[10];
};
a. 22 Bytes
b. 24 Bytes
c. 20 Bytes
d. 18 Bytes
View Answer Report Discuss Too Difficult!
Answer: (a).22 Bytes

36. Which keyword among the following can be used to declare an array of objects in java?
a. new
b. create
c. allocate
d. arr
View Answer Report Discuss Too Difficult!
Answer: (a).new

37. When is the memory allocated for an object gets free?
a. At termination of program
b. When object goes out of scope
c. When main function ends
d. When system restarts
View Answer Report Discuss Too Difficult!
Answer: (b).When object goes out of scope

38. Which among the following keyword can be used to free the allocated memory for an object?
a. delete
b. free
c. either delete or free
d. only delete
View Answer Report Discuss Too Difficult!
Answer: (c).either delete or free

39. Which function is called whenever an object goes out of scope?
a. Destructor function
b. Constructor function
c. Delete function
d. Free function
View Answer Report Discuss Too Difficult!
Answer: (a).Destructor function

40. Which operator can be used to check the size of an object?
a. sizeof(objectName)
b. size(objectName)
c. sizeofobject(objectName)
d. sizedobject(objectName)
View Answer Report Discuss Too Difficult!
Answer: (a).sizeof(objectName)

Page 4 of 15