Home / Programming Questions / JAVA MCQs / Page 266

JAVA MCQs with answers Page - 266

Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

M

Mr. Dubey • 51.17K Points
Coach

Q. Identify the statements that are not correct:

(A) Int a = 13, a>>2 = 3.
(B) Int b = -8, b>>1 = -4.
(C) Int a = 13, a>>>2 = 3.
(D) Int b = -8, b>>>1 = -2.

M

Mr. Dubey • 51.17K Points
Coach

Q. Consider the following code: int x, y, z;~~~y = 1;~~~z = 5;~~~x = 0 - (++y) + z++;~~~after execution of this, what will be the values of x, y and z?

(A) x = 4, y = 1, z = 5.
(B) x = 3, y = 2, z = 6.
(C) x = -7, y = 1, z = 5.
(D) x = 4, y = 2, z = 6.

M

Mr. Dubey • 51.17K Points
Coach

Q. What will be the result of the expression: a % b when a & b is of type int and their values~~~are a = 10 and b = 6?

(A) 1.66.
(B) 1.
(C) 2.
(D) 4.

M

Mr. Dubey • 51.17K Points
Coach

Q. Which of the following statements about abstract methods/classes in JAVA is true?

(A) An abstract class cannot be instantiated.
(B) Constructors can be abstract..
(C) A subclass of an abstract class must defined the abstract methods..
(D) Static methods may be declared abstract.

M

Mr. Dubey • 51.17K Points
Coach

Q. The keywords reserved but used in the initial version of JAVA are:

(A) union.
(B) const.
(C) inner.
(D) goto.

M

Mr. Dubey • 51.17K Points
Coach

Q. When we invoke repaint() for a JAVA.awt.Component object, the AWT invokes the method _____________.

(A) update().
(B) draw().
(C) show().
(D) paint().

M

Mr. Dubey • 51.17K Points
Coach

Q. The setBackground() method is part of the following class in JAVA.awt package.

(A) Component.
(B) Graphics.
(C) Applet.
(D) Container.

M

Mr. Dubey • 51.17K Points
Coach

Q. Which of the following methods can be used to draw the outline of a square within a JAVA.awt.Component object?

(A) drawLine().
(B) fillRect().
(C) drawString().
(D) drawPolygon().

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.