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.

11. It is necessary to return the object if it was passed by reference to a function.
a. Yes, since the object must be same in caller function
b. Yes, since the caller function needs to reflect the changes
c. No, the changes are made automatically
d. No, the changes are made explicitly
View Answer Report Discuss Too Difficult!
Answer: (c).No, the changes are made automatically

12. How many objects can be passed to a function simultaneously?
a. Only 1
b. Only an array
c. Only 1 or an array
d. As many as required
View Answer Report Discuss Too Difficult!
Answer: (d).As many as required

13. If an object is passed by address, will be constructor be called?
a. Yes, to allocate the memory
b. Yes, to initialize the members
c. No, values are copied
d. No, temporary object is created
View Answer Report Discuss Too Difficult!
Answer: (c).No, values are copied

14. Is it possible that an object of is passed to a function, and the function also have an object of same name?
a. No, Duplicate declaration is not allowed
b. No, 2 objects will be created
c. Yes, Scopes are different
d. Yes, life span is different
View Answer Report Discuss Too Difficult!
Answer: (a).No, Duplicate declaration is not allowed

15. Passing an object using copy constructor and pass by value are same.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (b).False

16. What is reference to an object?
a. It is address of an object
b. It is address of where the variables and methods of object are stored
c. It is pointer having address of an object
d. It is address of only variables and not the methods of an object
View Answer Report Discuss Too Difficult!
Answer: (b).It is address of where the variables and methods of object are stored

17. Whenever an object is assigned to a variable or passed to a method, ________________
a. Actually the objects aren’t used
b. Actually only the objects are used
c. Actually a pointer to an object is used
d. Actually copy of object is used
View Answer Report Discuss Too Difficult!
Answer: (a).Actually the objects aren’t used

18. Does use of object reference in assignment or passing means copy of the object is being used?
a. No, because the copy would create a new temporary variable
b. No, because the copy would not help to make changes to main object
c. Yes, because the reference directly means using address
d. Yes, because the reference directly means the constructors are involved
View Answer Report Discuss Too Difficult!
Answer: (c).Yes, because the reference directly means using address

19. What will be the output of the following code?
import java.awt.Point;
class Testing
{
 public static void main(String[] args)
 {
  Point p1,p2;
  p1=new Point(100,100);
  p2=p1;
  p1.x=200;
  p1.y=200;
  System.out.println(“Point 1: ” + p1.x + ”, “ + p1.y);
  System.out.println(“Point 2: ” + p2.x + ”, “ + p2.y);
 }
}
a. Point 1: 100, 100
Point 2: 200,200
b. Point 1: 200, 200
Point 2: 100,100
c. Point 1: 100, 100
Point 2: 100,100
d. Point 1: 200, 200
Point 2: 200,200
View Answer Report Discuss Too Difficult!
Answer: (d).Point 1: 200, 200
Point 2: 200,200

20. Is there any explicit use of pointers in java that would be applicable to objects?
a. Yes, we use reference for this purpose
b. Yes, we use java arrays for this purpose
c. No, implicit pointing is possible
d. No, direct class names should be used
View Answer Report Discuss Too Difficult!
Answer: (c).No, implicit pointing is possible

Page 2 of 15