Home
Current Affairs January 2024

What is the correct answer?

4

Consider the following statements:
int x = 10, y = 15; 
x = ((x < y) ? (y + x) : (y - x);

What will be the value of x after executing these statements?

A. 25

B. 15

C. 5

D. Error can't be executed.

Correct Answer :

A. 25


Related Questions

What is the correct answer?

4

The concept of multiple inheritance is implemented in Java by

A. extending two or more classes

B. extending one class and implementing one or more interfaces

C. all the above

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

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

A. True

B. False

What is the correct answer?

4

Submit button always fires doPost(...)

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

Throwing an exception always causes program termination.

A. True

B. False

What is the correct answer?

4

A final class may not have any abstract method.

A. True

B. False

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

Message-Driven beans act as a listener for the Java Message Service API, processing messages synchronously

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

Members of a class specified as private are accessible only to the methods of the class.

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

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

A. True

B. False

What is the correct answer?

4

In evaluating a logical expression of type 'Boolean expression 1&& Boolean expression 2', both the Boolean expressions are not always evaluated.

A. True

B. False

What is the correct answer?

4

We can add more than one class(es) at the time of compilation Java Beans.

A. True.

B. False.

What is the correct answer?

4

A catch can have comma-separated multiple arguments.

A. True

B. False

What is the correct answer?

4

A thread can make second thread ineligible for execution by calling the suspend (-) method on second thread.

A. True

B. False

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 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

Two methods cannot have the same name in Java.

A. True

B. False

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

Which of the following classes are available in the java.lang package?

A. Random

B. Stack

C. String Buffer

D. Vector

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

If a=10 and b= 15, then the statement x =(a>b)?a:b; assigns the value 15 to x.

A. True

B. False

What is the correct answer?

4

Which of the following control expressions are valid for an if statement?

A. an integer expression

B. a Boolean expression

C. either A or B

D. Neither A or B

What is the correct answer?

4

JdbcOdbcDriver is an object of Object class

A. True

B. False

What is the correct answer?

4

A class may be both abstract and final.

A. True

B. False

What is the correct answer?

4

Which of the following will produce a value of 10 if x = 9.7?

A. floor(x)

B. abs(x)

C. rint(x)

D. round(x)

What is the correct answer?

4

forName() is a static factory method

A. True

B. False

What is the correct answer?

4

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

A. True

B. False