Object Oriented Programming - I (3140705) MCQs

MCQs of Object oriented thinking

Showing 31 to 40 out of 64 Questions
31.
Which of the following are incorrect form of StringBuffer class constructor?
(a) StringBuffer()
(b) StringBuffer(int size)
(c) StringBuffer(String str)
(d) StringBuffer(int size , String str)
Answer:

Option (d)

32.
Which of these class is superclass of String and StringBuffer class?
(a) java.util
(b) java.lang
(c) ArrayList
(d) None of the mentioned
Answer:

Option (b)

33.
Which of these operators can be used to concatenate two or more String objects?
(a) +
(b) +=
(c) &
(d) ||
Answer:

Option (a)

34.
Which of these method of class String is used to extract a single character from a String object?
(a) CHARAT()
(b) chatat()
(c) charAt()
(d) ChatAt()
Answer:

Option (c)

35.
Which of these constructors is used to create an empty String object?
(a) String()
(b) String(void)
(c) String(0)
(d) None of the mentioned
Answer:

Option (a)

36.
Which of these is an incorrect statement?
(a) String objects are immutable, they cannot be changed
(b) String object can point to some other reference of String variable
(c) StringBuffer class is used to store string in a buffer for later use
(d) None of the mentioned
Answer:

Option (c)

37.
Which of these method of class String is used to compare two String objects for their equality?
(a) equals()
(b) Equals()
(c) isequal()
(d) Isequal()
Answer:

Option (a)

38.
Which of these methods is used to compare a specific region inside a string with another specific region in another string?
(a) regionMatch()
(b) match()
(c) RegionMatches()
(d) regionMatches()
Answer:

Option (d)

39.
Which of these methods of class String is used to check whether a given object starts with a particular string literal?
(a) startsWith()
(b) endsWith()
(c) Starts()
(d) ends()
Answer:

Option (a)

40.
What is the value returned by function compareTo() if the invoking string is less than the string compared?
(a) zero
(b) value less than zero
(c) value greater than zero
(d) none of the mentioned
Answer:

Option (b)

Showing 31 to 40 out of 64 Questions