Home
Current Affairs January 2024

What is the correct answer?

4

What is wrong in the following class definitions? 
abstract class print { 
abstract show();
}
class Display extends print {
}

A. Nothing is wrong

B. Wrong Method show() should have a return type

C. Wrong Methods show() is not implemented in Display

D. Wrong Display does not contain any members.

Correct Answer :

C. Wrong Methods show() is not implemented in Display


Related Questions

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 methods belong to the String class?

A. length()

B. compareTo()

C. substring()

D. all of the them

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

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

A. True

B. False

What is the correct answer?

4

The import statement is always the first no comment statement in a Java program files.

A. True

B. False

What is the correct answer?

4

Frames and applets cannot be used together in the same program.

A. True

B. False

What is the correct answer?

4

When the string objects are compared with ==, the result is true If the strings contain the same values.

A. True

B. False

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

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

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

In order to connect to a database through java program we must create _______-

A. Connection, Statement, ResultSet

B. Connection, ResultSet

C. Statement< ResultSet

D. Connection, Statement

What is the correct answer?

4

Any class may be inherited by another class in the same package.

A. True

B. False

What is the correct answer?

4

Which of the following represent legal flow control statements?

A. break;

B. break();

C. continue(inner);

D. all of the above

What is the correct answer?

4

The keywords reserved but not used in the initial version of Java re:

A. Synchronized

B. Boolean

C. union

D. goto

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

We would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?

A. private

B. protected

C. public

D. private protected

What is the correct answer?

4

Which of the following statements are valid array declarations?

A. int number();

B. float average[];

C. double[] marks;

D. counter int[];

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

executeUpdate automatically updates data because___________

A. auto commit is on, by default

B. It performs a hidden commit statement as well

C. Does not commit

D. None of the above.

What is the correct answer?

4

The expression (x == y && a<b) is true If either x == y is true or a<b is true.

A. True

B. False

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

Connection, Statement are interfaces and ResultSet is a class.

A. True.

B. False.

What is the correct answer?

4

Every method of a final in class is implicitly final.

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

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

A string object can not be modified after it is created.

A. True

B. False

What is the correct answer?

4

Consider the following class definitions:
 class maths { 
student student1;
}
class student {
String name;
}

This code represents:

A. an 'is a' relationship

B. a 'has a' relationship

C. both

D. neither

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

DriverManager.getConnection("jdbc:odbc:dsn_name") method does not depend on the class.forName(...) method.

A. True.

B. False.

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