Home
Current Affairs January 2024

What is the correct answer?

4

Given the code
String s = new String("abc");
Which of the following calls are valid?

A. s.toUpperCase()

B. s.append("xyz")

C. s.setCharAt(1<'A')

D. all of the above

Correct Answer :

A. s.toUpperCase()


Related Questions

What is the correct answer?

4

The length of a string object 's1' can be obtained using the expression s1.length.

A. True

B. False

What is the correct answer?

4

When we implement an interface method, it should be declared as public.

A. True

B. False

What is the correct answer?

4

executeUpdate(------------) returns ___________

A. Nothing

B. Returns a ResultSet object

C. Returns an integer value to show the no. of updated rows

D. None of the above.

What is the correct answer?

4

To delete a file, we can use an instance of class file.

A. True

B. False

What is the correct answer?

4

Servlet has ___________

A. init method

B. doGet(------) method

C. All of the above methods.

What is the correct answer?

4

The use of protected keyword to a member in a class will restrict its visibility as follows:

A. Visibility only in the class and its subclasses in the same package.

B. Visibility only inside the same package.

C. Visibility in all classes in the same package and subclasses in other packages.

D. Visibility only in the class where it is declared.

What is the correct answer?

4

Servlet can have ___________

A. get method and post method

B. get method or post method

C. Either of the above

What is the correct answer?

4

class.forName(...) creates an instance of java ODBC driver

A. True

B. False

What is the correct answer?

4

Any method in a supper class can be over ridden in its subclass.

A. True

B. False

What is the correct answer?

4

Which of the following keywords are used to control access to a class member?

A. default

B. protected

C. interface

D. None of the above

What is the correct answer?

4

It is perfectly legal to assign a subclass object to a supper class reference.

A. True

B. False

What is the correct answer?

4

The name of a Java program file must match the name of the class with the extension Java.

A. True

B. False

What is the correct answer?

4

Which of the following command lines options generates documentation for all classes and methods?

A. -protected

B. -public

C. -private

D. -encoding

What is the correct answer?

4

A Java monitor must either extend thread class or implement Runnable interface.

A. True

B. False

What is the correct answer?

4

In RMI before running the client program we must start RMI Registry.

A. True.

B. False.

What is the correct answer?

4

Which exception is thrown by the read() method of InputStream class?

A. IOException

B. FileNotFoundException

C. ReadException

D. None of the above

What is the correct answer?

4

What is java -g used for?

A. Using the jdb tool

B. Executing a class with optimization turned off

C. To provided information about deprecated methods

D. Non of the above

What is the correct answer?

4

JSP files creates ________________

A. html files

B. html files and java files

C. java files and class files

D. None of the above.

What is the correct answer?

4

forName() is a static factory method

A. True

B. False

What is the correct answer?

4

Java always provides a default constructor to a class.

A. True

B. False

What is the correct answer?

4

Which of the following string can be used as mode string for creating a RandomAccessFile object?

A. "rw"

B. "wr"

C. "0"

D. 'w''

What is the correct answer?

4

Which of the following methods can be used to remove a component from the display?

A. remove()

B. desappear()

C. hide()

D. move()

What is the correct answer?

4

The methods wait() and noify() are defined in

A. java.lang.Thread

B. java.lang.Runnable

C. java.lang.Object

D. java.lang.ThreadGroup

What is the correct answer?

4

When we implement the Runnable interface, we must define the method

A. start()

B. init()

C. runnable()

D. run()

What is the correct answer?

4

When X is a positive number the operations x>> 2 and x>>>2 both produce the same result.

A. True

B. False

What is the correct answer?

4

A variable declared inside the for loop control can not be referenced out side the loop.

A. True

B. False

What is the correct answer?

4

Objects are passed to a method by use of call-by-reference.

A. True

B. False

What is the correct answer?

4

Which of the following are not keywords?

A. NULL

B. Implements

C. Protected

D. None of the above

What is the correct answer?

4

Given the code
String s = new String("abc");
Which of the following calls are valid?

A. s.toUpperCase()

B. s.append("xyz")

C. s.setCharAt(1<'A')

D. all of the above

What is the correct answer?

4

Which of the following are the wrapper classes?

A. Random

B. Vector

C. Byte

D. all of the above