Java MCQs with answers Page - 23

Here, you will find a collection of MCQ questions on Java. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. The method setFont() is defined in---------- class

  • (A) Applet
  • (B) Font
  • (C) Container
  • (D) Component

A

Admin • 833.24K Points
Coach

Q. The layout manager that lets you align components at north, south, east, west directions is

  • (A) BorderLayout
  • (B) GridLayout
  • (C) FlowLayout
  • (D) GridBagLayout

A

Admin • 833.24K Points
Coach

Q. The class used for drawing graphics in an application is

  • (A) Canvas
  • (B) Graphics
  • (C) Layer
  • (D) Container

A

Admin • 833.24K Points
Coach

Q. The method in Graphics class to draw a circle/oval with specified width and height.

  • (A) drawCircle()
  • (B) drawShape()
  • (C) drawOval()
  • (D) none of these

A

Admin • 833.24K Points
Coach

Q. The method in Graphics class to set the drawing color

  • (A) setForeground()
  • (B) setDrawingColor()
  • (C) setBrushColor()
  • (D) setColor()

A

Admin • 833.24K Points
Coach

Q. The method used to draw an ellipse is

  • (A) drawEllipse()
  • (B) drawCircle()
  • (C) drawOval()
  • (D) none of these

A

Admin • 833.24K Points
Coach

Q. Which of the following statements is legal in Java? (i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef;

  • (A) Only (i)
  • (B) Only (ii)
  • (C) Both (i) and (ii)
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. In a ____ control structure, the computer executes particular statements depending on some condition(s).

  • (A) looping
  • (B) repetition
  • (C) selection
  • (D) sequence

A

Admin • 833.24K Points
Coach

Q. What is the value of y if x = 2?

  • (A) 2
  • (B) 3
  • (C) 7
  • (D) 9

A

Admin • 833.24K Points
Coach

Q. Two-way selection in Java is implemented using ________.

  • (A) if statements
  • (B) for loops
  • (C) if...else statements
  • (D) sequential statements

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ