Home
Current Affairs January 2024

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

Correct Answer :

A. IOException


Related Questions

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

Which of the following methods can be used to draw the outline of a square?

A. fillRect()

B. drawLine()

C. drawString()

D. all of the above

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

Which of the following represent legal flow control statements?

A. break();

B. continue(inner);

C. return;

D. exit();

What is the correct answer?

4

It is an error if a class with one or more abstract methods is not explicitly declared abstract.

A. True

B. False

What is the correct answer?

4

The programmer must explicitly create the system .in and system .out objects.

A. True

B. False

What is the correct answer?

4

A JSP file can be stored_________________

A. With the extension .jsp in servlets folder of the jws

B. With the extension .html in public_html folder of the jws

C. With the extension .jsp in public_html folder of the jws

D. None of the above.

What is the correct answer?

4

Which of the following statements are true?

A. An abstract class may not have any final methods?

B. A final class may not have any abstracts methods.

C. Transient variables must be static.

D. all of the above

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

DataInput is

A. An abstract class defined is java.io.

B. A class we can use to read primitive data types.

C. An interface that defines methods to open files.

D. An interface that defines methods to read primitive data types.

What is the correct answer?

4

The modulus operator (%) can be used only with Integer operands.

A. True

B. False

What is the correct answer?

4

For all insert, update, delete, query operations on a database, ResultSet object creation is mandatory.

A. True.

B. False.

What is the correct answer?

4

Declarations can appear anywhere in the body of a Java method.

A. True

B. False

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

We can over load methods with differences only in their return type.

A. True

B. False

What is the correct answer?

4

A package is a collection of

A. classes

B. interface

C. editing tools

D. classes and interfaces

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

Consider the following class definition.
Class Student extends String
{
}
What happens when we try to compile this class?

A. Will not compile because class body is not defined

B. Will not compile because class is not declared public

C. Will compile successfully.

D. Will not compile because String is abstract

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

A panel can not be added to another panel.

A. True

B. False

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

Give file is a file object, which of the following are legal statements to create a new file.

A. file.create();

B. FileOutputStream fos=new FileOutputStream(file);

C. FileInputStream fis=new FileInputStream(file);

D. all 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

Connection, Statement are interfaces and ResultSet is a class.

A. True.

B. False.

What is the correct answer?

4

All methods in an abstract class must be declared abstract.

A. True

B. False

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

Consider the following code snippet:
try 
{
int x=0; int y=50/x;
System.out.println("Division by zero");
}
catch(ArithmeticException e)
{
System.out.println("catch block");
}

What will be the output?

A. Error. Won't compile

B. Division by zero

C. Catch block

D. Division by zero catch block

What is the correct answer?

4

When present, package must be the first no comment statement in the file.

A. True

B. False

What is the correct answer?

4

Throwing an exception always causes program termination.

A. True

B. False

What is the correct answer?

4

What does the following line of code do?
TextField text=new TextField(10);

A. Creates text object that can hold 10 rows of text.

B. Creates text object that can hold 10 columns of text.

C. Creates the object text and initializes it with the value 10.

D. The code is illegal.