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.

21. Can a super class object give reference to a subclass method?
a. No, it is not possible
b. Maybe, it is possible
c. No, it’s not possible
d. No, It’s not possible in few cases only
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).No, it’s not possible

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

23. If a reference variable is declared final then, _________________
a. It can never be reassigned to refer to a different object.
b. It can be assigned to refer to any object anytime
c. It can never be assigned with any object
d. It can be assigned with 2 or more objects simultaneously
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).It can never be reassigned to refer to a different object.

24. Which of the members are referred by this pointer usually (Java)?
a. Members of class where this is used
b. Member of the parent class where this is used
c. Members that are passed as argument to the object
d. Pointers are not applicable in java
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Members of class where this is used

25. How to refer to method of nested class?
a. enclosingClassObject.innerClassObject.method();
b. innerClassObject.method();
c. method();
d. depends on where the method is being called
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).depends on where the method is being called

26. How many objects can be referenced from same variables?
a. One at a time
b. Many at a time
c. Many using array name
d. 7 at max at same time
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).One at a time

27. Java handles memory dynamically and references are deleted as soon as they are out of scope.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).True

28. Invoking a method on a particular object is ____________ sending a message to that object.
a. Different from
b. Same as
c. Somewhat similar
d. Part of
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Same as

29. Can reference to an object be returned from a method?
a. Yes, always possible
b. Yes, but not always
c. No, never possible
d. No, Not possible because referred element would be destroyed
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Yes, but not always

30. What does memory allocation for objects mean?
a. Actual creation and memory allocation for object members
b. Creation of member functions
c. Creation of data members for a class
d. Actual creation and data declaration for object members
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Actual creation and memory allocation for object members

Page 3 of 15